List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox()
From source file:com.emental.mindraider.ui.dialogs.ConnectUriqaServerJDialog.java
/** * Constructor./*from w w w. j a v a 2 s .c o m*/ */ public ConnectUriqaServerJDialog() { super(Messages.getString("ConnectUriqaServerJDialog.title")); getContentPane().setLayout(new BorderLayout()); // north JPanel north = new JPanel(); north.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.serverUrl"))); uriqaServerUrl = new JTextField("http://sw.nokia.com/uriqa/", 31); uriqaServerUrl.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, uriqaServerUrl.getPreferredSize().height)); uriqaServerUrl.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent keyEvent) { if (keyEvent.getKeyCode() == KeyEvent.VK_ENTER) { connect(); } } public void keyReleased(KeyEvent keyEvent) { } public void keyTyped(KeyEvent keyEvent) { } }); north.add(uriqaServerUrl); getContentPane().add(north, BorderLayout.NORTH); // center JPanel center = new JPanel(); center.setLayout(new BorderLayout()); JPanel centerTop = new JPanel(); centerTop.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.resource"))); String[] knowUriqaUris = new String[] { "http://sw.nokia.com/VOC-1/term", "http://sw.nokia.com/MARS-3/Rank", "http://sw.nokia.com/MARS-3", "http://sw.nokia.com/schemas/nokia/MARS-3.1.rdf" }; resourceUri = new JComboBox(knowUriqaUris); resourceUri.setMinimumSize(new Dimension(TEXT_AREAS_WIDTH, resourceUri.getPreferredSize().height)); resourceUri.setEditable(true); centerTop.add(resourceUri); JPanel centerCenter = new JPanel(); centerCenter.setLayout(new FlowLayout(FlowLayout.LEFT)); centerCenter.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.loadOverToolTip")); centerCenter.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.loadOver"))); JCheckBox loadOver = new JCheckBox(); loadOver.setSelected(true); loadOver.setEnabled(false); centerCenter.add(loadOver); JPanel centerBottom = new JPanel(); centerBottom.setLayout(new FlowLayout(FlowLayout.LEFT)); centerBottom.setToolTipText(Messages.getString("ConnectUriqaServerJDialog.addInferedToolTip")); centerBottom.add(new JLabel(Messages.getString("ConnectUriqaServerJDialog.addInfered"))); addInfered = new JCheckBox(); addInfered.setSelected(true); centerBottom.add(addInfered); center.add(centerTop, BorderLayout.NORTH); center.add(centerCenter, BorderLayout.CENTER); center.add(centerBottom, BorderLayout.SOUTH); getContentPane().add(center, BorderLayout.CENTER); // south JPanel south = new JPanel(); JButton uploadButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.connect")); uploadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { connect(); } }); south.add(uploadButton); JButton cancelButton = new JButton(Messages.getString("ConnectUriqaServerJDialog.cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); south.add(cancelButton); getContentPane().add(south, BorderLayout.SOUTH); // show pack(); Gfx.centerAndShowWindow(this); }
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/*from w ww. ja v a 2 s .c om*/ 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))); }
From source file:gtu._work.ui.StringArrayMakerUI.java
private void initGUI() { try {/*from ww w . j ava 2s . co m*/ BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("jPanel1", null, jPanel1, null); { jScrollPane2 = new JScrollPane(); jPanel1.add(jScrollPane2, BorderLayout.CENTER); jScrollPane2.setPreferredSize(new java.awt.Dimension(525, 267)); { ListModel jList1Model = new DefaultListModel(); jList1 = new JList(); jScrollPane2.setViewportView(jList1); jList1.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { JListUtil.newInstance(jList1).defaultJListKeyPressed(evt); } }); jList1.setModel(jList1Model); } } { jButton1 = new JButton(); jPanel1.add(jButton1, BorderLayout.NORTH); jButton1.setText("\u8cbc\u4e0a"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt); } }); } { jPanel3 = new JPanel(); FlowLayout jPanel3Layout = new FlowLayout(); jPanel3Layout.setAlignment(FlowLayout.RIGHT); jPanel1.add(jPanel3, BorderLayout.WEST); jPanel3.setLayout(jPanel3Layout); jPanel3.setPreferredSize(new java.awt.Dimension(50, 291)); { jCheckBox1 = new JCheckBox(); jPanel3.add(jCheckBox1); jCheckBox1.setText("\\n"); } { jCheckBox2 = new JCheckBox(); jPanel3.add(jCheckBox2); jCheckBox2.setText("\\t"); } } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("jPanel2", null, jPanel2, null); { jButton2 = new JButton(); jPanel2.add(jButton2, BorderLayout.NORTH); jButton2.setText("\u7522\u751f"); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton2ActionPerformed(evt); } }); } { jScrollPane1 = new JScrollPane(); jPanel2.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(525, 291)); { jTextArea1 = new JTextArea(); jScrollPane1.setViewportView(jTextArea1); jTextArea1.setText(""); } } } } pack(); this.setSize(546, 382); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } }
From source file:edu.gmu.cs.sim.util.media.chart.TimeSeriesChartGenerator.java
public TimeSeriesChartGenerator() { super();/*from ww w .j ava2s .c o m*/ LabelledList globalAttribList = (LabelledList) (((DisclosurePanel) getGlobalAttribute(-2)) .getDisclosedComponent()); useCullingCheckBox = new JCheckBox(); globalAttribList.add(new JLabel("Cull Data"), useCullingCheckBox); maxPointsPerSeriesTextField = new NumberTextField(1000) { public double newValue(final double val) { int max = (int) val; if (val < 2) { return (int) getValue(); } dataCuller = new MinGapDataCuller(max); return max; } }; useCullingCheckBox.setSelected(true); globalAttribList.add(new JLabel("... Over"), maxPointsPerSeriesTextField); maxPointsPerSeriesTextField.setToolTipText( "The maximum number of data points in a series before data culling gets triggered."); dataCuller = new MinGapDataCuller((int) maxPointsPerSeriesTextField.getValue()); useCullingCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (useCullingCheckBox.isSelected()) { maxPointsPerSeriesTextField.setEnabled(true); int maxPoints = (int) maxPointsPerSeriesTextField.getValue(); dataCuller = new MinGapDataCuller(maxPoints); } else { maxPointsPerSeriesTextField.setEnabled(false); dataCuller = null; } } }); }
From source file:examples.gp.monalisa.gui.GeneticDrawingView.java
/** This method is called from within the constructor to * initialize the form./*w w w . j av a2s . c o m*/ * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { mainPanel = new javax.swing.JPanel(); chooseImage = new javax.swing.JButton(); startEvolution = new javax.swing.JToggleButton(); targetImageLabel = new javax.swing.JLabel(); saveCheckBox = new JCheckBox(); saveCheckBox.setText("Save every fittest result to file"); targetSaveDirLabel = new JLabel("Target directory:"); try { targetSaveDirEdit = new JLabel(FileKit.getCurrentDir()); } catch (IOException ex) { targetSaveDirEdit = new JLabel(); } JFreeChart chart = ChartFactory.createXYLineChart("Fitness versus Generation", "Generation", "Fitness", new XYSeriesCollection(new XYSeries("")), org.jfree.chart.plot.PlotOrientation.VERTICAL, false, false, false); chartPanel = new ChartPanel(chart); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); mainPanel.setName("mainPanel"); // NOI18N javax.swing.ActionMap actionMap = org.jdesktop.application.Application .getInstance(examples.gp.monalisa.gui.GeneticDrawingApp.class).getContext() .getActionMap(GeneticDrawingView.class, this); chooseImage.setAction(actionMap.get("chooseImage")); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application .getInstance(examples.gp.monalisa.gui.GeneticDrawingApp.class).getContext() .getResourceMap(GeneticDrawingView.class); chooseImage.setText(resourceMap.getString("chooseImage.text")); // NOI18N chooseImage.setName("chooseImage"); // NOI18N startEvolution.setAction(actionMap.get("startEvolution")); // NOI18N startEvolution.setText(resourceMap.getString("startEvolution.text")); // NOI18N startEvolution.setName("startEvolution"); // NOI18N targetImageLabel.setIcon(resourceMap.getIcon("targetImageLabel.icon")); // NOI18N targetImageLabel.setText(resourceMap.getString("targetImageLabel.text")); // NOI18N targetImageLabel.setName("targetImageLabel"); // NOI18N chartPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); chartPanel.setName("chartPanel"); // NOI18N org.jdesktop.layout.GroupLayout chartPanelLayout = new org.jdesktop.layout.GroupLayout(chartPanel); chartPanel.setLayout(chartPanelLayout); chartPanelLayout.setHorizontalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 399, Short.MAX_VALUE)); chartPanelLayout.setVerticalGroup(chartPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(0, 234, Short.MAX_VALUE)); org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(mainPanelLayout.createSequentialGroup().add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(chooseImage) .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(startEvolution) .add(38, 38, 38)) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(saveCheckBox).add(140, 140, 140)) .add(mainPanelLayout.createSequentialGroup().add(47, 47, 47).add(targetSaveDirLabel) .add(targetSaveDirEdit).add(47, 47, 47)) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 200, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .add(80, 80, 80))) .add(chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() .addContainerGap() .add(mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) .add(org.jdesktop.layout.GroupLayout.LEADING, chartPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .add(mainPanelLayout.createSequentialGroup().add(saveCheckBox) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(targetSaveDirLabel).add(targetSaveDirEdit) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(targetImageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) .add(mainPanelLayout .createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) .add(startEvolution).add(chooseImage)))) .addContainerGap())); chooseImage.getAccessibleContext() .setAccessibleName(resourceMap.getString("jButton1.AccessibleContext.accessibleName")); // NOI18N menuBar.setName("menuBar"); // NOI18N fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N fileMenu.add(exitMenuItem); menuBar.add(fileMenu); helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); setComponent(mainPanel); setMenuBar(menuBar); }
From source file:gtu._work.etc.EnglishAdd.java
private void initGUI() { try {//from ww w . j av a2 s . com BorderLayout thisLayout = new BorderLayout(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); getContentPane().setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(400, 211)); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent evt) { if (jTabbedPane1.getSelectedIndex() == 2) { // XXX } } }); { jPanel1 = new JPanel(); FlowLayout jPanel1Layout = new FlowLayout(); jPanel1.setLayout(jPanel1Layout); jTabbedPane1.addTab("add", null, jPanel1, null); jPanel1.setPreferredSize(new java.awt.Dimension(387, 233)); { showwordText = new JTextField(); jPanel1.add(showwordText); showwordText.setPreferredSize(new java.awt.Dimension(271, 23)); showwordText.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) { scanWord(); } } }); showwordText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { scanWord(); } }); } { netChkBox = new JCheckBox(); jPanel1.add(netChkBox); netChkBox.setSelected(true); } { jScrollPane2 = new JScrollPane(); jPanel1.add(jScrollPane2); jScrollPane2.setPreferredSize(new java.awt.Dimension(364, 80)); { showChineseArea = new JTextArea(); jScrollPane2.setViewportView(showChineseArea); showChineseArea.setPreferredSize(new java.awt.Dimension(364, 80)); } } { setFileBtn = new JButton(); jPanel1.add(setFileBtn); setFileBtn.setText("set file"); setFileBtn.setPreferredSize(new java.awt.Dimension(261, 30)); setFileBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JCommonUtil._jFileChooser_selectFileOnly(); if (file == null) { JCommonUtil._jOptionPane_showMessageDialog_error("?!"); return; } currentFile = file; StringBuffer sb = new StringBuffer(); try { BufferedReader reader = new BufferedReader( new InputStreamReader(new FileInputStream(currentFile), "BIG5")); for (String line = null; (line = reader.readLine()) != null;) { sb.append(line + "\r\n"); } reader.close(); } catch (IOException e) { e.printStackTrace(); } wordTextArea.setText(sb.toString()); } }); } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); jTabbedPane1.addTab("word", null, jPanel3, null); { jScrollPane1 = new JScrollPane(); jPanel3.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(387, 224)); { wordTextArea = new JTextArea(); jScrollPane1.setViewportView(wordTextArea); } } } } setDefaultSave(); pack(); this.setSize(400, 211); } catch (Exception e) { // add your error handling code here e.printStackTrace(); } }
From source file:edu.gmu.cs.sim.util.media.chart.BarChartGenerator.java
protected void buildGlobalAttributes(LabelledList list) { // create the chart CategoryPlot plot = (CategoryPlot) (chart.getPlot()); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinePaint(new Color(200, 200, 200)); plot.setRangeGridlinePaint(new Color(200, 200, 200)); // define the renderers barRenderer = new BarRenderer(); reviseRenderer(barRenderer);/*from www .j a v a 2 s .c om*/ stackedBarRenderer = new StackedBarRenderer(false); reviseRenderer(stackedBarRenderer); percentageRenderer = new StackedBarRenderer(true); reviseRenderer(percentageRenderer); plot.setRenderer(barRenderer); xLabel = new PropertyField() { public String newValue(String newValue) { setXAxisLabel(newValue); getChartPanel().repaint(); return newValue; } }; xLabel.setValue(getXAxisLabel()); list.add(new JLabel("X Label"), xLabel); yLabel = new PropertyField() { public String newValue(String newValue) { setYAxisLabel(newValue); getChartPanel().repaint(); return newValue; } }; yLabel.setValue(getYAxisLabel()); list.add(new JLabel("Y Label"), yLabel); final JCheckBox gridlines = new JCheckBox(); gridlines.setSelected(false); ItemListener il = new ItemListener() { public void itemStateChanged(ItemEvent e) { hasgridlines = (e.getStateChange() == ItemEvent.SELECTED); updateGridLines(); } }; gridlines.addItemListener(il); list.add(new JLabel("Grid Lines"), gridlines); final JCheckBox labels = new JCheckBox(); labels.setSelected(true); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { getBarRenderer().setBaseItemLabelsVisible(true); getStackedBarRenderer().setBaseItemLabelsVisible(true); getPercentageRenderer().setBaseItemLabelsVisible(true); } else { getBarRenderer().setBaseItemLabelsVisible(false); getStackedBarRenderer().setBaseItemLabelsVisible(false); getPercentageRenderer().setBaseItemLabelsVisible(false); } } }; labels.addItemListener(il); list.add(new JLabel("Labels"), labels); final JComboBox barType = new JComboBox(); barType.setEditable(false); barType.setModel(new DefaultComboBoxModel( new java.util.Vector(Arrays.asList(new String[] { "Separate", "Stacked", "Percentage" })))); barType.setSelectedIndex(0); barType.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CategoryPlot plot = (CategoryPlot) (chart.getPlot()); int type = barType.getSelectedIndex(); if (type == 0) // separate { plot.setRenderer(getBarRenderer()); } else if (type == 1) // stacked { plot.setRenderer(getStackedBarRenderer()); } else // percentage { plot.setRenderer(getPercentageRenderer()); } } }); list.add(new JLabel("Bars"), barType); final JCheckBox horizontal = new JCheckBox(); horizontal.setSelected(false); il = new ItemListener() { public void itemStateChanged(ItemEvent e) { CategoryPlot plot = (CategoryPlot) (chart.getPlot()); if (e.getStateChange() == ItemEvent.SELECTED) { plot.setOrientation(PlotOrientation.HORIZONTAL); ishorizontal = true; } else { plot.setOrientation(PlotOrientation.VERTICAL); ishorizontal = false; } updateGridLines(); } }; horizontal.addItemListener(il); list.add(new JLabel("Horizontal"), horizontal); }
From source file:com.funambol.exchange.admin.DefaultExchangeConnectorConfigPanel.java
/** * Create the panel/* ww w . j a v a 2 s . c om*/ */ private void init() { JLabel title, contactFolderLabel, eventFolderLabel, taskFolderLabel, noteFolderLabel, seccServerLabel, seccPortLabel, exchangeServerLabel; JPanel seccPanel, exchangePanel, sslPanel; title = new JLabel(); exchangePanel = new JPanel(); seccPanel = new JPanel(); sslPanel = new JPanel(); contactFolderValue = new JTextField(); eventFolderValue = new JTextField(); taskFolderValue = new JTextField(); noteFolderValue = new JTextField(); seccServerLabel = new JLabel(); seccServerValue = new JTextField(); seccPortLabel = new JLabel(); seccPortValue = new JTextField(); useSSLValue = new JCheckBox(); useFBAValue = new JCheckBox(); useKeyStoreValue = new JCheckBox(); keyStoreFileNameLabel = new JLabel(); keyStoreFileNameValue = new JTextField(); keyStorePasswordLabel = new JLabel(); keyStorePasswordValue = new JTextField(); exchangeServerLabel = new JLabel(); exchangeServerValue = new JTextField(); exchangeServerNameLabel = new JLabel(); exchangeServerNameValue = new JTextField(); setLayout(null); title.setFont(GuiFactory.titlePanelFont); title.setText("Funambol Exchange Connector"); title.setBounds(new Rectangle(14, 5, 316, 28)); title.setAlignmentX(SwingConstants.CENTER); title.setBorder(new TitledBorder("")); contactFolderLabel = new JLabel(); contactFolderLabel.setText("Contact Folder: "); contactFolderLabel.setBounds(14, 35, 116, 15); add(contactFolderLabel); contactFolderValue.setBounds(150, 35, 220, 19); add(contactFolderValue); eventFolderLabel = new JLabel(); eventFolderLabel.setText("Event Folder: "); eventFolderLabel.setBounds(14, 65, 116, 15); add(eventFolderLabel); eventFolderValue.setBounds(150, 65, 220, 19); add(eventFolderValue); taskFolderLabel = new JLabel(); taskFolderLabel.setText("Task Folder: "); taskFolderLabel.setBounds(14, 95, 116, 15); add(taskFolderLabel); taskFolderValue.setBounds(150, 95, 220, 19); add(taskFolderValue); noteFolderLabel = new JLabel(); noteFolderLabel.setText("Note Folder: "); noteFolderLabel.setBounds(14, 125, 116, 15); add(noteFolderLabel); noteFolderValue.setBounds(150, 125, 220, 19); add(noteFolderValue); seccPanel.setLayout(null); seccPanel.setBorder(new TitledBorder("HTTP Server Configuration")); seccServerLabel.setText("Server:"); seccPanel.add(seccServerLabel); seccServerLabel.setBounds(10, 20, 116, 15); seccPanel.add(seccServerValue); seccServerValue.setBounds(150, 20, 220, 19); seccServerValue.setFont(GuiFactory.defaultFont); seccPortLabel.setText("Port:"); seccPanel.add(seccPortLabel); seccPortLabel.setBounds(10, 50, 131, 15); seccPanel.add(seccPortValue); seccPortValue.setBounds(150, 50, 220, 19); seccPortValue.setFont(GuiFactory.defaultFont); add(seccPanel); seccPanel.setBounds(10, 155, 380, 80); exchangePanel.setLayout(null); exchangePanel.setBorder(new TitledBorder("WebDav Message Configuration")); exchangeServerLabel.setText("Server: "); exchangePanel.add(exchangeServerLabel); exchangeServerLabel.setBounds(10, 20, 150, 19); exchangePanel.add(exchangeServerValue); exchangeServerValue.setBounds(150, 20, 220, 19); exchangeServerValue.setFont(GuiFactory.defaultFont); exchangeServerNameLabel.setText("Name:"); exchangeServerNameLabel.setBounds(10, 50, 150, 19); exchangePanel.add(exchangeServerNameLabel); exchangeServerNameValue.setBounds(150, 50, 220, 19); exchangeServerNameValue.setFont(GuiFactory.defaultFont); exchangePanel.add(exchangeServerNameValue); add(exchangePanel); exchangePanel.setBounds(10, 255, 380, 80); //the ssl option panel sslPanel.setLayout(null); sslPanel.setBorder(new TitledBorder("SSL")); useSSLValue.setText("Use SSL"); useSSLValue.setSelected(false); useSSLValue.setBounds(5, 20, 150, 19); sslPanel.add(useSSLValue); useFBAValue.setText("Use Form-Based Authentication"); useFBAValue.setSelected(true); useFBAValue.setBounds(5, 40, 250, 19); sslPanel.add(useFBAValue); useKeyStoreValue.setText("Use Keystore"); useKeyStoreValue.setSelected(false); useKeyStoreValue.setBounds(5, 60, 200, 19); sslPanel.add(useKeyStoreValue); useKeyStoreValue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent acEvent) { boolean enabled = useKeyStoreValue.isSelected(); keyStoreFileNameLabel.setEnabled(enabled); keyStoreFileNameValue.setEnabled(enabled); keyStorePasswordLabel.setEnabled(enabled); keyStorePasswordValue.setEnabled(enabled); } }); keyStoreFileNameLabel.setText("Key Store File: "); sslPanel.add(keyStoreFileNameLabel); keyStoreFileNameLabel.setEnabled(false); keyStoreFileNameLabel.setBounds(10, 80, 131, 15); sslPanel.add(keyStoreFileNameValue); keyStoreFileNameValue.setEnabled(false); keyStoreFileNameValue.setBounds(150, 80, 220, 19); keyStoreFileNameValue.setFont(GuiFactory.defaultFont); keyStorePasswordLabel.setText("Key Store Password: "); sslPanel.add(keyStorePasswordLabel); keyStorePasswordLabel.setEnabled(false); keyStorePasswordLabel.setBounds(10, 110, 131, 15); sslPanel.add(keyStorePasswordValue); keyStorePasswordValue.setEnabled(false); keyStorePasswordValue.setBounds(150, 110, 220, 19); keyStorePasswordValue.setFont(GuiFactory.defaultFont); add(sslPanel); sslPanel.setBounds(10, 355, 450, 140); confirmButton.setFont(GuiFactory.defaultFont); confirmButton.setText("Save"); add(confirmButton); confirmButton.setBounds(120, 500, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { getValues(); configPanel.saveDefaultConfig(event.getActionCommand()); configPanel.finishedDefaultConfig(); } }); cancelButton.setFont(GuiFactory.defaultFont); cancelButton.setText("Cancel"); add(cancelButton); cancelButton.setBounds(200, 500, 70, 25); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { configPanel.finishedDefaultConfig(); } }); // // Setting font... // Component[] components = getComponents(); for (int i = 0; (components != null) && (i < components.length); ++i) { components[i].setFont(GuiFactory.defaultFont); } // // We add it as the last one so that the font won't be changed // add(title); }
From source file:gdt.jgui.console.JItemPanel.java
/** * Create the item panel.//w w w. j a v a 2 s . c o m * @param console the main console. * @param locator$ the item's locator. * @return the item panel. */ public JItemPanel instantiate(JMainConsole console, String locator$) { try { this.console = console; this.locator$ = locator$; this.removeAll(); Properties locator = Locator.toProperties(locator$); if (Locator.LOCATOR_TRUE.equals(locator.getProperty(Locator.LOCATOR_CHECKABLE))) { checkbox = new JCheckBox(); add(checkbox); if (Locator.LOCATOR_TRUE.equals(locator.getProperty(Locator.LOCATOR_CHECKED))) if (checkbox != null) checkbox.setSelected(true); } title = new JLabel(title$, JLabel.LEFT); //title.setIcon(null); title$ = locator.getProperty(Locator.LOCATOR_TITLE); if (title$ != null) { title.setText(title$); title.setOpaque(true); title.addMouseListener(new MousePopupListener()); title.setAlignmentX(Component.LEFT_ALIGNMENT); add(title, BorderLayout.WEST); icon$ = locator.getProperty(Locator.LOCATOR_ICON); if (icon$ != null) { byte[] ba = Base64.decodeBase64(icon$); ImageIcon icon = new ImageIcon(ba); Image image = icon.getImage().getScaledInstance(24, 24, 0); icon.setImage(image); title.setIcon(icon); } } else LOGGER.info("title is null"); } catch (Exception e) { LOGGER.severe(e.toString()); } return this; }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultTitleEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified title./*from www . ja va 2s . c o m*/ * * @param title * the title, which should be changed. */ public DefaultTitleEditor(Title title) { if (title == null) { this.showTitle = false; this.titleFont = SimulationDiagramTheme.DEFAULT_TITLE_FONT; this.titleField = new JTextField(); this.titlePaint = new PaintSample(Color.BLACK); } else { TextTitle t = (TextTitle) title; this.showTitle = title.isVisible(); this.titleFont = t.getFont(); this.titleField = new JTextField(t.getText()); this.titlePaint = new PaintSample(t.getPaint()); } System.out.println(this.titleFont.getName()); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(4)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Show_Title"))); this.showTitleCheckBox = new JCheckBox(); this.showTitleCheckBox.setSelected(this.showTitle); this.showTitleCheckBox.setActionCommand("ShowTitle"); this.showTitleCheckBox.addActionListener(this); interior.add(new JPanel()); interior.add(this.showTitleCheckBox); JLabel titleLabel = new JLabel(localizationResources.getString("Text")); interior.add(titleLabel); interior.add(this.titleField); interior.add(new JPanel()); JLabel fontLabel = new JLabel(localizationResources.getString("Font")); this.fontfield = new FontDisplayField(this.titleFont); this.selectFontButton = new JButton(localizationResources.getString("Select...")); this.selectFontButton.setActionCommand("SelectFont"); this.selectFontButton.addActionListener(this); interior.add(fontLabel); interior.add(this.fontfield); interior.add(this.selectFontButton); JLabel colorLabel = new JLabel(localizationResources.getString("Color")); this.selectPaintButton = new JButton(localizationResources.getString("Select...")); this.selectPaintButton.setActionCommand("SelectPaint"); this.selectPaintButton.addActionListener(this); interior.add(colorLabel); interior.add(this.titlePaint); interior.add(this.selectPaintButton); this.enableOrDisableControls(); general.add(interior); add(general, BorderLayout.NORTH); }