List of usage examples for javax.swing GroupLayout GroupLayout
public GroupLayout(Container host)
From source file:gtu._work.ui.TextScanUI.java
private void initGUI() { try {/* ww w . ja v a 2 s . co m*/ BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent evt) { thisComponentResized(evt); } }); this.addWindowStateListener(new WindowStateListener() { public void windowStateChanged(WindowEvent evt) { System.out.println("this.windowStateChanged, event=" + evt); // TODO add your code for this.windowStateChanged } }); this.addWindowListener(new WindowAdapter() { public void windowIconified(WindowEvent evt) { System.out.println("this.windowIconified, event=" + evt); // TODO add your code for this.windowIconified } }); this.setTitle(TITLE); { jPanel1 = new JPanel(); getContentPane().add(jPanel1, BorderLayout.NORTH); GroupLayout jPanel1Layout = new GroupLayout((JComponent) jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1.setPreferredSize(new java.awt.Dimension(521, 89)); jPanel1.setBounds(0, 0, 521, 89); { jButton1 = new JButton(); jButton1.setText("File"); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton1ActionPerformed(evt); } }); } { jButton2 = new JButton(); jButton2.setText("Clipboard"); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jButton2ActionPerformed(evt); } }); } { contentFilter = new JTextField(); contentFilter.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent paramDocumentEvent) { jTextField2filterAgain(); } public void removeUpdate(DocumentEvent paramDocumentEvent) { jTextField2filterAgain(); } public void changedUpdate(DocumentEvent paramDocumentEvent) { jTextField2filterAgain(); } }); } { fileFilter = new JTextField(); fileFilter.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent paramDocumentEvent) { jTextField1DocumentListener(paramDocumentEvent); } public void removeUpdate(DocumentEvent paramDocumentEvent) { jTextField1DocumentListener(paramDocumentEvent); } public void changedUpdate(DocumentEvent paramDocumentEvent) { jTextField1DocumentListener(paramDocumentEvent); } }); } { totalLabel = new JLabel(); } { matchLabel = new JLabel(); } { jLabel4 = new JLabel(); jLabel4.setText("Match : "); } { jLabel2 = new JLabel(); jLabel2.setText("Total : "); } { ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "All", "Match" }); contextFilter = new JComboBox(); contextFilter.setModel(jComboBox1Model); contextFilter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { jTextField2filterAgain(); } }); } { ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(new String[] { "Regex", "find" }); fileChk = new JComboBox(); fileChk.setModel(jComboBox1Model); fileChk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { fileChkActionPerformed(evt); } }); } { jScrollPane2 = new JScrollPane(); { ListModel groupListModel = new DefaultComboBoxModel(); groupList = new JList(); jScrollPane2.setViewportView(groupList); groupList.setModel(groupListModel); groupList.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent evt) { groupListKeyPressed(evt); } }); } } jPanel1Layout.setVerticalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(16, 16) .addGroup(jPanel1Layout.createParallelGroup() .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButton1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(fileFilter, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(fileChk, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup().addGroup(jPanel1Layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButton2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(contentFilter, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(contextFilter, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(matchLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE))) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(totalLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 61, GroupLayout.PREFERRED_SIZE))) .addContainerGap(12, 12)); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createSequentialGroup().addContainerGap(12, 12) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(contextFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE) .addComponent(fileChk, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(jLabel4, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(matchLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE) .addComponent(totalLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(contentFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 266, GroupLayout.PREFERRED_SIZE) .addComponent(fileFilter, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 266, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup() .addComponent(jButton1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE) .addComponent(jButton2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 91, GroupLayout.PREFERRED_SIZE)) .addGap(19) .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE) .addContainerGap(16, 16)); } { jScrollPane1 = new JScrollPane(); getContentPane().add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(581, 235)); { ListModel jList1Model = new DefaultComboBoxModel(); matchList = new JList(); jScrollPane1.setViewportView(matchList); // matchList.setPreferredSize(new java.awt.Dimension(575, // 232));// ??? // ?? // XXX // TODO // IMPORT // !!!! matchList.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { jList1MouseClicked(evt); } }); matchList.setModel(jList1Model); } } this.setSize(697, 440); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.cytoscape.dyn.internal.graphMetrics.GraphMetricsPanel.java
public GraphMetricsPanel(org.cytoscape.dyn.internal.CyActivator<T, C> cyActivator, DynNetwork<T> dynamicNetwork) { this.cyactivator = cyActivator; this.dynamicNetwork = dynamicNetwork; attributesTable = new JTable(new MyTableModel(dynamicNetwork.getNodeAttributes())); attributesTable.setPreferredScrollableViewportSize(new Dimension(300, 400)); attributesTable.setFillsViewportHeight(true); attributesTable.setShowGrid(false);//from w w w. ja v a2s . com JScrollPane tablePanel = new JScrollPane(attributesTable); tablePanel.setSize(new Dimension(250, 400)); edgeAttributesTable = new JTable(new MyTableModel(dynamicNetwork.getEdgeAttributes())); edgeAttributesTable.setPreferredScrollableViewportSize(new Dimension(300, 400)); edgeAttributesTable.setFillsViewportHeight(true); edgeAttributesTable.setShowGrid(false); JScrollPane edgeTablePanel = new JScrollPane(edgeAttributesTable); edgeTablePanel.setSize(new Dimension(250, 400)); plotChartButton = new JButton("Plot Selected Attributes"); closeTab = new JButton("Close Tab"); plotChartButton.addActionListener(this); closeTab.addActionListener(this); buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(plotChartButton); buttonPanel.add(closeTab); buttonPanel.setBorder(BorderFactory.createTitledBorder(null, "Options", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray)); tablePanel.setBorder( BorderFactory.createTitledBorder(null, "Node Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray)); edgeTablePanel.setBorder( BorderFactory.createTitledBorder(null, "Edge Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("SansSerif", 0, 12), Color.darkGray)); GroupLayout cytoLayout = new GroupLayout(this); this.setLayout(cytoLayout); this.add(tablePanel); this.add(buttonPanel); cytoLayout.setHorizontalGroup(cytoLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(tablePanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) .addComponent(edgeTablePanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE) .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)); cytoLayout.setVerticalGroup( cytoLayout.createSequentialGroup().addComponent(tablePanel, 200, GroupLayout.DEFAULT_SIZE, 300) .addComponent(edgeTablePanel, 200, GroupLayout.DEFAULT_SIZE, 300) .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, 280, Short.MAX_VALUE)); this.setVisible(true); }
From source file:com.chenjw.imagegrab.ui.MainFrame.java
public MainFrame() { {//w w w . j a v a 2 s . c o m this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); } GroupLayout configPanelLayout = new GroupLayout((JComponent) configPanel); configPanel.setLayout(configPanelLayout); configPanel.setPreferredSize(new java.awt.Dimension(1035, 726)); { downloadButton = new JButton(); downloadButton.setText(""); downloadButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { executeService.execute(new Runnable() { @Override public void run() { imagegrabService.grab(); } }); } }); downloadButton.registerKeyboardAction(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { executeService.execute(new Runnable() { @Override public void run() { imagegrabService.grab(); } }); } }, KeyStroke.getKeyStroke(KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK), JComponent.WHEN_IN_FOCUSED_WINDOW); } { jLabel1 = new JLabel(); jLabel1.setText("??"); } { resultScrollPane = new JScrollPane(resultPane); { resultPane = new JTextArea(); resultScrollPane.setViewportView(resultPane); } } { sourceComboBox = new JComboBox(); } { maxNumComboBox = new HistoryComboBox("maxNum"); } { jLabel6 = new JLabel(); jLabel6.setText("??"); } { jLabel3 = new JLabel(); jLabel3.setText("??"); } { searchWordComboBox = new HistoryComboBox("searchWord"); } configPanelLayout.setHorizontalGroup(configPanelLayout.createSequentialGroup().addContainerGap() .addGroup(configPanelLayout.createParallelGroup() .addGroup(configPanelLayout.createSequentialGroup() .addComponent(resultScrollPane, GroupLayout.PREFERRED_SIZE, 979, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, configPanelLayout.createSequentialGroup() .addPreferredGap(resultScrollPane, jLabel1, LayoutStyle.ComponentPlacement.INDENT) .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(searchWordComboBox, 0, 213, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE) .addComponent(sourceComboBox, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 64, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(maxNumComboBox, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(downloadButton, GroupLayout.PREFERRED_SIZE, 162, GroupLayout.PREFERRED_SIZE) .addGap(0, 164, GroupLayout.PREFERRED_SIZE))) .addContainerGap()); configPanelLayout.setVerticalGroup(configPanelLayout.createSequentialGroup().addContainerGap() .addGroup(configPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jLabel6, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(searchWordComboBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(sourceComboBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(downloadButton, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(maxNumComboBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 698, GroupLayout.PREFERRED_SIZE) .addComponent(resultScrollPane, GroupLayout.PREFERRED_SIZE, 686, GroupLayout.PREFERRED_SIZE)); // pack(); this.setSize(1010, 768); setVisible(true); this.setTitle("?"); getContentPane().add(configPanel, BorderLayout.CENTER); initSpring(); }
From source file:it.isislab.dmason.util.SystemManagement.Worker.WorkerUpdater.java
private void initGUI() { try {/*from www .ja va 2s .c o m*/ setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jPanelMain = new JPanel(); GroupLayout jPanelMainLayout = new GroupLayout(jPanelMain); jPanelMain.setLayout(jPanelMainLayout); getContentPane().add(jPanelMain, BorderLayout.CENTER); jPanelMain.setPreferredSize(new java.awt.Dimension(503, 190)); { jLabelUpdateProgress = new JLabel(); jLabelUpdateProgress.setText("Update Progress"); } { jProgressBarUpdate = new JProgressBar(); jProgressBarUpdate.setValue(0); } { jLabelTotalWorker = new JLabel(); jLabelTotalWorker.setText("0"); jLabelTotalWorker.setText(Integer.toString(total)); System.out.println("Total: " + total); } { jLabelUpdated = new JLabel(); jLabelUpdated.setText("Updated:"); } { jLabelSeparator = new JLabel(); jLabelSeparator.setText("of"); } { jLabelUpdatedWorker = new JLabel(); jLabelUpdatedWorker.setText("" + workerUpdated); } { jButtonUpdateWorker = new JButton(); jButtonUpdateWorker.setText("Update Worker"); jButtonUpdateWorker.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { startUpdate(); } }); } { jButtonChoseUpJar = new JButton(); jButtonChoseUpJar.setIcon(new ImageIcon(getClass().getClassLoader() .getResource("it.isislab.dmason/resource/image/openFolder.png"))); jButtonChoseUpJar.setPreferredSize(new java.awt.Dimension(14, 7)); jButtonChoseUpJar.setSize(16, 16); jButtonChoseUpJar.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { updateFile = showFileChooser(); if (updateFile != null) jTextFieldPathUpJar.setText(updateFile.getAbsolutePath()); } }); } { jTextFieldPathUpJar = new JTextField(); jTextFieldPathUpJar.setText("PathUpdateJar"); } jPanelMainLayout.setHorizontalGroup(jPanelMainLayout.createSequentialGroup() .addGroup(jPanelMainLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup() .addComponent(jTextFieldPathUpJar, GroupLayout.PREFERRED_SIZE, 202, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButtonChoseUpJar, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)) .addGroup(GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup() .addComponent(jButtonUpdateWorker, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE) .addGap(25) .addComponent(jLabelUpdated, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE) .addGap(6))) .addComponent(jLabelUpdatedWorker, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelSeparator, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabelTotalWorker, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE) .addGroup(jPanelMainLayout.createParallelGroup() .addGroup(jPanelMainLayout.createSequentialGroup() .addComponent(jProgressBarUpdate, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup() .addComponent(jLabelUpdateProgress, GroupLayout.PREFERRED_SIZE, 102, GroupLayout.PREFERRED_SIZE) .addGap(0, 46, Short.MAX_VALUE))) .addContainerGap(144, 144)); jPanelMainLayout .setVerticalGroup(jPanelMainLayout.createSequentialGroup().addContainerGap(25, 25) .addGroup(jPanelMainLayout.createParallelGroup() .addComponent(jTextFieldPathUpJar, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jButtonChoseUpJar, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)) .addGap(25) .addGroup(jPanelMainLayout.createParallelGroup().addGroup( GroupLayout.Alignment.LEADING, jPanelMainLayout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(jLabelUpdateProgress, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jProgressBarUpdate, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(0, 6, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanelMainLayout.createSequentialGroup().addGap(13) .addGroup(jPanelMainLayout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(jButtonUpdateWorker, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelUpdatedWorker, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent( jLabelSeparator, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent( jLabelTotalWorker, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(jLabelUpdated, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)))) .addContainerGap(249, 249)); } pack(); this.setSize(508, 218); } catch (Exception e) { //add your error handling code here e.printStackTrace(); } }
From source file:au.org.ala.delta.editor.ui.ImageDetailsPanel.java
private void createUI() { JPanel panel = new JPanel(); JPanel buttonPanel = new JPanel(); JPanel panel_2 = new JPanel(); GroupLayout groupLayout = new GroupLayout(this); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addComponent(panel, GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 265, Short.MAX_VALUE) .addContainerGap())); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(panel, GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE) .addComponent(buttonPanel, 0, 0, Short.MAX_VALUE) .addComponent(panel_2, 0, 0, Short.MAX_VALUE)) .addContainerGap())); btnSettings = new JButton(); btnDisplay = new JButton(); btnAdd = new JButton(); btnDelete = new JButton(); GroupLayout gl_buttonPanel = new GroupLayout(buttonPanel); gl_buttonPanel.setHorizontalGroup(gl_buttonPanel.createParallelGroup(Alignment.TRAILING).addGroup( Alignment.LEADING,//from www. j ava2s .c om gl_buttonPanel.createSequentialGroup().addContainerGap().addGroup(gl_buttonPanel .createParallelGroup(Alignment.LEADING) .addComponent(btnSettings, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnDisplay, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE) .addComponent(btnAdd, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE) .addComponent(btnDelete, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)) .addContainerGap())); gl_buttonPanel.setVerticalGroup(gl_buttonPanel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_buttonPanel.createSequentialGroup().addContainerGap(119, Short.MAX_VALUE) .addComponent(btnSettings).addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnDisplay).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnAdd) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDelete).addContainerGap())); buttonPanel.setLayout(gl_buttonPanel); JLabel lblSubjectText = new JLabel(); lblSubjectText.setName("imageDetailsSubjectLabel"); JScrollPane scrollPane_1 = new JScrollPane(); JLabel lblDevelopersNotes = new JLabel(); lblDevelopersNotes.setName("imageDetailsDevelopersNotesLabel"); JScrollPane scrollPane_2 = new JScrollPane(); JPanel panel_3 = new JPanel(); String title = _resources.getString("imageDetailsSoundTitle"); panel_3.setBorder(new TitledBorder(null, title, TitledBorder.LEADING, TitledBorder.TOP, null, null)); GroupLayout gl_panel_2 = new GroupLayout(panel_2); gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_2.createSequentialGroup().addContainerGap() .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING) .addComponent(scrollPane_2, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE) .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE) .addComponent(lblDevelopersNotes) .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE) .addComponent(lblSubjectText)) .addContainerGap())); gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_2.createSequentialGroup().addContainerGap().addComponent(lblSubjectText) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblDevelopersNotes) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(scrollPane_2, GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE) .addContainerGap())); developerNotesTextPane = new RtfEditorPane(); scrollPane_2.setViewportView(developerNotesTextPane); subjectTextPane = new RtfEditorPane(); scrollPane_1.setViewportView(subjectTextPane); soundComboBox = new JComboBox(); soundComboBox.setRenderer(new DefaultListCellRenderer() { private static final long serialVersionUID = 1L; @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { String text = ""; ImageOverlay overlay = (ImageOverlay) value; if (overlay != null) { text = overlay.overlayText; } super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus); return this; } }); deleteSoundButton = new JButton(); playSoundButton = new JButton(); insertSoundButton = new JButton(); GroupLayout gl_panel_3 = new GroupLayout(panel_3); gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_3.createSequentialGroup().addComponent(soundComboBox, 0, 0, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED).addComponent(deleteSoundButton) .addPreferredGap(ComponentPlacement.RELATED).addComponent(playSoundButton) .addPreferredGap(ComponentPlacement.RELATED).addComponent(insertSoundButton) .addContainerGap())); gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_3.createSequentialGroup().addContainerGap(5, Short.MAX_VALUE) .addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE) .addComponent(soundComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(deleteSoundButton).addComponent(playSoundButton) .addComponent(insertSoundButton)))); panel_3.setLayout(gl_panel_3); panel_2.setLayout(gl_panel_2); JLabel lblImageFiles = new JLabel(); lblImageFiles.setName("imageDetailsImageFilesLabel"); lblImageFiles.setAlignmentY(Component.TOP_ALIGNMENT); JScrollPane scrollPane = new JScrollPane(); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup() .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(lblImageFiles) .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)) .addContainerGap())); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(lblImageFiles) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE) .addContainerGap())); imageList = new ImageList(); scrollPane.setViewportView(imageList); panel.setLayout(gl_panel); setLayout(groupLayout); }
From source file:org.xapagy.ui.tempdyn.GraphEvolution.java
/** * Graphs the evolution of the links of all types (PRED, SUCC, SUMMARY, * CONTEXT etc) between two Vis./* ww w .j av a 2 s . c o m*/ * * @param fromVi * @param toVi * @param tdb * @param agent * @param index * - a list of time points which will be plotted on the x axis */ public static void graphLinksBetweenVis(tdComponent fromVi, tdComponent toVi, tdDataBase tdb, Agent agent, List<Double> index) { String label = "Links between " + fromVi.getIdentifier() + " and " + toVi.getIdentifier(); // create a general purpose xy collection for jfreechart XYSeriesCollection xysc = new XYSeriesCollection(); // add a series for each link type for (String linkName : agent.getLinks().getLinkTypeNames()) { XYSeries linkSeries = new XYSeries(linkName); xysc.addSeries(linkSeries); // now fill in the series with values for (Double time : index) { double dtime = time; double linkValue = tdb.getLinkValue(fromVi.getIdentifier(), toVi.getIdentifier(), linkName, time); linkSeries.add(dtime, linkValue); } } // // ok, now let us create a graph // JPanel panel = new JPanel(); // create a layout GroupLayout layout = new GroupLayout(panel); panel.setLayout(layout); layout.setAutoCreateGaps(true); layout.setAutoCreateContainerGaps(true); SequentialGroup sgv = layout.createSequentialGroup(); layout.setVerticalGroup(sgv); ParallelGroup pgh = layout.createParallelGroup(); layout.setHorizontalGroup(pgh); JFreeChart chart = ChartFactory.createXYLineChart(label, "Time", "Value", xysc, PlotOrientation.VERTICAL, true, false, false); GraphEvolution.setChartProperties(chart, GraphEvolution.lineStylesColorful); ChartPanel cp = new ChartPanel(chart); sgv.addComponent(cp); pgh.addComponent(cp); JFrame frame = new JFrame(); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:de.hsos.ecs.richwps.wpsmonitor.boundary.gui.controls.datasource.WpsDialog.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./*from w w w . j a va 2s. c om*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { JPanel jPanel1 = new JPanel(); closeButton = new JButton(); addToMonitorButton = new JButton(); treeScrollPane = new JScrollPane(); wpsTree = new JTree(); JLabel jLabel1 = new JLabel(); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle("List of WPS-Servers- and Processes"); setIconImage(new ImageIcon(getClass().getResource("/icons/database.png")).getImage()); setMinimumSize(null); setName("wpsDialog"); // NOI18N setResizable(false); jPanel1.setBorder(BorderFactory.createTitledBorder("")); closeButton.setIcon(new ImageIcon(getClass().getResource("/icons/apply.png"))); // NOI18N closeButton.setText("Close"); closeButton.setName("closeButton"); // NOI18N closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { closeButtonActionPerformed(evt); } }); addToMonitorButton.setIcon(new ImageIcon(getClass().getResource("/icons/add.png"))); // NOI18N addToMonitorButton.setText("Add WPS with Processes"); addToMonitorButton.setName("addToMonitorButton"); // NOI18N addToMonitorButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addToMonitorButtonActionPerformed(evt); } }); DefaultMutableTreeNode treeNode1 = new DefaultMutableTreeNode("root"); wpsTree.setModel(new DefaultTreeModel(treeNode1)); wpsTree.setName("wpsTree"); // NOI18N treeScrollPane.setViewportView(wpsTree); jLabel1.setText( "<html><body>Here is a list of all registered data-sources. You can pick up processes and WPS and add your choice to the monitor through the \"Add WPS with Processes\"-Button. If you select only a WPS, all processes of this WPS will also be added. The processes will be saved, but they have no Jobs or a testrequest.</body></html>"); GroupLayout jPanel1Layout = new GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(addToMonitorButton) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton)) .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(treeScrollPane, GroupLayout.PREFERRED_SIZE, 630, GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap())); jPanel1Layout .setVerticalGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(treeScrollPane, GroupLayout.DEFAULT_SIZE, 382, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(addToMonitorButton).addComponent(closeButton)) .addContainerGap())); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); pack(); }
From source file:SuitaDetails.java
private void initGlobal() { suiteoptions = new JPanel(); suiteoptions.setBackground(Color.WHITE); JLabel suite = new JLabel("Suite name: "); tsuite = new JTextField(); ep = new JLabel("Run on SUT:"); combo = new JList(); suitelib = new JButton("Libraries"); panicdetect = new JCheckBox("Panic Detect"); panicdetect.setBackground(Color.WHITE); JScrollPane scroll = new JScrollPane(); scroll.setViewportView(combo);//from ww w .ja v a 2 s.co m GroupLayout layout = new GroupLayout(suiteoptions); suiteoptions.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(panicdetect) .addComponent(suitelib, GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(ep).addComponent(suite)) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(tsuite) .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout .createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(suite) .addComponent(tsuite, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(scroll, GroupLayout.DEFAULT_SIZE, 96, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(panicdetect) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(suitelib)) .addComponent(ep)) .addContainerGap())); tcdelay = new JLabel("TC delay"); savedb = new JCheckBox("DB autosave"); ttcdelay = new JTextField(); JButton globallib = new JButton("Libraries"); savedb.setBackground(Color.WHITE); stoponfail = new JCheckBox("Stop on fail"); stoponfail.setBackground(Color.WHITE); JLabel prescript = new JLabel(); JLabel postscript = new JLabel(); prestoponfail = new JCheckBox("Stop on fail"); prestoponfail.setBackground(Color.WHITE); tprescript = new JTextField(); tpostscript = new JTextField(); browse1 = new JButton("..."); browse2 = new JButton("..."); prescript.setText("Pre execution script:"); postscript.setText("Post execution script:"); globallib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { showLib(); } }); suitelib.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { showSuiteLib(); } }); browse1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, tprescript, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); browse2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Container c; if (RunnerRepository.container != null) c = RunnerRepository.container.getParent(); else c = RunnerRepository.window; try { new MySftpBrowser(RunnerRepository.host, RunnerRepository.user, RunnerRepository.password, tpostscript, c, false); } catch (Exception e) { System.out.println("There was a problem in opening sftp browser!"); e.printStackTrace(); } } }); panicdetect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { parent.setPanicdetect(panicdetect.isSelected()); } }); layout = new GroupLayout(global); global.setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addComponent(stoponfail, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(savedb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(tcdelay) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(ttcdelay, GroupLayout.DEFAULT_SIZE, 160, Short.MAX_VALUE).addGap(12, 12, 12) .addComponent(globallib)) .addGroup(layout.createSequentialGroup().addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(prescript).addGap(20, 20, 20)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(postscript).addGap(18, 18, 18))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(tpostscript).addComponent(tprescript)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(browse1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(prestoponfail)) .addComponent(browse2)))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout .createSequentialGroup().addGap(12, 12, 12) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(stoponfail, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addComponent(savedb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(tcdelay) .addComponent(ttcdelay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(globallib)) .addGap(11, 11, 11) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(prescript) .addComponent(tprescript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(browse1).addComponent(prestoponfail)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(tpostscript, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(browse2).addComponent(postscript)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); layout.linkSize(SwingConstants.VERTICAL, new Component[] { browse1, tprescript }); layout.linkSize(SwingConstants.VERTICAL, new Component[] { browse2, tpostscript }); }
From source file:org.gwaspi.gui.reports.SampleQAHetzygPlotZoom.java
private void initGUI(final JFreeChart zoomChart, final ChartPanel zoomPanel) throws IOException { // setCursor(CursorUtils.WAIT_CURSOR); final JPanel pnl_ChartNavigator = new JPanel(); final JPanel pnl_Chart = new JPanel(); final JScrollPane scrl_Chart = new JScrollPane(); final JPanel pnl_Footer = new JPanel(); final JPanel pnl_FooterGroup1 = new JPanel(); final JPanel pnl_FooterGroup0 = new JPanel(); final JButton btn_Save = new JButton(); final JButton btn_Reset = new JButton(); final JLabel lbl_thresholds = new JLabel(); final JLabel lbl_hetzy = new JLabel(); final JTextField txt_hetzy = new JTextField(); final JButton btn_redraw = new JButton(); final JLabel lbl_missing = new JLabel(); final JTextField txt_missing = new JTextField(); final String titlePlot = Text.Reports.smplHetzyVsMissingRat; pnl_ChartNavigator.setBorder(GWASpiExplorerPanel.createMainTitledBorder(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, 600, Short.MAX_VALUE)); pnl_ChartLayout.setVerticalGroup(pnl_ChartLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(scrl_Chart, GroupLayout.DEFAULT_SIZE, 600, 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/* w w w .j a v a 2 s . c o m*/ .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> lbl_thresholds.setText(Text.Reports.thresholds); lbl_hetzy.setText(Text.Reports.heterozygosity); txt_hetzy.setText(hetzyThreshold.toString()); lbl_missing.setText(Text.Reports.missRatio); txt_missing.setText(missingThreshold.toString()); btn_redraw.setAction(new RedrawAction(txt_hetzy, txt_missing)); final MatrixMetadata rdMatrixMetadata = getMatrixService().getMatrix(operationKey.getParentMatrixKey()); final String originFriendlyName = rdMatrixMetadata.getFriendlyName(); btn_Save.setAction(new SaveAsAction( "SampleQA_hetzyg-missingrat_" + Utils.stripNonAlphaNumeric(originFriendlyName) + ".png", scrl_Chart, zoomChart, this)); btn_Reset.setAction(new ResetAction()); //<editor-fold defaultstate="expanded" desc="FOOTER"> GroupLayout pnl_FooterGroup0Layout = new GroupLayout(pnl_FooterGroup0); pnl_FooterGroup0.setLayout(pnl_FooterGroup0Layout); pnl_FooterGroup0Layout.setHorizontalGroup(pnl_FooterGroup0Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterGroup0Layout.createSequentialGroup().addContainerGap() .addGroup(pnl_FooterGroup0Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterGroup0Layout.createSequentialGroup() .addGroup(pnl_FooterGroup0Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(lbl_hetzy).addComponent(lbl_missing)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnl_FooterGroup0Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(txt_hetzy, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) .addGroup(pnl_FooterGroup0Layout.createSequentialGroup() .addComponent(txt_missing, GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) .addGap(6, 6, 6).addComponent(btn_redraw, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)))) .addComponent(lbl_thresholds)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pnl_FooterGroup0Layout.setVerticalGroup(pnl_FooterGroup0Layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterGroup0Layout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(lbl_thresholds) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnl_FooterGroup0Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_hetzy).addComponent(txt_hetzy, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(pnl_FooterGroup0Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(btn_redraw, GroupLayout.Alignment.TRAILING, 0, 0, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.TRAILING, pnl_FooterGroup0Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_missing).addComponent(txt_missing))))); GroupLayout pnl_FooterGroup1Layout = new GroupLayout(pnl_FooterGroup1); pnl_FooterGroup1.setLayout(pnl_FooterGroup1Layout); pnl_FooterGroup1Layout .setHorizontalGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterGroup1Layout.createSequentialGroup().addContainerGap() .addComponent(btn_Reset, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_Save, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); pnl_FooterGroup1Layout.linkSize(SwingConstants.HORIZONTAL, new Component[] { btn_Reset, btn_Save }); pnl_FooterGroup1Layout .setVerticalGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(pnl_FooterGroup1Layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(btn_Reset).addComponent(btn_Save))); 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(GroupLayout.Alignment.TRAILING, pnl_FooterLayout.createSequentialGroup() .addComponent(pnl_FooterGroup0, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 174, 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(GroupLayout.Alignment.TRAILING, pnl_FooterLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pnl_FooterLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(pnl_FooterGroup0, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(pnl_FooterGroup1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); //</editor-fold> //<editor-fold defaultstate="expanded" desc="LAYOUT"> 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_ChartNavigator, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pnl_Footer, 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.UNRELATED) .addComponent(pnl_Footer, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap())); //</editor-fold> // setCursor(CursorUtils.DEFAULT_CURSOR); }
From source file:misc.DesktopDemo.java
/** Create and show components *//*w ww .j ava2 s . co m*/ private void initComponents() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("DesktopDemo"); txtBrowserURI.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onLaunchBrowser(null); } }); btnLaunchBrowser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onLaunchBrowser(evt); } }); txtMailTo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onLaunchMail(null); } }); btnLaunchEmail.setText("Launch Mail"); btnLaunchEmail.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onLaunchMail(evt); } }); txtFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onLaunchDefaultApplication(null); } }); rbOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onOpenAction(evt); } }); rbEdit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onEditAction(evt); } }); rbPrint.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onPrintAction(evt); } }); btnLaunchApplication.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onLaunchDefaultApplication(evt); } }); btnFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { onChooseFile(evt); } }); Container conFrame = this.getContentPane(); bgAppAction.add(rbOpen); bgAppAction.add(rbEdit); bgAppAction.add(rbPrint); // Components layouting GroupLayout layout = new GroupLayout(conFrame); conFrame.setLayout(layout); layout.setAutoCreateContainerGaps(true); layout.setAutoCreateGaps(true); GroupLayout.SequentialGroup majorHGroup = layout.createSequentialGroup(); // Horizontal group GroupLayout.ParallelGroup lblHGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); lblHGroup.addComponent(lblBrowserUri, GroupLayout.Alignment.TRAILING); lblHGroup.addComponent(lblMailRecipient, GroupLayout.Alignment.TRAILING); lblHGroup.addComponent(lblFile, GroupLayout.Alignment.TRAILING); GroupLayout.ParallelGroup txtFieldsHGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); txtFieldsHGroup.addComponent(txtMailTo); txtFieldsHGroup.addComponent(txtBrowserURI); GroupLayout.SequentialGroup rbHGroup = layout.createSequentialGroup(); rbHGroup.addComponent(rbOpen); rbHGroup.addComponent(rbEdit); rbHGroup.addComponent(rbPrint); txtFieldsHGroup.addGroup(rbHGroup); GroupLayout.SequentialGroup fileHGroup = layout.createSequentialGroup(); fileHGroup.addComponent(txtFile); fileHGroup.addComponent(btnFile); txtFieldsHGroup.addGroup(fileHGroup); GroupLayout.ParallelGroup btnHGroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING); btnHGroup.addComponent(btnLaunchBrowser); btnHGroup.addComponent(btnLaunchEmail); btnHGroup.addComponent(btnLaunchApplication); majorHGroup.addGroup(lblHGroup); majorHGroup.addGroup(txtFieldsHGroup); majorHGroup.addGroup(btnHGroup); layout.setHorizontalGroup(majorHGroup); // Vertical group GroupLayout.SequentialGroup majorVGroup = layout.createSequentialGroup(); GroupLayout.ParallelGroup uriVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); uriVGroup.addComponent(lblBrowserUri); uriVGroup.addComponent(txtBrowserURI); uriVGroup.addComponent(btnLaunchBrowser); GroupLayout.ParallelGroup mailVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); mailVGroup.addComponent(lblMailRecipient); mailVGroup.addComponent(txtMailTo); mailVGroup.addComponent(btnLaunchEmail); GroupLayout.ParallelGroup rbVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); rbVGroup.addComponent(rbOpen); rbVGroup.addComponent(rbEdit); rbVGroup.addComponent(rbPrint); GroupLayout.ParallelGroup fileVGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE); fileVGroup.addComponent(lblFile); fileVGroup.addComponent(btnLaunchApplication); fileVGroup.addComponent(txtFile); fileVGroup.addComponent(btnFile); majorVGroup.addGroup(uriVGroup); majorVGroup.addGroup(mailVGroup); majorVGroup.addGroup(rbVGroup); majorVGroup.addGroup(fileVGroup); layout.setVerticalGroup(majorVGroup); pack(); }