List of usage examples for javax.swing JColorChooser showDialog
public static Color showDialog(Component component, String title, Color initialColor) throws HeadlessException
From source file:MainClass.java
public ColorChooserEditor() { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color color = JColorChooser.showDialog(delegate, "Color Chooser", savedColor); ColorChooserEditor.this.changeColor(color); }/* ww w .j a va2s . c o m*/ }; delegate.addActionListener(actionListener); }
From source file:Main.java
public ColorChooserEditor() { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color color = JColorChooser.showDialog(delegate, "Color Chooser", savedColor); ColorChooserEditor.this.changeColor(color); }// ww w . j a v a2 s . c om }; delegate.addActionListener(actionListener); addCellEditorListener(new CellEditorListener() { @Override public void editingCanceled(ChangeEvent e0) { System.out.println(e0); } @Override public void editingStopped(ChangeEvent e1) { System.out.println(e1); } }); }
From source file:Main.java
public ColorChooserEditor() { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color color = JColorChooser.showDialog(delegate, "Color Chooser", savedColor); ColorChooserEditor.this.changeColor(color); }/*from w w w. ja v a2 s. c o m*/ }; delegate.addActionListener(actionListener); CellEditorListener lis = new CellEditorListener() { @Override public void editingCanceled(ChangeEvent e0) { System.out.println(e0); } @Override public void editingStopped(ChangeEvent e1) { System.out.println(e1); } }; addCellEditorListener(lis); removeCellEditorListener(lis); }
From source file:Main.java
public ColorChooserEditor() { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color color = JColorChooser.showDialog(delegate, "Color Chooser", savedColor); ColorChooserEditor.this.changeColor(color); }/*w w w. j a va 2s . c o m*/ }; delegate.addActionListener(actionListener); CellEditorListener lis = new CellEditorListener() { @Override public void editingCanceled(ChangeEvent e0) { System.out.println(e0); } @Override public void editingStopped(ChangeEvent e1) { System.out.println(e1); } }; addCellEditorListener(lis); CellEditorListener[] listeners = getCellEditorListeners(); }
From source file:Main.java
public ColorChooserEditor() { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { Color color = JColorChooser.showDialog(delegate, "Color Chooser", savedColor); ColorChooserEditor.this.changeColor(color); }//from w w w. j av a2s.c om }; delegate.addActionListener(actionListener); CellEditorListener lis = new CellEditorListener() { @Override public void editingCanceled(ChangeEvent e0) { System.out.println(e0); } @Override public void editingStopped(ChangeEvent e1) { System.out.println(e1); } }; addCellEditorListener(lis); CellEditorListener[] listeners = getCellEditorListeners(); }
From source file:components.ColorChooserDemo2.java
public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(ColorChooserDemo2.this, "Choose Background Color", banner.getBackground());/*w w w. j a va 2 s.c o m*/ if (newColor != null) { banner.setBackground(newColor); } }
From source file:hr.restart.util.chart.ChartXYZ2.java
void showOptions() { if (optionsPanel == null) { catSlider = new JSlider(0, 50, iCategoryMargin); catSlider.setPaintLabels(true);//from w w w .j av a 2 s .c o m catSlider.setPaintTicks(true); catSlider.setMajorTickSpacing(10); catSlider.setMinorTickSpacing(5); catSlider.setSnapToTicks(true); colSlider = new JSlider(-80, 20, iColumnMargin); colSlider.setPaintLabels(true); colSlider.setPaintTicks(true); colSlider.setMajorTickSpacing(20); colSlider.setMinorTickSpacing(5); catSlider.setSnapToTicks(true); colFirst = new JLabel(" "); colFirst.setOpaque(true); colFirst.setBackground(cFirst); colSecond = new JLabel(" "); colSecond.setOpaque(true); colSecond.setBackground(cSecond); JButton selFirst = new JButton("..."); selFirst.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Color ret = JColorChooser.showDialog(ChartXYZ2.this, "Boja prvog stupca", cFirst); if (ret != null) colFirst.setBackground(ret); } }); JButton selSecond = new JButton("..."); selSecond.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Color ret = JColorChooser.showDialog(ChartXYZ2.this, "Boja drugog stupca", cSecond); if (ret != null) colSecond.setBackground(ret); } }); optionsPanel = new JPanel(new GridBagLayout()); optionsPanel.setBorder(BorderFactory.createEmptyBorder(15, 20, 15, 20)); GridBagConstraints c = new GridBagConstraints(); c.weightx = 0.1; c.weighty = 1; c.gridx = 0; c.gridy = 0; c.anchor = c.LINE_START; c.insets = new Insets(2, 10, 2, 2); optionsPanel.add(new JLabel("Razmak izmeu grupa"), c); c.gridy = 1; optionsPanel.add(new JLabel("Razmak izmeu stupaca "), c); c.gridy = 2; optionsPanel.add(new JLabel("Boja prvog stupca"), c); c.gridy = 3; optionsPanel.add(new JLabel("Boja drugog stupca"), c); c.weightx = 0.9; c.gridwidth = 2; c.gridx = 1; c.gridy = 0; c.fill = c.HORIZONTAL; optionsPanel.add(catSlider, c); c.gridy = 1; optionsPanel.add(colSlider, c); c.weightx = 0; c.gridwidth = 1; c.gridy = 2; c.fill = c.NONE; optionsPanel.add(colFirst, c); c.gridy = 3; optionsPanel.add(colSecond, c); c.weightx = 0.9; c.gridx = 2; c.gridy = 2; optionsPanel.add(selFirst, c); c.gridy = 3; optionsPanel.add(selSecond, c); } else { catSlider.setValue(iCategoryMargin); colSlider.setValue(iColumnMargin); colFirst.setBackground(cFirst); colSecond.setBackground(cSecond); } raInputDialog dlg = new raInputDialog(); if (dlg.show(this, optionsPanel, "Opcije prikaza")) { iCategoryMargin = catSlider.getValue(); iColumnMargin = colSlider.getValue(); cFirst = colFirst.getBackground(); cSecond = colSecond.getBackground(); selectionChanged(); } }
From source file:cl.almejo.vsim.gui.actions.preferences.ColorPreferences.java
private void addColorChooser(JPanel panel, final String item) { JLabel label = new JLabel(); label.setText(Messages.t("preferences.color.scheme." + item + ".label")); panel.add(label);// ww w . java2s . c o m JButton button = new JButton(Messages.t("default.change.label")); ActionListener actionListener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JButton button = (JButton) e.getSource(); String themeName = ColorScheme.getCurrent().getName(); Color color = JColorChooser.showDialog(button, Messages.t("preferences.color.choose.title"), ColorScheme.getScheme(themeName).get(item)); if (color != null) { ColorScheme.getScheme(themeName).set(item, color); } } }; button.addActionListener(actionListener); panel.add(button); }
From source file:org.cds06.speleograph.graph.GraphEditor.java
/** * Creates a modal dialog by specifying the attached {@link GraphPanel}. * <p>Please look at {@link javax.swing.JDialog#JDialog()} to see defaults params applied to this Dialog.</p> *//*from ww w . j a v a 2s . com*/ public GraphEditor(GraphPanel panel) { super((Frame) SwingUtilities.windowForComponent(panel), true); Validate.notNull(panel); this.graphPanel = panel; KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); mainPanel.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); setContentPane(mainPanel); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); this.setTitle(I18nSupport.translate("menus.graph.graphEditor")); { // This section use FormLayout which is an external layout for Java, consult the doc before edit the // following lines ! final FormLayout layout = new FormLayout( "right:max(40dlu;p), 4dlu, p:grow, 4dlu, p, 4dlu, p:grow, 4dlu, p", //NON-NLS "p,4dlu,p,4dlu,p,4dlu,p,4dlu,p" //NON-NLS ); PanelBuilder builder = new PanelBuilder(layout); final JLabel colorLabel = new JLabel(); final JTextField titleForGraph = new JTextField( graphPanel.getChart().getTitle() != null ? graphPanel.getChart().getTitle().getText() : ""); final JLabel colorXYPlotLabel = new JLabel(); final JLabel colorGridLabel = new JLabel(); final JCheckBox showLegendCheckBox = new JCheckBox("Afficher la lgende", graphPanel.getChart().getLegend().isVisible()); { builder.addLabel("Titre :", "1,1"); builder.add(titleForGraph, "3,1,7,1"); } { builder.addLabel(I18nSupport.translate("menus.graph.graphEditor.backgroundColor"), "1,3"); colorLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); colorLabel.setText(" "); colorLabel.setBackground((Color) graphPanel.getChart().getBackgroundPaint()); colorLabel.setOpaque(true); colorLabel.setEnabled(false); final JButton edit = new JButton(I18nSupport.translate("menus.graph.graphEditor.edit")); edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(GraphEditor.this, I18nSupport.translate("menus.graph.graphEditor.selectColor"), colorLabel.getBackground()); if (c != null) { colorLabel.setBackground(c); } } }); builder.add(colorLabel, "3,3,5,1"); builder.add(edit, "9,3"); } final XYPlot xyPlot = graphPanel.getChart().getXYPlot(); { builder.addLabel(I18nSupport.translate("menus.graph.graphEditor.graphColor"), "1,5"); colorXYPlotLabel.setText(" "); colorXYPlotLabel.setOpaque(true); colorXYPlotLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); colorXYPlotLabel.setBackground((Color) xyPlot.getBackgroundPaint()); colorXYPlotLabel.setEnabled(false); final JButton edit = new JButton(I18nSupport.translate("menus.graph.graphEditor.edit")); edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(GraphEditor.this, I18nSupport.translate("menus.graph.graphEditor.selectColor"), colorXYPlotLabel.getBackground()); if (c != null) { colorXYPlotLabel.setBackground(c); } } }); builder.add(colorXYPlotLabel, "3,5,5,1"); builder.add(edit, "9,5"); } { builder.addLabel(I18nSupport.translate("menus.graph.graphEditor.gridColor"), "1,7"); colorGridLabel.setOpaque(true); colorGridLabel.setText(" "); colorGridLabel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); colorGridLabel.setBackground((Color) xyPlot.getRangeGridlinePaint()); colorGridLabel.setEnabled(false); final JButton edit = new JButton(I18nSupport.translate("menus.graph.graphEditor.edit")); edit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color c = JColorChooser.showDialog(GraphEditor.this, I18nSupport.translate("menus.graph.graphEditor.selectColor"), colorGridLabel.getBackground()); if (c != null) { colorGridLabel.setBackground(c); } } }); builder.add(colorGridLabel, "3,7,5,1"); builder.add(edit, "9,7"); } { builder.add(showLegendCheckBox, "1,9,9,1"); } mainPanel.add(builder.build(), BorderLayout.CENTER); ButtonBarBuilder buttonBarBuilder = new ButtonBarBuilder(); buttonBarBuilder.addGlue(); buttonBarBuilder.addButton(new AbstractAction() { { putValue(NAME, I18nSupport.translate("cancel")); } @Override public void actionPerformed(ActionEvent e) { GraphEditor.this.setVisible(false); } }); buttonBarBuilder.addButton(new AbstractAction() { { putValue(NAME, I18nSupport.translate("ok")); } @Override public void actionPerformed(ActionEvent e) { if (titleForGraph.getText().isEmpty()) graphPanel.getChart().setTitle((String) null); else graphPanel.getChart().setTitle(titleForGraph.getText()); { Color c = colorGridLabel.getBackground(); xyPlot.setRangeGridlinePaint(c); xyPlot.setRangeMinorGridlinePaint(c); xyPlot.setDomainGridlinePaint(c); xyPlot.setDomainMinorGridlinePaint(c); } graphPanel.getChart().setBackgroundPaint(colorLabel.getBackground()); xyPlot.setBackgroundPaint(colorXYPlotLabel.getBackground()); graphPanel.getChart().getLegend().setVisible(showLegendCheckBox.isSelected()); GraphEditor.this.setVisible(false); } }); mainPanel.add(buttonBarBuilder.build(), BorderLayout.SOUTH); } pack(); Dimension d = this.getPreferredSize(); this.setSize(new Dimension(d.width + 20, d.height)); setResizable(false); }
From source file:com.itemanalysis.jmetrik.swing.GraphOptionPanel.java
private void initComponents() { orientationButtonGroup = new ButtonGroup(); colorPanel = new JPanel(); color1Label = new JLabel(); colorLabel2 = new JLabel(); colorButton1 = new JButton(); colorButton2 = new JButton(); colorLabel3 = new JLabel(); colorButton3 = new JButton(); colorLabel4 = new JLabel(); colorButton4 = new JButton(); colorLabel5 = new JLabel(); colorButton5 = new JButton(); colorLabel6 = new JLabel(); colorButton6 = new JButton(); colorLabel7 = new JLabel(); colorButton7 = new JButton(); colorLabel8 = new JLabel(); colorButton8 = new JButton(); colorLabel9 = new JLabel(); colorButton9 = new JButton(); lineStylePanel = new JPanel(); lineLabel1 = new JLabel(); lineStyleComboBox1 = new JComboBox(); lineLabel2 = new JLabel(); lineStyleComboBox2 = new JComboBox(); lineLabel3 = new JLabel(); lineStyleComboBox3 = new JComboBox(); lineLabel4 = new JLabel(); lineStyleComboBox4 = new JComboBox(); lineLabel5 = new JLabel(); lineStyleComboBox5 = new JComboBox(); lineLabel6 = new JLabel(); lineStyleComboBox6 = new JComboBox(); lineLabel7 = new JLabel(); lineStyleComboBox7 = new JComboBox(); lineLabel8 = new JLabel(); lineStyleComboBox8 = new JComboBox(); lineLabel9 = new JLabel(); lineStyleComboBox9 = new JComboBox(); lineWidthLabel = new JLabel(); lineWidthTextField = new JTextField(); displayPanel = new JPanel(); legendPositionComboBox = new JComboBox(); legendCheckbox = new JCheckBox(); markersCheckbox = new JCheckBox(); horizontalRadioButton = new JRadioButton(); verticalRadioButton = new JRadioButton(); sizePanel = new JPanel(); widthLabel = new JLabel(); widthTextField = new JTextField(); heightLabel = new JLabel(); heightTextField = new JTextField(); resetButton = new JButton(); // setBorder(BorderFactory.createTitledBorder("")); colorPanel.setBorder(BorderFactory.createTitledBorder("Color Sequence")); color1Label.setText("Color 1"); colorLabel2.setText("Color 2"); colorButton1.setText("Choose Color"); colorButton1.setMaximumSize(new Dimension(116, 25)); colorButton1.setMinimumSize(new Dimension(116, 25)); colorButton1.setPreferredSize(new Dimension(116, 25)); colorButton1.setBackground(color[0]); colorButton1.addActionListener(new ActionListener() { @Override/* w w w.j a v a2 s. com*/ public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 1", color[0]); if (newColor != null) { colorButton1.setBackground(newColor); color[0] = newColor; } } }); colorButton2.setText("Choose Color"); colorButton2.setMaximumSize(new Dimension(116, 25)); colorButton2.setMinimumSize(new Dimension(116, 25)); colorButton2.setPreferredSize(new Dimension(116, 25)); colorButton2.setBackground(color[1]); colorButton2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 2", color[1]); if (newColor != null) { colorButton2.setBackground(newColor); color[1] = newColor; } } }); colorLabel3.setText("Color 3"); colorButton3.setText("Choose Color"); colorButton3.setMaximumSize(new Dimension(116, 25)); colorButton3.setMinimumSize(new Dimension(116, 25)); colorButton3.setPreferredSize(new Dimension(116, 25)); colorButton3.setBackground(color[2]); colorButton3.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 3", color[2]); if (newColor != null) { colorButton3.setBackground(newColor); color[2] = newColor; } } }); colorLabel4.setText("Color 4"); colorButton4.setText("Choose Color"); colorButton4.setMaximumSize(new Dimension(116, 25)); colorButton4.setMinimumSize(new Dimension(116, 25)); colorButton4.setPreferredSize(new Dimension(116, 25)); colorButton4.setBackground(color[3]); colorButton4.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 4", color[3]); if (newColor != null) { colorButton4.setBackground(newColor); color[3] = newColor; } } }); colorLabel5.setText("Color 5"); colorButton5.setText("Choose Color"); colorButton5.setMaximumSize(new Dimension(116, 25)); colorButton5.setMinimumSize(new Dimension(116, 25)); colorButton5.setPreferredSize(new Dimension(116, 25)); colorButton5.setBackground(color[4]); colorButton5.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 5", color[4]); if (newColor != null) { colorButton5.setBackground(newColor); color[4] = newColor; } } }); colorLabel6.setText("Color 6"); colorButton6.setText("Choose Color"); colorButton6.setMaximumSize(new Dimension(116, 25)); colorButton6.setMinimumSize(new Dimension(116, 25)); colorButton6.setPreferredSize(new Dimension(116, 25)); colorButton6.setBackground(color[5]); colorButton6.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 6", color[5]); if (newColor != null) { colorButton6.setBackground(newColor); color[5] = newColor; } } }); colorLabel7.setText("Color 7"); colorButton7.setText("Choose Color"); colorButton7.setMaximumSize(new Dimension(116, 25)); colorButton7.setMinimumSize(new Dimension(116, 25)); colorButton7.setPreferredSize(new Dimension(116, 25)); colorButton7.setBackground(color[6]); colorButton7.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 7", color[6]); if (newColor != null) { colorButton7.setBackground(newColor); color[6] = newColor; } } }); colorLabel8.setText("Color 8"); colorButton8.setText("Choose Color"); colorButton8.setMaximumSize(new Dimension(116, 25)); colorButton8.setMinimumSize(new Dimension(116, 25)); colorButton8.setPreferredSize(new Dimension(116, 25)); colorButton8.setBackground(color[7]); colorButton8.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 8", color[7]); if (newColor != null) { colorButton8.setBackground(newColor); color[7] = newColor; } } }); colorLabel9.setText("Color 9"); colorButton9.setText("Choose Color"); colorButton9.setMaximumSize(new Dimension(116, 25)); colorButton9.setMinimumSize(new Dimension(116, 25)); colorButton9.setPreferredSize(new Dimension(116, 25)); colorButton9.setBackground(color[8]); colorButton9.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Color newColor = JColorChooser.showDialog(GraphOptionPanel.this, "Color 9", color[8]); if (newColor != null) { colorButton9.setBackground(newColor); color[8] = newColor; } } }); GroupLayout colorPanelLayout = new GroupLayout(colorPanel); colorPanel.setLayout(colorPanelLayout); colorPanelLayout.setHorizontalGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(colorPanelLayout.createSequentialGroup().addContainerGap() .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(color1Label) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton1, GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel2) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel3) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel4) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel5) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton5, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel6) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton6, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel7) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton7, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel8) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton8, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(colorPanelLayout.createSequentialGroup().addComponent(colorLabel9) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(colorButton9, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap())); colorPanelLayout.setVerticalGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(colorPanelLayout.createSequentialGroup().addContainerGap() .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(color1Label).addComponent(colorButton1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel2).addComponent(colorButton2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel3).addComponent(colorButton3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel4).addComponent(colorButton4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel5).addComponent(colorButton5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel6).addComponent(colorButton6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel7).addComponent(colorButton7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel8).addComponent(colorButton8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(colorPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(colorLabel9).addComponent(colorButton9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); lineStylePanel.setBorder(BorderFactory.createTitledBorder("Line Styles")); lineLabel1.setText("Line 1"); lineStyleComboBox1.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox1.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox1.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[0])); lineStyleComboBox1.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox1.setPreferredSize(new Dimension(150, 25)); lineLabel2.setText("Line 2"); lineStyleComboBox2.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox2.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox2.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[1])); lineStyleComboBox2.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox2.setPreferredSize(new Dimension(150, 25)); lineLabel3.setText("Line 3"); lineStyleComboBox3.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox3.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox3.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[2])); lineStyleComboBox3.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox3.setPreferredSize(new Dimension(150, 25)); lineLabel4.setText("Line 4"); lineStyleComboBox4.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox4.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox4.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[3])); lineStyleComboBox4.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox4.setPreferredSize(new Dimension(150, 25)); lineLabel5.setText("Line 5"); lineStyleComboBox5.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox5.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox5.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[4])); lineStyleComboBox5.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox5.setPreferredSize(new Dimension(150, 25)); lineLabel6.setText("Line 6"); lineStyleComboBox6.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox6.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox6.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[5])); lineStyleComboBox6.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox6.setPreferredSize(new Dimension(150, 25)); lineLabel7.setText("Line 7"); lineStyleComboBox7.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox7.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox7.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[6])); lineStyleComboBox7.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox7.setPreferredSize(new Dimension(150, 25)); lineLabel8.setText("Line 8"); lineStyleComboBox8.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox8.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox8.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[7])); lineStyleComboBox8.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox8.setPreferredSize(new Dimension(150, 25)); lineLabel9.setText("Line 9"); lineStyleComboBox9.setModel(new DefaultComboBoxModel(ChartStyle.LINE_STYLE_NAME)); lineStyleComboBox9.setRenderer(new LineStyleComboBoxRenderer()); lineStyleComboBox9.setSelectedItem(ChartStyle.floatStyleToString(selectedLineStyles[8])); lineStyleComboBox9.setMinimumSize(new Dimension(150, 25)); lineStyleComboBox9.setPreferredSize(new Dimension(150, 25)); GroupLayout lineStylePanelLayout = new GroupLayout(lineStylePanel); lineStylePanel.setLayout(lineStylePanelLayout); lineStylePanelLayout.setHorizontalGroup(lineStylePanelLayout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(lineStylePanelLayout.createSequentialGroup().addContainerGap() .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel1) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel2) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel3) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel4) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel5) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel6) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel7) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel8) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(lineStylePanelLayout.createSequentialGroup().addComponent(lineLabel9) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lineStyleComboBox9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); lineStylePanelLayout .setVerticalGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(lineStylePanelLayout.createSequentialGroup().addContainerGap() .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel1).addComponent(lineStyleComboBox1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel2).addComponent(lineStyleComboBox2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel3).addComponent(lineStyleComboBox3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel4).addComponent(lineStyleComboBox4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel5).addComponent(lineStyleComboBox5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel6).addComponent(lineStyleComboBox6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel7).addComponent(lineStyleComboBox7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel8).addComponent(lineStyleComboBox8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(lineStylePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineLabel9).addComponent(lineStyleComboBox9, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); displayPanel.setBorder(BorderFactory.createTitledBorder("Display Options")); legendPositionComboBox .setModel(new DefaultComboBoxModel(new String[] { "Bottom", "Left", "Top", "Right" })); legendPositionComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String s = legendPositionComboBox.getSelectedItem().toString(); if ("Bottom".equals(s)) { prefs.setLegendPosition(RectangleEdge.BOTTOM); } else if ("Left".equals(s)) { prefs.setLegendPosition(RectangleEdge.LEFT); } else if ("Top".equals(s)) { prefs.setLegendPosition(RectangleEdge.TOP); } else { prefs.setLegendPosition(RectangleEdge.RIGHT); } } }); legendCheckbox.setSelected(true); legendCheckbox.setText("Legend"); legendCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (legendCheckbox.isSelected()) { prefs.setShowLegend(true); } else { prefs.setShowLegend(false); } } }); markersCheckbox.setText("Point markers"); markersCheckbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (markersCheckbox.isSelected()) { prefs.setShowMarkers(true); } else { prefs.setShowMarkers(false); } } }); orientationButtonGroup.add(horizontalRadioButton); horizontalRadioButton.setText("Horizontal orientation"); horizontalRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (horizontalRadioButton.isSelected()) { prefs.setChartOrientation(PlotOrientation.HORIZONTAL); } } }); orientationButtonGroup.add(verticalRadioButton); verticalRadioButton.setSelected(true); verticalRadioButton.setText("Vertical orientation"); verticalRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (verticalRadioButton.isSelected()) { prefs.setChartOrientation(PlotOrientation.VERTICAL); } } }); GroupLayout displayPanelLayout = new GroupLayout(displayPanel); displayPanel.setLayout(displayPanelLayout); displayPanelLayout.setHorizontalGroup(displayPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(displayPanelLayout.createSequentialGroup().addContainerGap().addGroup(displayPanelLayout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(displayPanelLayout.createSequentialGroup().addGroup(displayPanelLayout .createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(markersCheckbox) .addGroup(displayPanelLayout.createSequentialGroup().addComponent(legendCheckbox) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(legendPositionComboBox, 0, 89, Short.MAX_VALUE))) .addGap(26, 26, 26)) .addGroup(displayPanelLayout.createSequentialGroup().addComponent(horizontalRadioButton) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(displayPanelLayout.createSequentialGroup().addComponent(verticalRadioButton) .addGap(0, 0, Short.MAX_VALUE))))); displayPanelLayout.setVerticalGroup(displayPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(displayPanelLayout.createSequentialGroup().addContainerGap() .addGroup(displayPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(legendCheckbox).addComponent(legendPositionComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(markersCheckbox) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(horizontalRadioButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(verticalRadioButton) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); sizePanel.setBorder(BorderFactory.createTitledBorder("Chart Size")); widthLabel.setText("Width"); widthTextField.setText("450"); widthTextField.setMaximumSize(new Dimension(100, 25)); widthTextField.setMinimumSize(new Dimension(100, 25)); widthTextField.setPreferredSize(new Dimension(100, 25)); widthTextField.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { //do nothing } @Override public void focusLost(FocusEvent e) { String s = widthTextField.getText(); try { int w = Integer.parseInt(s); prefs.setChartWidth(w); } catch (NumberFormatException ex) { widthTextField.setText("450"); } } }); heightLabel.setText("Height"); heightTextField.setText("400"); heightTextField.setMaximumSize(new Dimension(100, 25)); heightTextField.setMinimumSize(new Dimension(100, 25)); heightTextField.setPreferredSize(new Dimension(100, 25)); heightTextField.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { //do nothing } @Override public void focusLost(FocusEvent e) { try { String s = heightTextField.getText(); int h = Integer.parseInt(s); prefs.setChartHeight(h); } catch (NumberFormatException ex) { heightTextField.setText("400"); } } }); lineWidthLabel.setText("Line width"); lineWidthTextField.setText("1.0"); lineWidthTextField.setMaximumSize(new Dimension(100, 25)); lineWidthTextField.setMinimumSize(new Dimension(100, 25)); lineWidthTextField.setPreferredSize(new Dimension(100, 25)); lineWidthTextField.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { //do nothing } @Override public void focusLost(FocusEvent e) { try { String s = lineWidthTextField.getText(); float lw = Float.parseFloat(s); prefs.setChartLineWidth(lw); } catch (NumberFormatException ex) { lineWidthTextField.setText("1.0"); } } }); GroupLayout sizePanelLayout = new GroupLayout(sizePanel); sizePanel.setLayout(sizePanelLayout); sizePanelLayout.setHorizontalGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(sizePanelLayout.createSequentialGroup().addContainerGap() .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(widthLabel).addComponent(heightLabel).addComponent(lineWidthLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(widthTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(heightTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lineWidthTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); sizePanelLayout.setVerticalGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(sizePanelLayout.createSequentialGroup().addContainerGap() .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(widthLabel).addComponent(widthTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(heightLabel).addComponent(heightTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(sizePanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lineWidthLabel).addComponent(lineWidthTextField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); resetButton.setText("Reset to Default Chart Options"); resetButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { resetPanel(); } }); GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent(displayPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(colorPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(lineStylePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(sizePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(resetButton)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(colorPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lineStylePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(sizePanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(displayPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(resetButton) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); }