List of usage examples for javax.swing BorderFactory createEmptyBorder
public static Border createEmptyBorder(int top, int left, int bottom, int right)
From source file:FrameDemo2.java
protected JComponent createOptionControls() { JLabel label1 = new JLabel("Decoration options for subsequently created frames:"); ButtonGroup bg1 = new ButtonGroup(); JLabel label2 = new JLabel("Icon options:"); ButtonGroup bg2 = new ButtonGroup(); // Create the buttons JRadioButton rb1 = new JRadioButton(); rb1.setText("Look and feel decorated"); rb1.setActionCommand(LF_DECORATIONS); rb1.addActionListener(this); rb1.setSelected(true);/*www . j a v a 2 s .c o m*/ bg1.add(rb1); // JRadioButton rb2 = new JRadioButton(); rb2.setText("Window system decorated"); rb2.setActionCommand(WS_DECORATIONS); rb2.addActionListener(this); bg1.add(rb2); // JRadioButton rb3 = new JRadioButton(); rb3.setText("No decorations"); rb3.setActionCommand(NO_DECORATIONS); rb3.addActionListener(this); bg1.add(rb3); // // JRadioButton rb4 = new JRadioButton(); rb4.setText("Default icon"); rb4.setActionCommand(DEFAULT_ICON); rb4.addActionListener(this); rb4.setSelected(true); bg2.add(rb4); // JRadioButton rb5 = new JRadioButton(); rb5.setText("Icon from a JPEG file"); rb5.setActionCommand(FILE_ICON); rb5.addActionListener(this); bg2.add(rb5); // JRadioButton rb6 = new JRadioButton(); rb6.setText("Painted icon"); rb6.setActionCommand(PAINT_ICON); rb6.addActionListener(this); bg2.add(rb6); // Add everything to a container. Box box = Box.createVerticalBox(); box.add(label1); box.add(Box.createVerticalStrut(5)); // spacer box.add(rb1); box.add(rb2); box.add(rb3); // box.add(Box.createVerticalStrut(15)); // spacer box.add(label2); box.add(Box.createVerticalStrut(5)); // spacer box.add(rb4); box.add(rb5); box.add(rb6); // Add some breathing room. box.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); return box; }
From source file:components.FrameDemo2.java
protected JComponent createButtonPane() { JButton button = new JButton("New window"); button.setActionCommand(CREATE_WINDOW); button.addActionListener(this); defaultButton = button; //Used later to make this the frame's default button. //Center the button in a panel with some space around it. JPanel pane = new JPanel(); //use default FlowLayout pane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); pane.add(button);//from w w w . j a v a 2 s . co m return pane; }
From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java
private JPanel buildUiBodyStatePanel() { // Create a grid bag constraints configuration GridBagConstraints c = new GridBagConstraints(); // Body state panel final JPanel bodyStatePanel = new JPanel(new GridBagLayout()); bodyStatePanel.setBorder(new CompoundBorder(BorderFactory.createTitledBorder("BMI tool"), BorderFactory.createEmptyBorder(8, 8, 8, 8))); // Add the student panel to the body state panel c.fill = GridBagConstraints.BOTH; c.gridx = 0;/*from w ww . ja v a2s .c om*/ c.gridy = 0; c.weightx = 1; c.weighty = 1; c.gridheight = 2; c.insets = new Insets(0, 0, 0, 0); c.anchor = GridBagConstraints.CENTER; bodyStatePanel.add(buildUiStudentPanel(), c); // Add the input panel to the body state panel c.fill = GridBagConstraints.BOTH; c.gridx = 1; c.gridy = 0; c.weightx = 1; c.weighty = 1; c.gridheight = 1; c.insets = new Insets(0, 16, 0, 0); c.anchor = GridBagConstraints.NORTH; bodyStatePanel.add(buildUiChartPanel(), c); // Add the input panel to the body state panel c.fill = GridBagConstraints.BOTH; c.gridx = 1; c.gridy = 1; c.weightx = 0; c.weighty = 0; c.gridheight = 1; c.insets = new Insets(32, 16, 0, 0); c.anchor = GridBagConstraints.CENTER; bodyStatePanel.add(buildUiStudentBodyStatesPanel(), c); // Return the body state panel return bodyStatePanel; }
From source file:edu.gmu.cs.sim.util.media.chart.SeriesAttributes.java
/** Builds a SeriesAttributes with the provided generator, name for the series, and index for the series. Calls buildAttributes to construct custom elements in the LabelledList, then finally calls rebuildGraphicsDefinitions() to update the series. *///from w ww .j a va2s . c o m public SeriesAttributes(ChartGenerator generator, String name, int index, SeriesChangeListener stoppable) { super(name); setStoppable(stoppable); this.generator = generator; seriesIndex = index; final JCheckBox check = new JCheckBox(); check.setSelected(true); check.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setPlotVisible(check.isSelected()); } }); manipulators = new Box(BoxLayout.X_AXIS); buildManipulators(); JLabel spacer = new JLabel(""); spacer.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); Box b = new Box(BoxLayout.X_AXIS); b.add(check); b.add(spacer); b.add(manipulators); b.add(Box.createGlue()); addLabelled("Show", b); final PropertyField nameF = new PropertyField(name) { public String newValue(String newValue) { SeriesAttributes.this.setSeriesName(newValue); rebuildGraphicsDefinitions(); return newValue; } }; addLabelled("Series", nameF); buildAttributes(); rebuildGraphicsDefinitions(); }
From source file:com.ixora.common.ui.ShowExceptionDialog.java
/** * Initializes this dialog./*from w ww . ja v a 2s . c o m*/ */ private void initialize() { this.eventHandler = new EventHandler(); setSize(smallSize); setTitle(MessageRepository.get(Msg.COMMON_UI_TEXT_ERROR)); if (isDefaultLookAndFeelDecorated()) { getRootPane().setWindowDecorationStyle(JRootPane.ERROR_DIALOG); } textExceptionLong = UIFactoryMgr.createHtmlPane(); textExceptionLong.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); textExceptionLong.setEditable(false); textExceptionLong.addHyperlinkListener(this.eventHandler); textExceptionShort = UIFactoryMgr.createTextField(); textExceptionShort.setHorizontalAlignment(JTextField.CENTER); textExceptionShort.setBorder(null); textExceptionShort.setEditable(false); panel = new JPanel(new CardLayout()); JScrollPane s = UIFactoryMgr.createScrollPane(); s.setBorder(null); s.setViewportView(textExceptionLong); panel.add(s, "long"); panel.add(textExceptionShort, "short"); // set background color to the color of the panel textExceptionShort.setBackground(panel.getBackground()); textExceptionLong.setBackground(panel.getBackground()); buildContentPane(); }
From source file:src.gui.LifelinePanel.java
/** * this method created and set the graph for showing the timing diagram based * on the variable diagram//from w ww .jav a 2 s .c o m */ public void buildLifeLine() { //1. get type and context String dtype = diagram.getChildText("type"); String context = diagram.getChildText("context"); //the frame and lifeline nodes Element frame = diagram.getChild("frame"); String durationStr = frame.getChildText("duration"); lifelineName = ""; String objectClassName = ""; String yAxisName = ""; float lastIntervalDuration = 0; //condition lifeline if (dtype.equals("condition")) { //check if the context is a action if (context.equals("action")) { //get action/operator Element operatorRef = diagram.getChild("action"); Element operator = null; try { XPath path = new JDOMXPath( "elements/classes/class[@id='" + operatorRef.getAttributeValue("class") + "']/operators/operator[@id='" + operatorRef.getAttributeValue("id") + "']"); operator = (Element) path.selectSingleNode(project); } catch (JaxenException e2) { e2.printStackTrace(); } if (operator != null) { // System.out.println(operator.getChildText("name")); //System.out.println("Life line id "+ lifeline.getAttributeValue("id")); //get the object (can be a parametr. literal, or object) Element objRef = lifeline.getChild("object"); Element attrRef = lifeline.getChild("attribute"); //get object class Element objClass = null; try { XPath path = new JDOMXPath( "elements/classes/class[@id='" + objRef.getAttributeValue("class") + "']"); objClass = (Element) path.selectSingleNode(project); } catch (JaxenException e2) { e2.printStackTrace(); } Element attribute = null; try { XPath path = new JDOMXPath( "elements/classes/class[@id='" + attrRef.getAttributeValue("class") + "']/attributes/attribute[@id='" + attrRef.getAttributeValue("id") + "']"); attribute = (Element) path.selectSingleNode(project); } catch (JaxenException e2) { e2.printStackTrace(); } yAxisName = attribute.getChildText("name"); //if (objClass!=null) Element object = null; //check what is this object (parameterof an action, object, literal) if (objRef.getAttributeValue("element").equals("parameter")) { //get parameter in the action try { XPath path = new JDOMXPath( "parameters/parameter[@id='" + objRef.getAttributeValue("id") + "']"); object = (Element) path.selectSingleNode(operator); } catch (JaxenException e2) { e2.printStackTrace(); } String parameterStr = object.getChildText("name"); lifelineName = parameterStr + ":" + objClass.getChildText("name"); objectClassName = parameterStr + ":" + objClass.getChildText("name"); } // //set suround border Border etchedBdr = BorderFactory.createEtchedBorder(); Border titledBdr = BorderFactory.createTitledBorder(etchedBdr, "lifeline(" + lifelineName + ")"); //Border titledBdr = BorderFactory.createTitledBorder(etchedBdr, ""); Border emptyBdr = BorderFactory.createEmptyBorder(10, 10, 10, 10); Border compoundBdr = BorderFactory.createCompoundBorder(titledBdr, emptyBdr); this.setBorder(compoundBdr); //Boolean attribute if (attribute.getChildText("type").equals("1")) { lifelineName += " - " + attribute.getChildText("name"); Element timeIntervals = lifeline.getChild("timeIntervals"); XYSeriesCollection dataset = new XYSeriesCollection(); XYSeries series = new XYSeries("Boolean"); for (Iterator<Element> it1 = timeIntervals.getChildren().iterator(); it1.hasNext();) { Element timeInterval = it1.next(); boolean insertPoint = true; Element durationConstratint = timeInterval.getChild("durationConstratint"); Element lowerbound = durationConstratint.getChild("lowerbound"); Element upperbound = durationConstratint.getChild("upperbound"); Element value = timeInterval.getChild("value"); //Add for both lower and upper bound //lower bound float lowerTimePoint = 0; try { lowerTimePoint = Float.parseFloat(lowerbound.getAttributeValue("value")); lastIntervalDuration = lowerTimePoint; } catch (Exception e) { insertPoint = false; } //System.out.println(" > point x= "+ Float.toString(lowerTimePoint)+ " , y= "+ lowerbound.getAttributeValue("value")); if (insertPoint) { series.add(lowerTimePoint, (value.getText().equals("false") ? 0 : 1)); } //upper bound float upperTimePoint = 0; try { upperTimePoint = Float.parseFloat(upperbound.getAttributeValue("value")); lastIntervalDuration = upperTimePoint; } catch (Exception e) { insertPoint = false; } //System.out.println(" > point x= "+ Float.toString(upperTimePoint)+ " , y= "+ lowerbound.getAttributeValue("value")); if (insertPoint && upperTimePoint != lowerTimePoint) { series.add(upperTimePoint, (value.getText().equals("false") ? 0 : 1)); } } dataset.addSeries(series); //chart = ChartFactory.createXYStepChart(lifelineName, "time", "value", dataset, PlotOrientation.VERTICAL, false, true, false); chart = ChartFactory.createXYStepChart(attribute.getChildText("name"), "time", "value", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); NumberAxis domainAxis = new NumberAxis("Time"); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setAutoRangeIncludesZero(false); //set timing ruler if (durationStr.trim().equals("")) { if (lastIntervalDuration > 0) domainAxis.setUpperBound(lastIntervalDuration + timingRulerAdditional); else domainAxis.setUpperBound(10.0); } else { try { float dur = Float.parseFloat(durationStr); if (dur >= lastIntervalDuration) { domainAxis.setUpperBound(dur + timingRulerAdditional); } else { domainAxis.setUpperBound(lastIntervalDuration + timingRulerAdditional); } } catch (Exception e) { if (lastIntervalDuration > 0) domainAxis.setUpperBound(lastIntervalDuration + timingRulerAdditional); else domainAxis.setUpperBound(10.0); } } plot.setDomainAxis(domainAxis); String[] values = { "false", "true" }; //SymbolAxis rangeAxis = new SymbolAxis("Values", values); SymbolAxis rangeAxis = new SymbolAxis(yAxisName, values); plot.setRangeAxis(rangeAxis); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(chartPanel.getSize().width, 175)); JLabel title = new JLabel("<html><b><u>" + objectClassName + "</u></b></html>"); title.setBackground(Color.WHITE); this.add(title, BorderLayout.WEST); this.add(chartPanel, BorderLayout.CENTER); } } } //if this is a possible sequence of action being modeled to a condition else if (context.equals("general")) { } } else if (dtype.equals("state")) { } }
From source file:com.intel.stl.ui.monitor.view.PSPortsDetailsPanel.java
protected JPanel createDeviceTypePanel() { JPanel panel = new JPanel(); panel.setOpaque(false);//from w w w .ja va 2s. com panel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); GridBagLayout gridBag = new GridBagLayout(); panel.setLayout(gridBag); GridBagConstraints gc = new GridBagConstraints(); gc.insets = new Insets(8, 2, 2, 2); gc.weighty = 0; gc.weightx = 1; gc.gridwidth = GridBagConstraints.REMAINDER; gc.gridheight = 1; deviceTypeChartPanel = new ChartPanel(null); deviceTypeChartPanel.setPreferredSize(new Dimension(80, 60)); panel.add(deviceTypeChartPanel, gc); typeNumberLabels = new JLabel[nodeTypes.length]; typeNameLabels = new JLabel[nodeTypes.length]; gc.fill = GridBagConstraints.BOTH; gc.insets = new Insets(2, 2, 2, 2); for (int i = 0; i < nodeTypes.length; i++) { gc.weightx = 1; gc.gridwidth = 1; typeNumberLabels[i] = createNumberLabel(); panel.add(typeNumberLabels[i], gc); gc.weightx = 0; gc.gridwidth = GridBagConstraints.REMAINDER; typeNameLabels[i] = createNameLabel(nodeTypes[i].getName()); panel.add(typeNameLabels[i], gc); } return panel; }
From source file:net.sf.jabref.gui.preftabs.AppearancePrefsTab.java
/** * Customization of appearance parameters. * * @param prefs a <code>JabRefPreferences</code> value *//* ww w .j a v a2s. com*/ public AppearancePrefsTab(JabRefPreferences prefs) { this.prefs = prefs; setLayout(new BorderLayout()); // Font sizes: fontSize = new JTextField(5); // Row padding size: rowPadding = new JTextField(5); colorCodes = new JCheckBox(Localization.lang("Color codes for required and optional fields")); overrideFonts = new JCheckBox(Localization.lang("Override default font settings")); showGrid = new JCheckBox(Localization.lang("Show gridlines")); FormLayout layout = new FormLayout( "1dlu, 8dlu, left:pref, 4dlu, fill:pref, 4dlu, fill:60dlu, 4dlu, fill:pref", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); customLAF = new JCheckBox(Localization.lang("Use other look and feel")); // Only list L&F which are available List<String> lookAndFeels = LookAndFeel.getAvailableLookAndFeels(); classNamesLAF = new JComboBox<>(lookAndFeels.toArray(new String[lookAndFeels.size()])); classNamesLAF.setEditable(true); final JComboBox<String> clName = classNamesLAF; customLAF.addChangeListener(e -> clName.setEnabled(((JCheckBox) e.getSource()).isSelected())); // only the default L&F shows the the OSX specific first dropdownmenu if (!OS.OS_X) { JPanel pan = new JPanel(); builder.appendSeparator(Localization.lang("Look and feel")); JLabel lab = new JLabel( Localization.lang("Default look and feel") + ": " + UIManager.getSystemLookAndFeelClassName()); builder.nextLine(); builder.append(pan); builder.append(lab); builder.nextLine(); builder.append(pan); builder.append(customLAF); builder.nextLine(); builder.append(pan); JPanel pan2 = new JPanel(); lab = new JLabel(Localization.lang("Class name") + ':'); pan2.add(lab); pan2.add(classNamesLAF); builder.append(pan2); builder.nextLine(); builder.append(pan); lab = new JLabel(Localization .lang("Note that you must specify the fully qualified class name for the look and feel,")); builder.append(lab); builder.nextLine(); builder.append(pan); lab = new JLabel(Localization .lang("and the class must be available in your classpath next time you start JabRef.")); builder.append(lab); builder.nextLine(); } builder.leadingColumnOffset(2); JLabel lab; builder.appendSeparator(Localization.lang("General")); JPanel p1 = new JPanel(); lab = new JLabel(Localization.lang("Menu and label font size") + ":"); p1.add(lab); p1.add(fontSize); builder.append(p1); builder.nextLine(); builder.append(overrideFonts); builder.nextLine(); builder.appendSeparator(Localization.lang("Table appearance")); JPanel p2 = new JPanel(); p2.add(new JLabel(Localization.lang("Table row height padding") + ":")); p2.add(rowPadding); builder.append(p2); builder.nextLine(); builder.append(colorCodes); builder.nextLine(); builder.append(showGrid); builder.nextLine(); JButton fontButton = new JButton(Localization.lang("Set table font")); builder.append(fontButton); builder.nextLine(); builder.appendSeparator(Localization.lang("Table and entry editor colors")); builder.append(colorPanel); JPanel upper = new JPanel(); JPanel sort = new JPanel(); JPanel namesp = new JPanel(); JPanel iconCol = new JPanel(); GridBagLayout gbl = new GridBagLayout(); upper.setLayout(gbl); sort.setLayout(gbl); namesp.setLayout(gbl); iconCol.setLayout(gbl); overrideFonts.addActionListener(e -> fontSize.setEnabled(overrideFonts.isSelected())); fontButton.addActionListener(e -> new FontSelectorDialog(null, GUIGlobals.currentFont).getSelectedFont() .ifPresent(x -> usedFont = x)); JPanel pan = builder.getPanel(); pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(pan, BorderLayout.CENTER); }
From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java
private JComponent createQuickOpenPanel(JPanel panel, String title, List<Action> quickOpenActionList, List<File> fileList) { panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); refreshQuickOpenPanel(panel, quickOpenActionList, fileList); JScrollPane scrollPane = new JScrollPane(panel); scrollPane.getVerticalScrollBar().setUnitIncrement(25); scrollPane.setMinimumSize(new Dimension(100, 80)); // Size fits into screen resolution 1024*768 scrollPane.setPreferredSize(new Dimension(180, 200)); JPanel titlePanel = new JPanel(new BorderLayout()); titlePanel.add(scrollPane, BorderLayout.CENTER); titlePanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder(title))); return titlePanel; }
From source file:com.mirth.connect.connectors.file.AdvancedSftpSettingsDialog.java
private void initComponents() { authenticationLabel = new JLabel("Authentication:"); usePasswordRadio = new JRadioButton("Password"); usePasswordRadio.setFocusable(false); usePasswordRadio.setBackground(new Color(255, 255, 255)); usePasswordRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); usePasswordRadio.setToolTipText("Select this option to use a password to gain access to the server."); usePasswordRadio.addActionListener(new ActionListener() { @Override// w w w .j ava 2 s . c o m public void actionPerformed(ActionEvent e) { authenticationRadioButtonActionPerformed(); } }); usePrivateKeyRadio = new JRadioButton("Public Key"); usePrivateKeyRadio.setSelected(true); usePrivateKeyRadio.setFocusable(false); usePrivateKeyRadio.setBackground(UIConstants.BACKGROUND_COLOR); usePrivateKeyRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); usePrivateKeyRadio .setToolTipText("Select this option to use a public/private keypair to gain access to the server."); usePrivateKeyRadio.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { authenticationRadioButtonActionPerformed(); } }); useBothRadio = new JRadioButton("Both"); useBothRadio.setSelected(true); useBothRadio.setFocusable(false); useBothRadio.setBackground(UIConstants.BACKGROUND_COLOR); useBothRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); useBothRadio.setToolTipText( "Select this option to use both a password and a public/private keypair to gain access to the server."); useBothRadio.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { authenticationRadioButtonActionPerformed(); } }); privateKeyButtonGroup = new ButtonGroup(); privateKeyButtonGroup.add(usePasswordRadio); privateKeyButtonGroup.add(usePrivateKeyRadio); privateKeyButtonGroup.add(useBothRadio); keyLocationLabel = new JLabel("Public/Private Key File:"); keyLocationField = new JTextField(); keyLocationField.setToolTipText( "The absolute file path of the public/private keypair used to gain access to the remote server."); passphraseLabel = new JLabel("Passphrase:"); passphraseField = new JPasswordField(); passphraseField.setToolTipText("The passphrase associated with the public/private keypair."); useKnownHostsLabel = new JLabel("Host Key Checking:"); useKnownHostsYesRadio = new JRadioButton("Yes"); useKnownHostsYesRadio.setFocusable(false); useKnownHostsYesRadio.setBackground(UIConstants.BACKGROUND_COLOR); useKnownHostsYesRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); useKnownHostsYesRadio.setToolTipText( "<html>Select this option to validate the server's host key within the provided<br>Known Hosts file. Known Hosts file is required.</html>"); useKnownHostsAskRadio = new JRadioButton("Ask"); useKnownHostsAskRadio.setFocusable(false); useKnownHostsAskRadio.setBackground(UIConstants.BACKGROUND_COLOR); useKnownHostsAskRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); useKnownHostsAskRadio.setToolTipText( "<html>Select this option to ask the user to add the server's host key to the provided<br>Known Hosts file. Known Hosts file is optional.</html>"); useKnownHostsNoRadio = new JRadioButton("No"); useKnownHostsNoRadio.setSelected(true); useKnownHostsNoRadio.setFocusable(false); useKnownHostsNoRadio.setBackground(UIConstants.BACKGROUND_COLOR); useKnownHostsNoRadio.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); useKnownHostsNoRadio.setToolTipText( "<html>Select this option to always add the server's host key to the provided<br>Known Hosts file. Known Hosts file is optional.</html>"); knownHostsButtonGroup = new ButtonGroup(); knownHostsButtonGroup.add(useKnownHostsYesRadio); knownHostsButtonGroup.add(useKnownHostsAskRadio); knownHostsButtonGroup.add(useKnownHostsNoRadio); knownHostsLocationLabel = new JLabel("Known Hosts File:"); knownHostsField = new JTextField(); knownHostsField .setToolTipText("The path to the local Known Hosts file used to authenticate the remote server."); configurationsLabel = new JLabel("Configuration Options:"); configurationsTable = new MirthTable(); Object[][] tableData = new Object[0][1]; configurationsTable.setModel(new RefreshTableModel(tableData, new String[] { "Name", "Value" })); configurationsTable.setOpaque(true); configurationsTable.getColumnModel() .getColumn(configurationsTable.getColumnModel().getColumnIndex(NAME_COLUMN_NAME)) .setCellEditor(new ConfigTableCellEditor(true)); configurationsTable.getColumnModel() .getColumn(configurationsTable.getColumnModel().getColumnIndex(VALUE_COLUMN_NAME)) .setCellEditor(new ConfigTableCellEditor(false)); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { Highlighter highlighter = HighlighterFactory.createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR); configurationsTable.setHighlighters(highlighter); } configurationsScrollPane = new JScrollPane(); configurationsScrollPane.getViewport().add(configurationsTable); newButton = new JButton("New"); newButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultTableModel model = (DefaultTableModel) configurationsTable.getModel(); Vector<String> row = new Vector<String>(); String header = "Property"; for (int i = 1; i <= configurationsTable.getRowCount() + 1; i++) { boolean exists = false; for (int index = 0; index < configurationsTable.getRowCount(); index++) { if (((String) configurationsTable.getValueAt(index, 0)).equalsIgnoreCase(header + i)) { exists = true; } } if (!exists) { row.add(header + i); break; } } model.addRow(row); int rowSelectionNumber = configurationsTable.getRowCount() - 1; configurationsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber); Boolean enabled = deleteButton.isEnabled(); if (!enabled) { deleteButton.setEnabled(true); } } }); deleteButton = new JButton("Delete"); deleteButton.setEnabled(false); deleteButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int rowSelectionNumber = configurationsTable.getSelectedRow(); if (rowSelectionNumber > -1) { DefaultTableModel model = (DefaultTableModel) configurationsTable.getModel(); model.removeRow(rowSelectionNumber); rowSelectionNumber--; if (rowSelectionNumber > -1) { configurationsTable.setRowSelectionInterval(rowSelectionNumber, rowSelectionNumber); } if (configurationsTable.getRowCount() == 0) { deleteButton.setEnabled(false); } } } }); okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { okCancelButtonActionPerformed(); } }); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { dispose(); } }); authenticationRadioButtonActionPerformed(); }