argTable = new JTable();  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);
  public NodeArgumentDialog(String title, Properties props, boolean isLocal) {    super((Frame)null, title, true); // display modal dialog    createLogger();    Box nodeArgPanel = Box.createVerticalBox();    JPanel argumentPanel = new JPanel();    // ok and cancel buttons panel    JPanel buttonPanel = new JPanel();    JButton okButton = new JButton("OK");    // if user confirms the dialog and hasn't terminated editing a table cell    // then get the value from that cell editor and set it in the cell    okButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        Component c = argTable.getEditorComponent();        if (c != null)          if (c instanceof JTextField) {            int rowIndex = argTable.getEditingRow();            int colIndex = argTable.getEditingColumn();            if (rowIndex != -1 && colIndex != -1)              model.setValueAt(((JTextField)c).getText(), rowIndex, colIndex);          } else            if(log.isErrorEnabled()) {              log.error("Unexpected editor class: " + c.getClass());            }        returnValue = JOptionPane.OK_OPTION;        setVisible(false);      }    });    buttonPanel.add(okButton);    JButton cancelButton = new JButton("Cancel");    cancelButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        returnValue = JOptionPane.CANCEL_OPTION;        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) {        model.addRow("", "");      }    });    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)          model.removeRow(i);      }    });    tableButtonPanel.add(deleteButton);    JButton fileButton = new JButton("Read From File");    fileButton.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        readPropertiesFromFile();      }    });    tableButtonPanel.add(fileButton);    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);    addWindowListener(new WindowAdapter() {      public void windowClosing(WindowEvent e) {        returnValue = JOptionPane.CLOSED_OPTION;        NodeArgumentDialog.this.setVisible(false);      }    });    // initialize text area and table from properties    this.props = props;    String value = props.getProperty(CSMARTConsole.COMMAND_ARGUMENTS);    setArguments(value);    model = new NodeArgumentTableModel(props, isLocal);    argTable.setModel(model);    pack();  }