List of usage examples for javax.swing GroupLayout GroupLayout
public GroupLayout(Container host)
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 ww . j a v a 2 s. co m 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:org.gwaspi.gui.reports.ManhattanPlotZoom.java
private void initGUI() { setCursor(CursorUtils.WAIT_CURSOR);//from ww w. j a va 2 s. c o m pnl_ChartNavigator = new JPanel(); pnl_Chart = new JPanel(); pnl_SearchDB = new JPanel(); cmb_SearchDB = new JComboBox(); scrl_Chart = new JScrollPane(); pnl_Footer = new JPanel(); pnl_FooterGroup1 = new JPanel(); btn_Save = new JButton(); btn_Reset = new JButton(); btn_Back = new JButton(); btn_Back2 = new JButton(); final String titlePlot; if (origMarkerKey == null) { titlePlot = ": Chr" + currentChr + " - Pos: " + startPhysPos + " to " + (startPhysPos + requestedPosWindow); } else { titlePlot = ": " + origMarkerKey.toString() + " - Chr" + currentChr; } pnl_ChartNavigator .setBorder(GWASpiExplorerPanel.createMainTitledBorder("Manhattan Plot Navigator" + titlePlot)); // NOI18N pnl_Chart.setBorder(GWASpiExplorerPanel.createLineBorder()); scrl_Chart.getViewport().add(zoomPanel); pnl_Chart.add(scrl_Chart, BorderLayout.CENTER); // <editor-fold defaultstate="expanded" desc="LAYOUT1"> GroupLayout pnl_ChartLayout = new GroupLayout(pnl_Chart); pnl_Chart.setLayout(pnl_ChartLayout); pnl_ChartLayout.setHorizontalGroup(pnl_ChartLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(scrl_Chart, GroupLayout.DEFAULT_SIZE, 812, Short.MAX_VALUE)); pnl_ChartLayout.setVerticalGroup(pnl_ChartLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(scrl_Chart, GroupLayout.DEFAULT_SIZE, 437, Short.MAX_VALUE)); GroupLayout pnl_ChartNavigatorLayout = new GroupLayout(pnl_ChartNavigator); pnl_ChartNavigator.setLayout(pnl_ChartNavigatorLayout); pnl_ChartNavigatorLayout.setHorizontalGroup(pnl_ChartNavigatorLayout .createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, pnl_ChartNavigatorLayout .createSequentialGroup().addContainerGap().addComponent(pnl_Chart, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); pnl_ChartNavigatorLayout .setVerticalGroup(pnl_ChartNavigatorLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_ChartNavigatorLayout .createSequentialGroup().addContainerGap().addComponent(pnl_Chart, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); // </editor-fold> String lblChr = "Chr "; Long currPos = 0L; lblChr += currentChr; if (centerPhysPos > 0) { currPos = centerPhysPos; } else { currPos = Math.round((double) MARKERS_NUM_DEFAULT / 2); } //<editor-fold defaultstate="expanded" desc="TRACKER"> // pnl_Tracker.setBorder(GWASpiExplorerPanel.createRegularTitledBorder("Marker N on "+lblChr)); // // // slid_Tracker.setMaximum(max); // slid_Tracker.setValue(currPos); // slid_Tracker.addMouseListener(new event.MouseAdapter() { // public void mouseReleased(event.MouseEvent evt) { // actionSlide(); // } // }); // // GroupLayout pnl_TrackerLayout = new GroupLayout(pnl_Tracker); // pnl_Tracker.setLayout(pnl_TrackerLayout); // pnl_TrackerLayout.setHorizontalGroup( // pnl_TrackerLayout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(GroupLayout.Alignment.TRAILING, pnl_TrackerLayout.createSequentialGroup() // .addGap(18, 18, 18) // .addComponent(slid_Tracker, GroupLayout.DEFAULT_SIZE, 814, Short.MAX_VALUE) // .addContainerGap()) // ); // pnl_TrackerLayout.setVerticalGroup( // pnl_TrackerLayout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(pnl_TrackerLayout.createSequentialGroup() // .addContainerGap() // .addComponent(slid_Tracker, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) // ); //</editor-fold> //<editor-fold defaultstate="expanded" desc="EXTERNAL RESOURCE DBs"> pnl_SearchDB = new JPanel(); pnl_SearchDB.setBorder(GWASpiExplorerPanel.createRegularTitledBorder(Text.Reports.externalResourceDB)); cmb_SearchDB = new JComboBox(); cmb_SearchDB.setModel(new DefaultComboBoxModel(LinksExternalResouces.getLinkNames())); GroupLayout pnl_SearchDBLayout = new GroupLayout(pnl_SearchDB); pnl_SearchDB.setLayout(pnl_SearchDBLayout); pnl_SearchDBLayout.setHorizontalGroup(pnl_SearchDBLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_SearchDBLayout.createSequentialGroup().addContainerGap() .addComponent(cmb_SearchDB, 0, 614, Short.MAX_VALUE).addContainerGap())); pnl_SearchDBLayout.setVerticalGroup(pnl_SearchDBLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_SearchDBLayout .createSequentialGroup().addComponent(cmb_SearchDB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(14, Short.MAX_VALUE))); //</editor-fold> btn_Save.setAction(new SampleQAHetzygPlotZoom.SaveAsAction("zoom_" + origMarkerKey + ".png", scrl_Chart, zoomChart, this)); btn_Reset.setAction(new ResetAction(testOpKey)); btn_Back.setAction(new BackToTableAction()); btn_Back2.setAction(new BackToManhattanPlotAction()); // <editor-fold defaultstate="expanded" desc="FOOTER"> GroupLayout pnl_FooterGroup1Layout = new GroupLayout(pnl_FooterGroup1); pnl_FooterGroup1.setLayout(pnl_FooterGroup1Layout); pnl_FooterGroup1Layout.setHorizontalGroup(pnl_FooterGroup1Layout .createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterGroup1Layout.createSequentialGroup().addContainerGap() .addComponent(btn_Reset, GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(btn_Save, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE) .addContainerGap())); pnl_FooterGroup1Layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { btn_Reset, btn_Save }); pnl_FooterGroup1Layout .setVerticalGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterGroup1Layout.createSequentialGroup() .addGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(btn_Save).addComponent(btn_Reset)) .addContainerGap(16, Short.MAX_VALUE))); pnl_FooterGroup1Layout.linkSize(SwingConstants.VERTICAL, new Component[] { btn_Reset, btn_Save }); GroupLayout pnl_FooterLayout = new GroupLayout(pnl_Footer); pnl_Footer.setLayout(pnl_FooterLayout); pnl_FooterLayout.setHorizontalGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterLayout.createSequentialGroup().addContainerGap().addComponent(btn_Back) .addGap(18, 18, 18).addComponent(btn_Back2) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 368, Short.MAX_VALUE) .addComponent(pnl_FooterGroup1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); pnl_FooterLayout.setVerticalGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterLayout.createSequentialGroup().addContainerGap().addGroup(pnl_FooterLayout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterLayout.createSequentialGroup() .addGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(btn_Back).addComponent(btn_Back2)) .addGap(71, 71, 71)) .addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterLayout.createSequentialGroup() .addComponent(pnl_FooterGroup1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(55, 55, 55))))); // </editor-fold> // <editor-fold defaultstate="expanded" desc="LAYOUT"> // GroupLayout layout = new GroupLayout(this); // this.setLayout(layout); // layout.setHorizontalGroup( // layout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() // .addContainerGap() // .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) // .addComponent(pnl_Tracker, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) // .addComponent(pnl_ChartNavigator, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) // .addComponent(pnl_Footer, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) // .addContainerGap()) // ); // layout.setVerticalGroup( // layout.createParallelGroup(GroupLayout.Alignment.LEADING) // .addGroup(layout.createSequentialGroup() // .addComponent(pnl_ChartNavigator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) // .addComponent(pnl_Tracker, GroupLayout.PREFERRED_SIZE, 86, GroupLayout.PREFERRED_SIZE) // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) // .addComponent(pnl_Footer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) // ); 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) .addComponent(pnl_SearchDB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(pnl_ChartNavigator, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnl_Footer, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pnl_ChartNavigator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pnl_SearchDB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(pnl_Footer, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE) .addContainerGap())); // </editor-fold> setCursor(CursorUtils.DEFAULT_CURSOR); }
From source file:drusy.ui.panels.InternetStatePanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Kvin Renella headerPanel = new JPanel(); label1 = new JLabel(); mainPanel = new JPanel(); ipv4TitleLabel = new JLabel(); ipv4ContentLabel = new JTextField(); connectionStateTitleLabel = new JLabel(); connectionStateContentLabel = new JTextField(); downloadContentLabel = new JTextField(); downloadTitleLabel = new JLabel(); maxUploadTitleLabel = new JLabel(); maxUploadContentLabel = new JTextField(); maxDownloadTitleLabel = new JLabel(); maxDownloadContentLabel = new JTextField(); uploadTitleLabel = new JLabel(); uploadContentLabel = new JTextField(); ipv6ContentLabel = new JTextField(); ipv6TitleLabel = new JLabel(); uptimeContentLabel = new JTextField(); uptimeTitleLabel = new JLabel(); //======== this ======== setMinimumSize(new Dimension(100, 71)); setLayout(new BorderLayout()); //======== headerPanel ======== {/*from ww w .j a v a2 s .co m*/ headerPanel.setLayout(new BorderLayout()); //---- label1 ---- label1.setText("This panel shows you an overview of the internet connection"); label1.setHorizontalAlignment(SwingConstants.CENTER); headerPanel.add(label1, BorderLayout.CENTER); } add(headerPanel, BorderLayout.NORTH); //======== mainPanel ======== { mainPanel.setOpaque(false); mainPanel.setMinimumSize(new Dimension(100, 100)); //---- ipv4TitleLabel ---- ipv4TitleLabel.setText("IP v4 :"); ipv4TitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- ipv4ContentLabel ---- ipv4ContentLabel.setEditable(false); ipv4ContentLabel.setText("192.168.0.1"); ipv4ContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- connectionStateTitleLabel ---- connectionStateTitleLabel.setText("Connection State :"); connectionStateTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- connectionStateContentLabel ---- connectionStateContentLabel.setEditable(false); connectionStateContentLabel.setText("up"); connectionStateContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- downloadContentLabel ---- downloadContentLabel.setEditable(false); downloadContentLabel.setText("- ko/s"); downloadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- downloadTitleLabel ---- downloadTitleLabel.setText("Download Bandwidth :"); downloadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- maxUploadTitleLabel ---- maxUploadTitleLabel.setText("Max Upload Bandwidth :"); maxUploadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- maxUploadContentLabel ---- maxUploadContentLabel.setEditable(false); maxUploadContentLabel.setText("- ko/s"); maxUploadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- maxDownloadTitleLabel ---- maxDownloadTitleLabel.setText("Max Download Bandwidth :"); maxDownloadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- maxDownloadContentLabel ---- maxDownloadContentLabel.setEditable(false); maxDownloadContentLabel.setText("- ko/s"); maxDownloadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- uploadTitleLabel ---- uploadTitleLabel.setText("Upload Bandwidth :"); uploadTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- uploadContentLabel ---- uploadContentLabel.setEditable(false); uploadContentLabel.setText("- ko/s"); uploadContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- ipv6ContentLabel ---- ipv6ContentLabel.setEditable(false); ipv6ContentLabel.setText("::1:"); ipv6ContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- ipv6TitleLabel ---- ipv6TitleLabel.setText("IP v6 :"); ipv6TitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); //---- uptimeContentLabel ---- uptimeContentLabel.setEditable(false); uptimeContentLabel.setText("0 min"); uptimeContentLabel.setHorizontalAlignment(SwingConstants.CENTER); //---- uptimeTitleLabel ---- uptimeTitleLabel.setText("Uptime :"); uptimeTitleLabel.setHorizontalAlignment(SwingConstants.RIGHT); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup(mainPanelLayout.createParallelGroup() .addGroup(mainPanelLayout.createSequentialGroup().addContainerGap() .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(connectionStateTitleLabel).addComponent(downloadTitleLabel) .addComponent(ipv4TitleLabel).addComponent(maxUploadTitleLabel) .addComponent(maxDownloadTitleLabel).addComponent(uploadTitleLabel) .addComponent(ipv6TitleLabel).addComponent(uptimeTitleLabel)) .addGap(10, 10, 10) .addGroup(mainPanelLayout.createParallelGroup() .addComponent(ipv4ContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(connectionStateContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(downloadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(maxUploadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(maxDownloadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(uploadContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(ipv6ContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE) .addComponent(uptimeContentLabel, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)) .addContainerGap())); mainPanelLayout.setVerticalGroup(mainPanelLayout.createParallelGroup() .addGroup(mainPanelLayout.createSequentialGroup().addGap(20, 20, 20) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ipv4TitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(ipv4ContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(ipv6TitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(ipv6ContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(connectionStateTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(connectionStateContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(uploadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(uploadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(maxUploadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(maxUploadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(downloadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(downloadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(maxDownloadTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(maxDownloadContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(uptimeTitleLabel, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(uptimeContentLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); } add(mainPanel, BorderLayout.CENTER); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:at.becast.youploader.gui.FrmMain.java
/** * /*from w w w.java2s .co m*/ */ public void initComponents() { if (Main.debug) LOG.debug("init Components", FrmMain.class); int left = Integer.parseInt(Main.s.get("left", "0")); int top = Integer.parseInt(Main.s.get("top", "0")); int width = Integer.parseInt(Main.s.get("width", DEFAULT_WIDTH)); int height = Integer.parseInt(Main.s.get("height", DEFAULT_HEIGHT)); setBounds(left, top, width, height); TabbedPane = new JTabbedPane(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle(Main.APP_NAME + " " + Main.VERSION); setName("frmMain"); //Main Tab Creation initMainTab(); //Queue Tab creation initQueuetab(); //Playlist Settings Tab creation initPlaylistSettingsTab(); statusBar = new StatusBar(); GroupLayout layout = new GroupLayout(getContentPane()); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING) .addComponent(statusBar, GroupLayout.DEFAULT_SIZE, 884, Short.MAX_VALUE) .addComponent(TabbedPane, GroupLayout.DEFAULT_SIZE, 884, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup() .addComponent(TabbedPane, GroupLayout.PREFERRED_SIZE, 498, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(statusBar, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))); getContentPane().setLayout(layout); cmbCategory.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent arg0) { changeCategory(); } }); QueuePanel.revalidate(); }
From source file:au.org.ala.delta.editor.ui.ActionSetsDialog.java
private void createUI() { setName("actionSetsDialog"); tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, BorderLayout.CENTER); conforTable = new JTable(); tabbedPane.addTab(_resources.getString("directiveTypeConfor.text"), new JScrollPane(conforTable)); intkeyTable = new JTable(); tabbedPane.addTab(_resources.getString("directiveTypeIntkey.text"), new JScrollPane(intkeyTable)); distTable = new JTable(); tabbedPane.addTab(_resources.getString("directiveTypeDist.text"), new JScrollPane(distTable)); keyTable = new JTable(); tabbedPane.addTab(_resources.getString("directiveTypeKey.text"), new JScrollPane(keyTable)); JPanel buttonPanel = new JPanel(); getContentPane().add(buttonPanel, BorderLayout.EAST); runButton = new JButton(); addButton = new JButton(); editButton = new JButton(); deleteButton = new JButton(); doneButton = new JButton(); GroupLayout gl_buttonPanel = new GroupLayout(buttonPanel); gl_buttonPanel.setHorizontalGroup(gl_buttonPanel.createParallelGroup(Alignment.LEADING) .addComponent(runButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(addButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(editButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(deleteButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(doneButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); gl_buttonPanel.setVerticalGroup(gl_buttonPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_buttonPanel.createSequentialGroup().addComponent(runButton).addComponent(addButton) .addComponent(editButton).addComponent(deleteButton).addComponent(doneButton))); buttonPanel.setLayout(gl_buttonPanel); JPanel labelPanel = new JPanel(); FlowLayout flowLayout = (FlowLayout) labelPanel.getLayout(); flowLayout.setHgap(20);/*from w w w. ja v a 2s . c om*/ flowLayout.setAlignment(FlowLayout.LEFT); getContentPane().add(labelPanel, BorderLayout.NORTH); JLabel actionSetLabel = new JLabel(); actionSetLabel.setName("actionSetsActionSetsLabel"); labelPanel.add(actionSetLabel); actionSetDetailsLabel = new JLabel(""); labelPanel.add(actionSetDetailsLabel); }
From source file:it.isislab.dmason.util.SystemManagement.Worker.thrower.DMasonWorkerWithGui.java
private void initComponents() { scrollPane1 = new JScrollPane(); textArea = new JTextArea(); textArea.setEditable(false);//from w w w .j ava 2 s . c o m btnConnect = new JButton(); label1 = new JLabel(); label2 = new JLabel(); cmbPort = new JComboBox(); label3 = new JLabel(); labelnumber = new JLabel(); lblLogo = new JLabel(); cmbIp = new JComboBox(); //======== this ======== setTitle(Release.PRODUCT_RELEASE + " Worker " + VERSION); Container contentPane = getContentPane(); //======== scrollPane1 ======== { scrollPane1.setViewportView(textArea); } //---- btnConnect ---- btnConnect.setText("Connect"); btnConnect.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnConnectOnClick(e); } }); //---- label1 ---- label1.setText("Server IP:"); //---- label2 ---- label2.setText("Server port:"); //---- label3 ---- label3.setText(""); //---- labelnumber ---- labelnumber.setText(""); //---- label4 ---- lblLogo.setText("Distributed Mason 'failed to load image'"); lblLogo.setIcon(new ImageIcon("resources/image/carmineworker.png")); //---- comboBox ---- cmbIp.setEditable(true); cmbPort.setEditable(true); try { Scanner in = new Scanner(new FileInputStream("resources/files/urlworker")); while (in.hasNext()) { String line = in.nextLine(); String[] args = line.split(":"); cmbIp.addItem(args[0]); cmbPort.addItem(args[1]); } } catch (Exception e) { System.out.println("No worker story found!"); } cmbIp.setSelectedIndex(0); cmbPort.setSelectedIndex(0); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup().addContainerGap() .addGroup(contentPaneLayout.createParallelGroup() .addComponent(lblLogo, GroupLayout.PREFERRED_SIZE, 400, GroupLayout.PREFERRED_SIZE) .addGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup().addComponent(label2) .addComponent(label1)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(cmbPort).addComponent(cmbIp, 0, 119, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup() .addGap(78, 78, 78).addComponent(btnConnect)) .addGroup(contentPaneLayout.createSequentialGroup() .addGap(46, 46, 46).addComponent(label3) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(labelnumber, GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE)))) .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addGap(9, 9, 9) .addComponent(scrollPane1, GroupLayout.PREFERRED_SIZE, 366, GroupLayout.PREFERRED_SIZE) .addGap(462, 462, 462)))) .addGap(20, 20, 20))); contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup().addContainerGap(21, Short.MAX_VALUE) .addComponent(lblLogo, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup().addComponent(label1) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(btnConnect).addComponent(cmbIp, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label2).addComponent(cmbPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label3).addComponent(labelnumber))) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(scrollPane1, GroupLayout.PREFERRED_SIZE, 238, GroupLayout.PREFERRED_SIZE) .addGap(16, 16, 16))); setSize(410, 495); setLocationRelativeTo(getOwner()); }
From source file:ecg.ecgshow.ECGShowUI.java
private void createGuardData() { GuardDataPanel = new JPanel(); GuardDataPanel.setBackground(new Color(0, 150, 255)); // GuardDataPanel.setBounds(); // BoxLayout layout=new BoxLayout(GuardDataPanel,BoxLayout.Y_AXIS); // GuardDataPanel.setLayout(layout); GroupLayout layout = new GroupLayout(GuardDataPanel); GuardDataPanel.setLayout(layout);/* w w w .j a va2s . co m*/ JPanel temperatureData = new JPanel(); temperatureData.setLayout(new FlowLayout()); // temperatureData.setLayout(null); // temperatureData.setBounds(0,0,(int) (WIDTH * 0.14), (int) (HEIGHT * 0.15)); temperatureData.setSize((int) (WIDTH * 0.16), (int) (HEIGHT * 0.11)); temperatureData.setBackground(new Color(0, 150, 255)); temperatureLabel = new JLabel("--.- "); temperatureLabel.setFont(loadFont("LED.tff", (float) (HEIGHT * 0.070))); temperatureLabel.setBackground(new Color(0, 150, 255)); temperatureLabel.setForeground(Color.RED); // temperatureLabel.setBounds(0,0,200,100); temperatureLabel.setOpaque(true); JLabel temperatureLabelName = new JLabel(" "); temperatureLabelName.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020))); temperatureLabelName.setBackground(new Color(0, 150, 255)); temperatureLabelName.setForeground(Color.BLACK); temperatureLabelName.setBounds(0, 0, 100, 100); temperatureLabelName.setOpaque(true); //?? temperatureData.add(temperatureLabelName); temperatureData.add(temperatureLabel); // JPanel emptyPanel=new JPanel(); // emptyPanel.setSize((int)(WIDTH*0.14),(int)(HEIGHT*0.2)); // emptyPanel.setBackground(new Color(0,150,255)); // GuardDataPanel.add(emptyPanel); JPanel lightValueData = new JPanel(); lightValueData.setLayout(new BorderLayout()); lightValueData.setBackground(new Color(0, 150, 255)); // lightValueData.setBounds(0,(int)(HEIGHT*0.28),(int)(WIDTH*0.14),(int)(HEIGHT*0.30)); lightValueData.setSize((int) (WIDTH * 0.14), (int) (HEIGHT * 0.22)); lightValueDataSet = new DefaultValueDataset(); DialPlot lightValueDialPlot = new DialPlot(); lightValueDialPlot.setDataset(lightValueDataSet); StandardDialFrame dialFrame = new StandardDialFrame(); dialFrame.setVisible(false); lightValueDialPlot.setDialFrame(dialFrame); GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 170)); DialBackground dialBackground = new DialBackground(gradientpaint); dialBackground.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL)); lightValueDialPlot.setBackground(dialBackground); // ?? DialTextAnnotation dialtextannotation = new DialTextAnnotation(""); dialtextannotation.setFont(new Font("Dialog", 0, (int) (0.016 * HEIGHT))); dialtextannotation.setRadius(0.1D); lightValueDialPlot.addLayer(dialtextannotation); DialValueIndicator dialValueIndicator = new DialValueIndicator(0); dialValueIndicator.setFont(new Font("Dialog", Font.PLAIN, (int) (0.011 * HEIGHT))); dialValueIndicator.setOutlinePaint(Color.darkGray); dialValueIndicator.setRadius(0.4D); dialValueIndicator.setAngle(-90.0); lightValueDialPlot.addLayer(dialValueIndicator); StandardDialScale dialScale = new StandardDialScale(); dialScale.setLowerBound(0D); // dialScale.setUpperBound(1024); // dialScale.setMajorTickIncrement(100); dialScale.setStartAngle(-120D); // 120,? dialScale.setExtent(-300D); // 300,? dialScale.setTickRadius(0.85D); // , dialScale.setTickLabelOffset(0.1D); // ,0 bloodDialRange = new StandardDialRange(500D, 750D, Color.red); bloodDialRange.setInnerRadius(0.52000000000000002D); bloodDialRange.setOuterRadius(0.55000000000000004D); lightValueDialPlot.addLayer(bloodDialRange); // bubbleDialRange = new StandardDialRange(0D, 500D, Color.black); bubbleDialRange.setInnerRadius(0.52000000000000002D); bubbleDialRange.setOuterRadius(0.55000000000000004D); lightValueDialPlot.addLayer(bubbleDialRange); // normalDialRange = new StandardDialRange(750D, 1024D, Color.green); normalDialRange.setInnerRadius(0.52000000000000002D); normalDialRange.setOuterRadius(0.55000000000000004D); lightValueDialPlot.addLayer(normalDialRange); dialScale.setTickLabelFont(new Font("Dialog", 0, (int) (0.011 * HEIGHT))); // lightValueDialPlot.addScale(0, dialScale); DialPointer.Pointer pointer = new DialPointer.Pointer(); lightValueDialPlot.addPointer(pointer); lightValueDialPlot.mapDatasetToScale(0, 0); DialCap dialCap = new DialCap(); dialCap.setRadius(0.07D); JFreeChart lightValueDialChart = new JFreeChart(lightValueDialPlot); lightValueDialChart.setBackgroundPaint(new Color(0, 150, 255)); lightValueDialChart.setTitle("??"); lightValueDialChart.getTitle().setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020))); ChartPanel lightValueDialChartPanel = new ChartPanel(lightValueDialChart, (int) (WIDTH * 0.15), (int) (HEIGHT * 0.27), 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, false, true, false, false); lightValueData.add(lightValueDialChartPanel, BorderLayout.CENTER); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(temperatureData, GroupLayout.Alignment.LEADING) .addComponent(lightValueData, GroupLayout.Alignment.LEADING)))); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05)) .addComponent(temperatureData) .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05)) .addComponent(lightValueData) .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05)))); // JPanel alarmMessage=new JPanel(); // alarmMessage.setBackground(new Color(0,150,255)); // alarmMessLabel=new JLabel(""); // alarmMessLabel.setFont(new Font("SansSerif", 0, (int)(HEIGHT *0.020))); // alarmMessLabel.setBackground(new Color(0,150,255)); // alarmMessage.add(alarmMessLabel); // GuardDataPanel.add(alarmMessage); }
From source file:com.peterbochs.instrument.InstrumentPanel.java
private void initGUI() { try {/*from www .j a v a 2 s . co m*/ { BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(870, 609)); { jTabbedPane1 = new JTabbedPane(); this.add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.setTabPlacement(JTabbedPane.LEFT); jTabbedPane1.setPreferredSize(new java.awt.Dimension(661, 419)); { jMemoryPanel = new JPanel(); GroupLayout jMemoryPanelLayout = new GroupLayout((JComponent) jMemoryPanel); jMemoryPanel.setLayout(jMemoryPanelLayout); jTabbedPane1.addTab("Memory", null, jMemoryPanel, null); jTabbedPane1.addTab("Profiling", null, getJMemoryProfilingPanel(), null); jTabbedPane1.addTab("Jmp", null, getJmpPanel(), null); jTabbedPane1.addTab("Call graph", null, getJTabbedPane3(), null); jTabbedPane1.addTab("Interrupt", null, getJPanel11(), null); jMemoryPanelLayout.setVerticalGroup(jMemoryPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(jMemoryPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJFromComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel4x(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel6(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJToComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel5x(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJBlockSizeComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel3(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJSearchTextField(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJTabbedPane2(), 0, 224, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jMemoryPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJLabel1(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel2(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jMemoryPanelLayout.createParallelGroup() .addComponent(getJHostestAddressScrollPane(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE) .addGroup(GroupLayout.Alignment.LEADING, jMemoryPanelLayout .createSequentialGroup() .addComponent(getJLabel4(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJLabel5(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(74))) .addComponent(getJPanel1(), GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE) .addContainerGap()); jMemoryPanelLayout.linkSize(SwingConstants.VERTICAL, new Component[] { getJSearchTextField(), getJFromComboBox(), getJToComboBox(), getJBlockSizeComboBox() }); jMemoryPanelLayout .setHorizontalGroup(jMemoryPanelLayout.createSequentialGroup().addContainerGap() .addGroup( jMemoryPanelLayout.createParallelGroup().addGroup(jMemoryPanelLayout .createSequentialGroup().addGroup(jMemoryPanelLayout .createParallelGroup().addGroup( GroupLayout.Alignment.LEADING, jMemoryPanelLayout.createSequentialGroup() .addComponent(getJLabel3(), GroupLayout.PREFERRED_SIZE, 70, GroupLayout.PREFERRED_SIZE) .addComponent(getJSearchTextField(), GroupLayout.PREFERRED_SIZE, 151, GroupLayout.PREFERRED_SIZE)) .addGroup(GroupLayout.Alignment.LEADING, jMemoryPanelLayout.createSequentialGroup() .addComponent(getJLabel2(), GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE) .addGap(125)) .addGroup( GroupLayout.Alignment.LEADING, jMemoryPanelLayout .createSequentialGroup() .addComponent( getJPanel1(), GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE) .addGap(39)) .addGroup(jMemoryPanelLayout.createSequentialGroup() .addPreferredGap(getJLabel2(), getJLabel4(), LayoutStyle.ComponentPlacement.INDENT) .addGroup(jMemoryPanelLayout .createParallelGroup() .addComponent(getJLabel4(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE) .addComponent( getJLabel5(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)) .addGap(49))) .addGroup(jMemoryPanelLayout.createParallelGroup() .addComponent(getJHostestAddressScrollPane(), GroupLayout.Alignment.LEADING, 0, 498, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.LEADING, jMemoryPanelLayout.createSequentialGroup() .addGroup(jMemoryPanelLayout .createParallelGroup() .addGroup( GroupLayout.Alignment.LEADING, jMemoryPanelLayout .createSequentialGroup() .addPreferredGap( getJLabel1(), getJLabel4x(), LayoutStyle.ComponentPlacement.INDENT) .addComponent( getJLabel4x(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED) .addComponent( getJFromComboBox(), GroupLayout.PREFERRED_SIZE, 139, GroupLayout.PREFERRED_SIZE)) .addGroup( GroupLayout.Alignment.LEADING, jMemoryPanelLayout .createSequentialGroup() .addComponent( getJLabel1(), GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE) .addGap(80))) .addComponent( getJLabel6(), GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addComponent(getJToComboBox(), GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel5x(), GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addComponent( getJBlockSizeComboBox(), GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addGap(0, 9, Short.MAX_VALUE)))) .addComponent(getJTabbedPane2(), GroupLayout.Alignment.LEADING, 0, 719, Short.MAX_VALUE)) .addContainerGap()); jMemoryPanelLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] { getJFromComboBox(), getJToComboBox() }); } } } } catch (Exception e) { e.printStackTrace(); } // ToolTipManager.sharedInstance().setInitialDelay(0); }
From source file:CGgui.java
public CGgui() { //main window frame f.setResizable(false);/*from w w w.j a va2 s.c om*/ f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add(fCenter, BorderLayout.CENTER); f.getContentPane().add(fEast, BorderLayout.EAST); //menu mnuFile.add(mnuLoad); mnuLoad.add(mnuItemOpenFasta); mnuLoad.add(mnuItemOpenBed); mnuFile.add(mnuSaveData); mnuSaveData.add(mnuItemSavePositions); mnuSaveData.add(mnuItemSaveClusters); //mnuFile.add(mnuItemOpenDataFile); mnuFile.add(mnuSaveCharts); mnuSaveCharts.add(mnuItemSaveChrt); mnuSaveCharts.add(mnuItemSaveMinChrt); mnuSaveCharts.add(mnuItemSaveClusterChrt); mnuSaveCharts.add(mnuItemSaveGrayChrt); mnuSaveCharts.add(mnuItemSaveGrayMinChrt); mnuSaveCharts.add(mnuItemSaveGrayClusterChrt); mnuFile.add(mnuItemClearData); mnuFile.add(mnuItemQuit); mnuEdit.add(mnuItemChartProps); mnuEdit.add(mnuItemMinimaProps); mnuEdit.add(mnuItemClusterProps); mnuEdit.add(mnuItemFindMin); mnuEdit.add(mnuItemSetAxes); mnuEdit.add(mnuItemShowGrid); // mnuHelp.add(mnuItemMan); // mnuHelp.add(mnuItemAbout); mb.add(mnuFile); mb.add(mnuEdit); // mb.add(mnuHelp); f.setJMenuBar(mb); //progressbar jprogressbar.setVisible(false); jprogressbar.setBorderPainted(false); f.getContentPane().add(jprogressbar, BorderLayout.SOUTH); //chart area //histogram ChartArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); chart = ChartFactory.createXYAreaChart("Fragment Length Histogram", "Fragment Length (l)", "Frequency f(l)", histogramdataset, PlotOrientation.VERTICAL, true, true, false); chart.addSubtitle(0, new TextTitle("n = " + CurrCG)); XYPlot xyplot = (XYPlot) chart.getPlot(); xyplot.setForegroundAlpha(0.85F); xyplot.setDomainCrosshairVisible(false); chartpanel = new ChartPanel(chart); ChartArea.add("Fragment Length", chartpanel); //minima minchart = ChartFactory.createXYLineChart("Local Minima", "Fragment Length (l)", "Number of Matches per Fragment", minimadataset, PlotOrientation.VERTICAL, true, true, false); XYPlot minxyplot = (XYPlot) minchart.getPlot(); minxyplot.setForegroundAlpha(0.85F); minchartpanel = new ChartPanel(minchart); ChartArea.add("Minima", minchartpanel); //optimization clusterchart = ChartFactory.createScatterPlot("Average Cluster Size vs. Maximum Fragment Length", "Number (n) of Matches per Fragment", "Number of Overlapping Fragments per Cluster/Max Fragment Length", clusterdataset, PlotOrientation.VERTICAL, true, true, false); XYPlot clusterplot = (XYPlot) clusterchart.getPlot(); clusterplot.setForegroundAlpha(0.85F); clusterchartpanel = new ChartPanel(clusterchart); ChartArea.add("Optimization", clusterchartpanel); //text area SeqText.setLineWrap(true); SeqText.setWrapStyleWord(true); SeqText.setEditable(false); jScrollPane.setBorder(BorderFactory .createCompoundBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Debug"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), jScrollPane.getBorder())); textPanel.add(jScrollPane); //this next line is a hack to fix the ScrollPane size when the chart is scrolled jScrollPane.setPreferredSize(jScrollPane.getPreferredSize()); //auto scroll to added text SeqText.setAutoscrolls(true); jScrollPane.setAutoscrolls(true); //center panel layout GroupLayout centerlayout = new GroupLayout(fCenter); fCenter.setLayout(centerlayout); ////Create a sequential and a parallel groups SequentialGroup h1 = centerlayout.createSequentialGroup(); SequentialGroup v1 = centerlayout.createSequentialGroup(); ////grouping h1.addGroup(centerlayout.createParallelGroup().addComponent(ChartArea).addComponent(textPanel)); centerlayout.setHorizontalGroup(h1); ////more grouping v1.addGroup(centerlayout.createParallelGroup().addComponent(ChartArea)); v1.addGroup(centerlayout.createParallelGroup().addComponent(textPanel)); centerlayout.setVerticalGroup(v1); //CG Panel (search settings panel) CGPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Search Settings"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), CGPanel.getBorder())); //set subpanel1 layout GroupLayout CGsublayout1 = new GroupLayout(CGsubPanel1); CGsubPanel1.setLayout(CGsublayout1); ////Create a sequential and a parallel groups SequentialGroup h4 = CGsublayout1.createSequentialGroup(); SequentialGroup v4 = CGsublayout1.createSequentialGroup(); ////grouping h4.addGroup(CGsublayout1.createParallelGroup().addComponent(searchPatternLabel).addComponent(minCGsLabel) .addComponent(maxCGsLabel).addComponent(CGstepLabel).addComponent(smoothCheckBox) .addComponent(CGApplyButton).addComponent(CGsetCurrLabel)); h4.addGroup(CGsublayout1.createParallelGroup().addComponent(searchPatternText).addComponent(minCGsText) .addComponent(maxCGsText).addComponent(CGstepText).addComponent(smoothText) .addComponent(CGResetButton).addComponent(CGcurrText)); CGsublayout1.setHorizontalGroup(h4); ////more grouping v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(searchPatternLabel).addComponent(searchPatternText)); v4.addContainerGap(5, 5); v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(minCGsLabel) .addComponent(minCGsText)); v4.addContainerGap(5, 5); v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(maxCGsLabel) .addComponent(maxCGsText)); v4.addContainerGap(5, 5); v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(CGstepLabel) .addComponent(CGstepText)); v4.addContainerGap(5, 5); v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(smoothCheckBox) .addComponent(smoothText)); v4.addContainerGap(5, 5); v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(CGApplyButton) .addComponent(CGResetButton)); v4.addContainerGap(15, 15); v4.addGroup(CGsublayout1.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(CGsetCurrLabel) .addComponent(CGcurrText)); CGsublayout1.setVerticalGroup(v4); //set subpanel2 layout GroupLayout CGsublayout2 = new GroupLayout(CGsubPanel2); CGsubPanel2.setLayout(CGsublayout2); ////Create a sequential and a parallel groups SequentialGroup hSettingsSub2 = CGsublayout2.createSequentialGroup(); SequentialGroup vSettingsSub2 = CGsublayout2.createSequentialGroup(); ////horizontal grouping hSettingsSub2.addGroup(CGsublayout2.createParallelGroup().addComponent(CGsetCurrLabel)); hSettingsSub2.addContainerGap(25, 25); hSettingsSub2.addGroup(CGsublayout2.createParallelGroup().addComponent(CGcurrText)); hSettingsSub2.addContainerGap(25, 25); hSettingsSub2.addGroup(CGsublayout2.createParallelGroup().addComponent(CGsetCurrButton)); CGsublayout2.setHorizontalGroup(hSettingsSub2); ////vertical grouping vSettingsSub2.addGroup(CGsublayout2.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(CGsetCurrLabel).addComponent(CGcurrText).addComponent(CGsetCurrButton)); CGsublayout2.setVerticalGroup(vSettingsSub2); //set overall layout (subpanel3) GroupLayout CGsublayout3 = new GroupLayout(CGsubPanel3); CGsubPanel3.setLayout(CGsublayout3); ////Create a sequential and a parallel groups SequentialGroup h5 = CGsublayout3.createSequentialGroup(); SequentialGroup v5 = CGsublayout3.createSequentialGroup(); ////grouping h5.addGroup(CGsublayout3.createParallelGroup().addComponent(caseCheckBox).addComponent(CGsubPanel1) .addComponent(CGsubPanel2)); CGsublayout3.setHorizontalGroup(h5); ////more grouping v5.addGroup(CGsublayout3.createParallelGroup().addComponent(caseCheckBox)); v5.addContainerGap(5, 5); v5.addGroup(CGsublayout3.createParallelGroup().addComponent(CGsubPanel1)); v5.addContainerGap(5, 5); v5.addGroup(CGsublayout3.createParallelGroup().addComponent(CGsubPanel2)); CGsublayout3.setVerticalGroup(v5); //add to resizable container CGPanel.add(CGsubPanel3); //button and slider listeners CGApplyButton.addActionListener(new ListenCGApplyButton()); CGResetButton.addActionListener(new ListenCGResetButton()); CGsetCurrButton.addActionListener(new ListenCGsetCurrButton()); CGcurrText.addActionListener(new ListenCGsetCurrButton()); //minimum area findminPanel.setVisible(true); findminPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Find Minimum"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), findminPanel.getBorder())); GroupLayout minlayout = new GroupLayout(findminPanel); findminPanel.setLayout(minlayout); ////Create a sequential and a parallel groups SequentialGroup h2 = minlayout.createSequentialGroup(); SequentialGroup v2 = minlayout.createSequentialGroup(); ////group find minimum and find all buttons SequentialGroup hFindMinButtons = minlayout.createSequentialGroup(); SequentialGroup vFindMinButtons = minlayout.createSequentialGroup(); hFindMinButtons.addGroup(minlayout.createParallelGroup().addComponent(CalcButton)); hFindMinButtons.addGroup(minlayout.createParallelGroup().addComponent(CalcAllButton)); vFindMinButtons.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(CalcButton).addComponent(CalcAllButton)); ////general grouping h2.addGroup(minlayout.createParallelGroup().addComponent(minLabel).addComponent(maxLabel) .addComponent(ClearButton)); h2.addContainerGap(5, 5); h2.addGroup(minlayout.createParallelGroup().addComponent(minText).addComponent(maxText) .addGroup(hFindMinButtons)); h2.addContainerGap(5, 5); h2.addGroup(minlayout.createParallelGroup().addComponent(minGrabButton).addComponent(maxGrabButton) .addComponent(CancelButton)); minlayout.setHorizontalGroup(h2); ////more grouping v2.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(minLabel) .addComponent(minText).addComponent(minGrabButton)); v2.addContainerGap(5, 5); v2.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(maxLabel) .addComponent(maxText).addComponent(maxGrabButton)); v2.addContainerGap(5, 5); v2.addContainerGap(5, 5); v2.addGroup(minlayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(ClearButton) .addGroup(vFindMinButtons).addComponent(CancelButton)); minlayout.setVerticalGroup(v2); //add button listeners ClearButton.addActionListener(new ListenClearButton()); CalcButton.addActionListener(new ListenCalcButton()); CalcAllButton.addActionListener(new ListenCalcAllButton()); CancelButton.addActionListener(new ListenCancelButton()); minGrabButton.addActionListener(new ListenminGrabButton()); maxGrabButton.addActionListener(new ListenmaxGrabButton()); //axes panel mnuItemSetAxes.setState(false); setaxesPanel.setVisible(false); setaxesPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Set Domain"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), setaxesPanel.getBorder())); GroupLayout setaxeslayout = new GroupLayout(setaxesPanel); setaxesPanel.setLayout(setaxeslayout); ////Create a sequential and a parallel groups SequentialGroup h6 = setaxeslayout.createSequentialGroup(); SequentialGroup v6 = setaxeslayout.createSequentialGroup(); ////grouping h6.addGroup(setaxeslayout.createParallelGroup().addComponent(mindomainLabel).addComponent(maxdomainLabel) .addComponent(SetDomainButton)); h6.addContainerGap(5, 5); h6.addGroup(setaxeslayout.createParallelGroup().addComponent(mindomainText).addComponent(maxdomainText) .addComponent(ResetDomainButton)); setaxeslayout.setHorizontalGroup(h6); ////more grouping v6.addGroup(setaxeslayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(mindomainLabel) .addComponent(mindomainText)); v6.addContainerGap(5, 5); v6.addGroup(setaxeslayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(maxdomainLabel) .addComponent(maxdomainText)); v6.addContainerGap(5, 5); v6.addGroup(setaxeslayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(SetDomainButton) .addComponent(ResetDomainButton)); setaxeslayout.setVerticalGroup(v6); //add button listeners SetDomainButton.addActionListener(new ListenSetDomainButton()); ResetDomainButton.addActionListener(new ListenResetDomainButton()); //east panel layout GroupLayout eastlayout = new GroupLayout(fEast); fEast.setLayout(eastlayout); ////Create a sequential and a parallel groups SequentialGroup h3 = eastlayout.createSequentialGroup(); SequentialGroup v3 = eastlayout.createSequentialGroup(); ////grouping h3.addGroup(eastlayout.createParallelGroup().addComponent(CGPanel).addComponent(findminPanel) .addComponent(setaxesPanel)); eastlayout.setHorizontalGroup(h3); ////more grouping v3.addGroup(eastlayout.createParallelGroup().addComponent(CGPanel)); v3.addGroup(eastlayout.createParallelGroup().addComponent(findminPanel)); v3.addGroup(eastlayout.createParallelGroup().addComponent(setaxesPanel)); eastlayout.setVerticalGroup(v3); //listen for exit signals f.addWindowListener(new ListenCloseWdw()); mnuItemQuit.addActionListener(new ListenMenuQuit()); //listen for exit signals f.addWindowListener(new ListenCloseWdw()); mnuItemClearData.addActionListener(new ListenClearData()); //listen for open signal mnuItemOpenFasta.addActionListener(new ListenMenuOpenFasta()); //listen for open signal mnuItemOpenBed.addActionListener(new ListenMenuOpenBed()); //listen for save position signal mnuItemSavePositions.addActionListener(new ListenMenuSavePositions()); //listen for save cluster signal mnuItemSaveClusters.addActionListener(new ListenMenuSaveClusters()); //listen for save histogram chart signal mnuItemSaveChrt.addActionListener(new ListenMenuSaveChrt()); //listen for save chart signal mnuItemSaveMinChrt.addActionListener(new ListenMenuSaveMinChrt()); //listen for save cluster chart signal mnuItemSaveClusterChrt.addActionListener(new ListenMenuSaveClusterChrt()); //listen for save histogram chart in grayscale signal; mnuItemSaveGrayChrt.addActionListener(new ListenMenuSaveGrayChrt()); //listen for save chart signal mnuItemSaveGrayMinChrt.addActionListener(new ListenMenuSaveGrayMinChrt()); //listen for save cluster chart signal mnuItemSaveGrayClusterChrt.addActionListener(new ListenMenuSaveGrayClusterChrt()); //listen for edit histogram properties signal mnuItemChartProps.addActionListener(new ListenMenuChartProps()); //listen for edit minima chart properties signal mnuItemMinimaProps.addActionListener(new ListenMenuMinimaProps()); //listen for edit optimization chart properties signal mnuItemClusterProps.addActionListener(new ListenMenuClusterProps()); //listen for find minimum signal mnuItemFindMin.addActionListener(new ListenMenuFindMin()); //listen for find minimum signal mnuItemSetAxes.addActionListener(new ListenMenuSetAxes()); //listen for show gridlines mnuItemShowGrid.addActionListener(new ListenMenuShowGrid()); //other menu items //garbage collect //System.gc(); }
From source file:gtu._work.mvn.MavenRepositoryUI.java
private void initGUI() { try {/*from w w w .j a va 2 s . co m*/ { } BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); scanList = new JList(); jTabbedPane1.addTab("repository", null, jPanel1, null); { scanText = new JTextField(); jPanel1.add(scanText, BorderLayout.NORTH); } { jScrollPane1 = new JScrollPane(); jPanel1.add(jScrollPane1, BorderLayout.CENTER); { ListModel scanListModel = new DefaultListModel(); jScrollPane1.setViewportView(scanList); scanList.setModel(scanListModel); scanList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { defaultJListClick(scanList, evt); } }); } } } { jPanel4 = new JPanel(); BorderLayout jPanel4Layout = new BorderLayout(); jPanel4.setLayout(jPanel4Layout); jTabbedPane1.addTab("repository only jar", null, jPanel4, null); jPanel4.setPreferredSize(new java.awt.Dimension(520, 298)); { scanText2 = new JTextField(); jPanel4.add(scanText2, BorderLayout.NORTH); } { jScrollPane3 = new JScrollPane(); jPanel4.add(jScrollPane3, BorderLayout.CENTER); { scanList2 = new JList(); jScrollPane3.setViewportView(scanList2); ListModel scanList2Model = new DefaultListModel(); scanList2.setModel(scanList2Model); scanList2.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { defaultJListClick(scanList2, evt); } }); } } { } } { jPanel2 = new JPanel(); BorderLayout jPanel2Layout = new BorderLayout(); jPanel2.setLayout(jPanel2Layout); jTabbedPane1.addTab("jar find", null, jPanel2, null); { jarFindText = new JTextField(); jPanel2.add(jarFindText, BorderLayout.NORTH); } { jScrollPane2 = new JScrollPane(); jPanel2.add(jScrollPane2, BorderLayout.CENTER); { ListModel jarFindListModel = new DefaultListModel(); jarFindList = new JList(); jScrollPane2.setViewportView(jarFindList); jarFindList.setModel(jarFindListModel); jarFindList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { defaultJListClick(jarFindList, evt); } }); } } { jarFindExecute = new JButton(); jPanel2.add(jarFindExecute, BorderLayout.SOUTH); jarFindExecute.setText("find"); jarFindExecute.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String searchtext = jarFindText.getText(); if (StringUtils.isEmpty(searchtext) || searchtext.length() < 2) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("", "error"); return; } try { DefaultListModel model = new DefaultListModel(); jarFindList.setModel(model); searchtext = searchtext.trim(); searchtext = searchtext.replace('/', '.'); searchtext = searchtext.replace('\\', '.'); if (jarfinder == null) { jarfinder = JarFinder.newInstance(); } else { jarfinder.clear(); } jarfinder.pattern(searchtext); DefaultListModel scanModel = (DefaultListModel) scanList.getModel(); PomFile pomFile = null; for (int ii = 0; ii < scanModel.getSize(); ii++) { pomFile = (PomFile) scanModel.getElementAt(ii); if (pomFile.jarFile == null) { continue; } jarfinder.setDir(pomFile.jarFile); if (!jarfinder.execute().isEmpty()) { model.addElement(pomFile); } jarfinder.getMap().clear(); } } catch (Exception ex) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog(ex.getMessage(), "error"); ex.printStackTrace(); } } }); } } { jPanel5 = new JPanel(); BorderLayout jPanel5Layout = new BorderLayout(); jTabbedPane1.addTab("detail", null, jPanel5, null); jPanel5.setLayout(jPanel5Layout); { jScrollPane4 = new JScrollPane(); jPanel5.add(jScrollPane4, BorderLayout.CENTER); { TableModel scanTableModel = new DefaultTableModel(); scanTable = new JTable(); BorderLayout scanTableLayout = new BorderLayout(); scanTable.setLayout(scanTableLayout); jScrollPane4.setViewportView(scanTable); scanTable.setModel(scanTableModel); JTableUtil.defaultSetting(scanTable); scanTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { tableMouseClicked(scanTable, 0, evt); } }); } } } { jPanel3 = new JPanel(); jTabbedPane1.addTab("config", null, jPanel3, null); GroupLayout jPanel3Layout = new GroupLayout((JComponent) jPanel3); jPanel3.setLayout(jPanel3Layout); { copyToDir = new JButton(); copyToDir.setText("set copy to dir"); copyToDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null || !file.exists() || !file.isDirectory()) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("dir is not correct!, set default desktop", "error"); file = FileUtil.DESKTOP_DIR; } copyTo = file; System.out.println("copyTo: " + copyTo); } }); } { resetM2Dir = new JButton(); resetM2Dir.setText("set .m2 dir"); resetM2Dir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog() .getApproveSelectedFile(); if (file == null || !file.exists() || !file.isDirectory()) { showErrorMsg(); repositoryDir = DEFAULT_REPOSITORY_DIR; reloadRepositoryDir(); return; } File newRepository = new File(file, "repository"); File settings = new File(file, "settings.xml"); if (settings.exists() && settings.isFile() && newRepository.exists() && newRepository.isDirectory()) { repositoryDir = newRepository; reloadRepositoryDir(); } else { showErrorMsg(); } } void showErrorMsg() { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("dir is not correct!, set default .m2 dir", "error"); } }); } { saveCurrentDataBtn = new JButton(); saveCurrentDataBtn.setText("save current data"); saveCurrentDataBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File cfgFile = new File(PropertiesUtil.getJarCurrentPath(MavenRepositoryUI.class), MavenRepositoryUI.class.getSimpleName() + "_" + DateFormatUtil .format(System.currentTimeMillis(), "yyyyMMdd_HHmmss") + ".cfg"); try { ObjectOutputStream writer = new ObjectOutputStream( new FileOutputStream(cfgFile)); writer.writeObject(pomFileList); writer.writeObject(pomFileJarList); writer.writeObject(pomFileMap); writer.flush(); writer.close(); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("save completed!\n" + cfgFile, "SUCCESS"); } catch (Exception ex) { JCommonUtil.handleException(ex); ex.printStackTrace(); } } }); } { loadConfigDataBtn = new JButton(); loadConfigDataBtn.setText("load config data"); loadConfigDataBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File cfgFile = JFileChooserUtil.newInstance().selectFileOnly() .addAcceptFile("cfg", ".cfg").showOpenDialog().getApproveSelectedFile(); if (cfgFile == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!", "ERROR"); return; } try { ObjectInputStream reader = new ObjectInputStream(new FileInputStream(cfgFile)); pomFileList = (Set<PomFile>) reader.readObject(); pomFileJarList = (Set<PomFile>) reader.readObject(); pomFileMap = (Map<DependencyKey, PomFile>) reader.readObject(); reader.close(); resetUIStatus(); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("load completed!\n" + cfgFile, "SUCCESS"); } catch (Exception ex) { JCommonUtil.handleException(ex); ex.printStackTrace(); } } }); } jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup().addContainerGap(24, 24) .addGroup(jPanel3Layout.createParallelGroup() .addGroup(jPanel3Layout.createSequentialGroup().addComponent(loadConfigDataBtn, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(saveCurrentDataBtn, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(copyToDir, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(resetM2Dir, GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup().addComponent(getJButton1(), GroupLayout.PREFERRED_SIZE, 223, GroupLayout.PREFERRED_SIZE))) .addContainerGap(281, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup().addContainerGap(25, 25) .addComponent(copyToDir, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addGap(22) .addComponent(resetM2Dir, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addGap(24) .addComponent(saveCurrentDataBtn, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addGap(25) .addComponent(loadConfigDataBtn, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addGap(28) .addComponent(getJButton1(), GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE) .addContainerGap(34, Short.MAX_VALUE)); } { jPanel6 = new JPanel(); BorderLayout jPanel6Layout = new BorderLayout(); jPanel6.setLayout(jPanel6Layout); jTabbedPane1.addTab("pom dency", null, jPanel6, null); { openPom = new JButton(); jPanel6.add(openPom, BorderLayout.NORTH); openPom.setText("open"); openPom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectFileAndDirectory() .showDialog("?pom,pom").getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("file is not correct!!", "ERROR"); return; } List<File> pomList = new ArrayList<File>(); if (file.isFile() && (file.getName().endsWith(".xml") || file.getName().endsWith(".pom"))) { pomList.add(file); } else { FileUtil.searchFileMatchs(file, "pom.xml", pomList); } Set<PomFile> poms = loadPomList(pomList); resetUIStatus(); Map<DependencyKey, PomFile> map = new HashMap<DependencyKey, PomFile>(); Set<LoadPomListDependency.DependencyKey> errorSet = new HashSet<LoadPomListDependency.DependencyKey>(); for (PomFile p : poms) { openPomFetchDependency(p.pom, map, errorSet); } PomFile pfile = null; DefaultTableModel model = JTableUtil.createModel(true, "groupId", "artifactId", "jar", "pomFile"); for (DependencyKey key : map.keySet()) { pfile = map.get(key); model.addRow(new Object[] { pfile.pom.groupId, pfile.pom.artifactId, (pfile.jarFile == null ? "" : pfile.jarFile.getName()), pfile }); } for (LoadPomListDependency.DependencyKey key : errorSet) { model.addRow(new Object[] { key.groupId, key.artifactId, "ERROR" }); } pomDenpendencyTable.setModel(model); } }); } { jScrollPane5 = new JScrollPane(); jPanel6.add(jScrollPane5, BorderLayout.CENTER); { TableModel pomDenpendencyTableModel = new DefaultTableModel(); pomDenpendencyTable = new JTable(); jScrollPane5.setViewportView(pomDenpendencyTable); pomDenpendencyTable.setModel(pomDenpendencyTableModel); pomDenpendencyTable.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { tableMouseClicked(pomDenpendencyTable, 3, evt); } }); JTableUtil.defaultSetting(pomDenpendencyTable); } } { jPanel7 = new JPanel(); FlowLayout jPanel7Layout = new FlowLayout(); jPanel7Layout.setAlignOnBaseline(true); jPanel6.add(jPanel7, BorderLayout.SOUTH); jPanel7.setLayout(jPanel7Layout); jPanel7.setPreferredSize(new java.awt.Dimension(520, 36)); { clipboardListJar = new JButton(); jPanel7.add(clipboardListJar); clipboardListJar.setText("jar list to clipboard"); clipboardListJar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { List<File> list = fetchPomDependencyTableJarList(); StringBuilder sb = new StringBuilder(); for (File f : list) { sb.append(f + "\n"); } ClipboardUtil.getInstance().setContents(sb); JOptionPaneUtil.newInstance().iconInformationMessage() .showMessageDialog("clipboard set ok!", "SUCCESS"); } }); } { pomOutputJarDir = new JButton(); jPanel7.add(pomOutputJarDir); pomOutputJarDir.setText("set output jar dir"); pomOutputJarDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { File file = JFileChooserUtil.newInstance().selectDirectoryOnly() .showDialog("?Jar").getApproveSelectedFile(); if (file == null) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("dir is not correct!!", "ERROR"); return; } pomOutputJarDir_ = file; } }); } { exportListJar = new JButton(); jPanel7.add(exportListJar); exportListJar.setText("export list jar"); exportListJar.setPreferredSize(new java.awt.Dimension(113, 24)); exportListJar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { List<File> list = fetchPomDependencyTableJarList(); if (pomOutputJarDir_ == null || !pomOutputJarDir_.exists() || !pomOutputJarDir_.isDirectory()) { JOptionPaneUtil.newInstance().iconErrorMessage() .showMessageDialog("output dir is not correct!!", "ERROR"); return; } if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION == JOptionPaneUtil .newInstance().confirmButtonYesNo().iconWaringMessage() .showConfirmDialog("are you sure copy list jar count:(" + list.size() + ") to\n" + pomOutputJarDir_, "WARN")) { StringBuilder sb = new StringBuilder(); StringBuilder fsb = new StringBuilder(); sb.append("total : " + list.size() + "\n"); int ok = 0; int noOk = 0; for (File f : list) { try { FileUtil.copyFile(f, new File(pomOutputJarDir_, f.getName())); ok++; } catch (IOException e) { e.printStackTrace(); noOk++; fsb.append(f + "\n"); } } sb.append("success : " + ok + "\n"); sb.append("failed : " + noOk + "\n"); sb.append("Failed jar :\n"); sb.append(fsb); JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog(sb, "COPY RESULT"); } } }); } } } } this.setSize(541, 365); reloadRepositoryDir(); } catch (Exception e) { e.printStackTrace(); } }