Component c = argTable.getEditorComponent(); if (c != null) if (c instanceof JTextField) { int rowIndex = argTable.getEditingRow(); int colIndex = argTable.getEditingColumn(); if (rowIndex != -1 && colIndex != -1) argTable.getModel().setValueAt(((JTextField)c).getText(), rowIndex, colIndex); } else System.out.println("Unexpected editor class: " + c.getClass());
  public NodeArgumentDialog(String title) {    super((Frame)null, title, true); // display modal dialog    Box nodeArgPanel = Box.createVerticalBox();    JPanel argumentPanel = new JPanel();    // ok and cancel buttons panel    JPanel buttonPanel = new JPanel();    JButton okButton = new JButton("OK");    okButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        setVisible(false);      }    });    buttonPanel.add(okButton);    JButton cancelButton = new JButton("Cancel");    cancelButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        setVisible(false);      }    });    buttonPanel.add(cancelButton);    // add JTable    argTable = new JTable();    // don't allow user to reorder columns    argTable.getTableHeader().setReorderingAllowed(false);    argTable.setColumnSelectionAllowed(false);    argTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);    JScrollPane scrollPane = new JScrollPane(argTable);    JPanel tablePanel = new JPanel(new BorderLayout());    tablePanel.setBorder(BorderFactory.createTitledBorder("-D Options"));    tablePanel.add(scrollPane);    // add buttons to add/delete properties    JPanel tableButtonPanel = new JPanel();    JButton addButton = new JButton("Add Property");    addButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        Vector newData = new Vector(2);        newData.add("");        newData.add("");        ((DefaultTableModel)argTable.getModel()).addRow(newData);      }    });    tableButtonPanel.add(addButton);    JButton deleteButton = new JButton("Delete Property");    deleteButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        int i = argTable.getSelectedRow();        if (i != -1)          ((DefaultTableModel)argTable.getModel()).removeRow(i);      }    });    tableButtonPanel.add(deleteButton);    tablePanel.add(tableButtonPanel, BorderLayout.SOUTH);    argumentPanel.setBorder(BorderFactory.createTitledBorder("Arguments"));    args = new JTextArea(10, 40);    args.setToolTipText("Enter command line args one per line");    argumentPanel.add(args);    nodeArgPanel.add(tablePanel);    nodeArgPanel.add(argumentPanel);    nodeArgPanel.add(buttonPanel);    getContentPane().add(nodeArgPanel);    pack();  }