List of usage examples for javax.swing GroupLayout GroupLayout
public GroupLayout(Container host)
From source file:com.peterbochs.instrument.InstrumentPanel.java
private JPanel getJPanel4() { if (jPanel4 == null) { jPanel4 = new JPanel(); GroupLayout jPanel4Layout = new GroupLayout((JComponent) jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel4Layout.createParallelGroup() .addComponent(getJSegmentStartLabel(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentEndLabel(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentFromLabel(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentToLabel(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 149, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(/* ww w . j a v a 2 s .c om*/ jPanel4Layout.createParallelGroup() .addGroup(jPanel4Layout.createSequentialGroup().addComponent( getJSegmentStartTextField(), GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createSequentialGroup().addComponent( getJSegmentEndTextField(), GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createSequentialGroup().addComponent( getJSegmentFromTextField(), GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createSequentialGroup().addComponent( getJSegmentToTextField(), GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE))) .addContainerGap(324, Short.MAX_VALUE)); jPanel4Layout.setVerticalGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJSegmentStartTextField(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentStartLabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJSegmentEndTextField(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 26, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentEndLabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJSegmentFromTextField(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentFromLabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJSegmentToTextField(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .addComponent(getJSegmentToLabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)) .addContainerGap(21, 21)); } return jPanel4; }
From source file:com.peterbochs.PeterBochsDebugger.java
private JPanel getJRunningPanel() { if (jRunningPanel == null) { jRunningPanel = new JPanel(); GroupLayout jRunningPanelLayout = new GroupLayout((JComponent) jRunningPanel); jRunningPanel.setLayout(jRunningPanelLayout); jRunningPanel.setPreferredSize(new java.awt.Dimension(1073, 758)); jRunningPanelLayout.setHorizontalGroup(jRunningPanelLayout.createSequentialGroup().addContainerGap() .addGroup(jRunningPanelLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, jRunningPanelLayout.createSequentialGroup() .addComponent(getJButton16xxx(), GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(getJLabel1(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJMaxRowComboBox(), GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJClearRunningTextAreaButton(), GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJStepCountLabel(), 0, 749, Short.MAX_VALUE).addGap(48)) .addComponent(getJTextArea1(), GroupLayout.Alignment.LEADING, 0, 1116, Short.MAX_VALUE) .addGroup(GroupLayout.Alignment.LEADING, jRunningPanelLayout.createSequentialGroup() .addGap(65) .addComponent(getJCheckBox1(), GroupLayout.PREFERRED_SIZE, 335, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jRunningPanelLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, jRunningPanelLayout.createSequentialGroup() .addComponent(getJAutoUpdateEvery20LinesCheckBox(), 0, 546, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJSaveToRunDotTxtCheckBox(), GroupLayout.PREFERRED_SIZE, 158, GroupLayout.PREFERRED_SIZE)) .addGroup(GroupLayout.Alignment.LEADING, jRunningPanelLayout .createSequentialGroup() .addPreferredGap(getJAutoUpdateEvery20LinesCheckBox(), getJRunningLabel2(), LayoutStyle.ComponentPlacement.INDENT) .addComponent(getJRunningLabel2(), GroupLayout.PREFERRED_SIZE, 679, GroupLayout.PREFERRED_SIZE) .addGap(0, 25, Short.MAX_VALUE)))))); jRunningPanelLayout.setVerticalGroup(jRunningPanelLayout.createSequentialGroup() .addComponent(getJRunningLabel2(), GroupLayout.PREFERRED_SIZE, 77, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jRunningPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJButton16xxx(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel1(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addComponent(getJMaxRowComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE) .addComponent(getJClearRunningTextAreaButton(), GroupLayout.Alignment.BASELINE, 0, 23, Short.MAX_VALUE) .addComponent(getJStepCountLabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(jRunningPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getJAutoUpdateEvery20LinesCheckBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addComponent(getJSaveToRunDotTxtCheckBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJCheckBox1(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(getJTextArea1(), 0, 610, Short.MAX_VALUE).addContainerGap(17, 17)); }// w w w . jav a 2 s . co m return jRunningPanel; }
From source file:nz.govt.natlib.ndha.manualdeposit.StructMapFileDescManagement.java
private void initComponents() { scrlDescription = new javax.swing.JScrollPane(); lstDescription = new javax.swing.JList(); pnlDetails = new javax.swing.JPanel(); btnMoveUp = new javax.swing.JButton(); btnMoveDown = new javax.swing.JButton(); btnAddNew = new javax.swing.JButton(); btnDelete = new javax.swing.JButton(); btnSave = new javax.swing.JButton(); btnCancel = new javax.swing.JButton(); btnClose = new javax.swing.JButton(); btnGenMainDesc = new javax.swing.JButton(); setTitle("Manage Structure Map File Descriptions"); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt);//from ww w. j av a2s. com } public void windowClosing(java.awt.event.WindowEvent evt) { dialogWindowClosing(evt); } }); scrlDescription.setViewportView(lstDescription); JPanel panelLayer1 = new JPanel(); panelLayer1.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers = new JPanel(); panel_ExtraLayers.setAlignmentY(Component.TOP_ALIGNMENT); panel_ExtraLayers.setMinimumSize(new Dimension(300, 0)); panel_ExtraLayers.setPreferredSize(new Dimension(300, 500)); panel_ExtraLayers.setMaximumSize(new Dimension(300, 500)); panel_ExtraLayers.setVisible(false); JLabel lblDescriptionL2 = new JLabel("Layer 2"); lblDescriptionL2.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_1 = new JLabel("Description"); textfldDescriptionL2 = new JTextField(); textfldDescriptionL2.setName("DescriptionL2"); textfldDescriptionL2.setColumns(10); JLabel lblFilePrefixL2 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL2 = new JTextField(); textfldFilePrefixL2.setName("FilePrefixL2"); textfldFilePrefixL2.setColumns(10); JLabel lblAllowMultiplesL2 = new JLabel("Allow Multiples?"); checkAllowMultiplesL2 = new JCheckBox(""); checkAllowMultiplesL2.setName("AllowMultiplesL2"); JLabel lblDescriptionL3 = new JLabel("Layer 3"); lblDescriptionL3.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_2 = new JLabel("Description"); textfldDescriptionL3 = new JTextField(); textfldDescriptionL3.setName("DescriptionL3"); textfldDescriptionL3.setColumns(10); JLabel lblFilePrefixL3 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL3 = new JTextField(); textfldFilePrefixL3.setName("FilePrefixL3"); textfldFilePrefixL3.setColumns(10); JLabel lblAllowMultiplesL3 = new JLabel("Allow Multiples?"); checkAllowMultiplesL3 = new JCheckBox(""); checkAllowMultiplesL3.setName("AllowMultiplesL3"); JLabel lblDescriptionL4 = new JLabel("Layer 4"); lblDescriptionL4.setFont(new Font("Tahoma", Font.PLAIN, 11)); JLabel lblDescription_3 = new JLabel("Description"); textfldDescriptionL4 = new JTextField(); textfldDescriptionL4.setName("DescriptionL4"); textfldDescriptionL4.setColumns(10); lblFilePrefixL4 = new JLabel("File Prefix/Suffix"); textfldFilePrefixL4 = new JTextField(); textfldFilePrefixL4.setName("FilePrefixL4"); textfldFilePrefixL4.setColumns(10); lblAllowMultiplesL4 = new JLabel("Allow Multiples?"); checkAllowMultiplesL4 = new JCheckBox(""); checkAllowMultiplesL4.setName("AllowMultiplesL4"); GroupLayout gl_panel_ExtraLayers = new GroupLayout(panel_ExtraLayers); gl_panel_ExtraLayers .setHorizontalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblDescriptionL2) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblDescription_1).addGap(44) .addComponent(textfldDescriptionL2, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL2).addGap(18) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL2).addGap(18) .addComponent(checkAllowMultiplesL2)) .addComponent(lblDescriptionL3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(lblDescription_2) .addComponent(lblFilePrefixL3) .addComponent(lblAllowMultiplesL3)) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(21) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE) .addComponent( textfldDescriptionL3, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addGap(18) .addGroup(gl_panel_ExtraLayers .createParallelGroup(Alignment.LEADING) .addComponent(textfldDescriptionL4, GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE) .addGroup(gl_panel_ExtraLayers .createSequentialGroup() .addComponent(checkAllowMultiplesL3) .addPreferredGap( ComponentPlacement.RELATED, 172, Short.MAX_VALUE)))))) .addComponent(lblDescriptionL4).addComponent(lblDescription_3) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblFilePrefixL4).addGap(18) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_ExtraLayers.createSequentialGroup() .addComponent(lblAllowMultiplesL4).addGap(18) .addComponent(checkAllowMultiplesL4))) .addContainerGap())); gl_panel_ExtraLayers.setVerticalGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_ExtraLayers.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionL2).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_1) .addComponent(textfldDescriptionL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL2) .addComponent(textfldFilePrefixL2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL2).addComponent(checkAllowMultiplesL2)) .addGap(18).addComponent(lblDescriptionL3).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_2) .addComponent(textfldDescriptionL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL3) .addComponent(textfldFilePrefixL3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiplesL3).addComponent(checkAllowMultiplesL3)) .addGap(18).addComponent(lblDescriptionL4).addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription_3) .addComponent(textfldDescriptionL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblFilePrefixL4) .addComponent(textfldFilePrefixL4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_ExtraLayers.createParallelGroup(Alignment.BASELINE) .addComponent(lblAllowMultiplesL4).addComponent(checkAllowMultiplesL4)) .addContainerGap(39, Short.MAX_VALUE))); panel_ExtraLayers.setLayout(gl_panel_ExtraLayers); lblDescription = new JLabel(); lblDescription.setText("Description"); textfldDescription = new JTextField(); textfldDescription.setName("Description"); textfldFilePrefix = new JTextField(); textfldFilePrefix.setName("FilePrefix"); lblFilePrefix = new JLabel(); lblFilePrefix.setText("File Prefix/Suffix"); lblPosition = new JLabel(); lblPosition.setText("Position"); cmbPosition = new JComboBox(); cmbPosition.setName("Position"); lblMandatory = new JLabel(); lblMandatory.setText("Mandatory?"); checkMandatory = new JCheckBox(); checkMandatory.setName("Mandatory"); lblAllowMultiples = new JLabel(); lblAllowMultiples.setText("Allow Multiples?"); checkAllowMultiples = new JCheckBox(); checkAllowMultiples.setName("AllowMultiples"); lblExtraLayers = new JLabel("Extra Layers?"); checkExtraLayers = new JCheckBox(""); checkExtraLayers.setName("ExtraLayers"); checkExtraLayers.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { JCheckBox button = (JCheckBox) e.getSource(); if (button.isSelected()) { panel_MainDesc.setVisible(true); panel_ExtraLayers.setVisible(true); pnlDetails.revalidate(); pnlDetails.repaint(); } else { panel_MainDesc.setVisible(false); panel_ExtraLayers.setVisible(false); pnlDetails.revalidate(); pnlDetails.repaint(); } } }); GroupLayout gl_panelLayer1 = new GroupLayout(panelLayer1); gl_panelLayer1.setHorizontalGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup().addContainerGap() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblFilePrefix).addComponent(lblDescription) .addComponent(lblPosition)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) .addComponent(textfldDescription, GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE) .addComponent(cmbPosition, 0, 169, Short.MAX_VALUE))) .addGroup( gl_panelLayer1.createSequentialGroup() .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(lblAllowMultiples) .addComponent(lblExtraLayers).addComponent(lblMandatory)) .addGap(18) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkExtraLayers).addComponent(checkMandatory) .addComponent(checkAllowMultiples)))) .addContainerGap())); gl_panelLayer1 .setVerticalGroup(gl_panelLayer1.createParallelGroup(Alignment.TRAILING).addGroup(Alignment.LEADING, gl_panelLayer1.createSequentialGroup().addGap(24) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescription) .addComponent(textfldDescription, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1 .createParallelGroup(Alignment.BASELINE).addComponent(lblFilePrefix) .addComponent(textfldFilePrefix, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblPosition) .addComponent(cmbPosition, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(8) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkMandatory).addComponent(lblMandatory)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.LEADING) .addComponent(checkAllowMultiples).addComponent(lblAllowMultiples)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panelLayer1.createParallelGroup(Alignment.BASELINE) .addComponent(lblExtraLayers).addComponent(checkExtraLayers)) .addContainerGap(26, Short.MAX_VALUE))); panelLayer1.setLayout(gl_panelLayer1); btnMoveUp.setPreferredSize(new java.awt.Dimension(91, 23)); btnMoveUp.setText("Move Up"); btnMoveDown.setText("Move Down"); btnAddNew.setText("Add New"); btnDelete.setText("Delete"); btnSave.setText("Save"); btnCancel.setText("Cancel"); btnClose.setText("Close"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.TRAILING).addGroup(layout.createSequentialGroup() .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE).addGap(18) .addGroup(layout.createParallelGroup(Alignment.TRAILING) .addGroup(layout.createSequentialGroup().addComponent(btnAddNew).addGap(18) .addComponent(btnDelete, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE) .addGap(19)) .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup() .addComponent(btnMoveUp, GroupLayout.DEFAULT_SIZE, 78, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnMoveDown, GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE).addGap(89) .addComponent(btnSave, GroupLayout.DEFAULT_SIZE, 61, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnCancel, GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(btnClose, GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout .createSequentialGroup().addContainerGap() .addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup() .addComponent(pnlDetails, GroupLayout.PREFERRED_SIZE, 597, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnDelete) .addComponent(btnAddNew))) .addComponent(scrlDescription, GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)) .addGap(18) .addGroup(layout.createParallelGroup(Alignment.LEADING) .addGroup(layout.createParallelGroup(Alignment.BASELINE) .addComponent(btnMoveUp, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnMoveDown)) .addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(btnClose) .addComponent(btnCancel).addComponent(btnSave))) .addContainerGap())); pnlDetails.setLayout(new BoxLayout(pnlDetails, BoxLayout.Y_AXIS)); panel_MainDesc = new JPanel(); panel_MainDesc.setMinimumSize(new Dimension(300, 0)); panel_MainDesc.setPreferredSize(new Dimension(300, 60)); panel_MainDesc.setMaximumSize(new Dimension(300, 60)); panel_MainDesc.setVisible(false); lblDescriptionMain = new JLabel("Main Description"); textfldDescriptionMain = new JTextField(); textfldDescriptionMain.setName("DescriptionMain"); textfldDescriptionMain.setColumns(10); btnGenMainDesc_1 = new JButton(""); btnGenMainDesc_1.setToolTipText("Generate a main description by concatenating layer descriptions."); btnGenMainDesc_1.setContentAreaFilled(false); btnGenMainDesc_1.setIcon(new ImageIcon(StructMapFileDescManagement.class .getResource("/org/jdesktop/swingx/plaf/basic/resources/month-down.png"))); GroupLayout gl_panel_MainDesc = new GroupLayout(panel_MainDesc); gl_panel_MainDesc.setHorizontalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap() .addComponent(lblDescriptionMain).addGap(18) .addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, 165, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 25, Short.MAX_VALUE) .addContainerGap())); gl_panel_MainDesc.setVerticalGroup(gl_panel_MainDesc.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_MainDesc.createSequentialGroup().addContainerGap().addGroup(gl_panel_MainDesc .createParallelGroup(Alignment.LEADING) .addComponent(btnGenMainDesc_1, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addGroup(gl_panel_MainDesc.createParallelGroup(Alignment.BASELINE) .addComponent(lblDescriptionMain).addComponent(textfldDescriptionMain, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_MainDesc.setLayout(gl_panel_MainDesc); pnlDetails.add(panel_MainDesc); pnlDetails.add(panelLayer1); pnlDetails.add(panel_ExtraLayers); getContentPane().setLayout(layout); pack(); }
From source file:org.bitbucket.mlopatkin.android.logviewer.ConfigurationDialog.java
private ConfigurationDialog(Frame owner) { super(owner); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setModalityType(ModalityType.APPLICATION_MODAL); setTitle("Configuration"); setBounds(100, 100, 400, 122);/*from w w w . j a v a2 s . c o m*/ getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); JLabel lblAdbExecutableLocation = new JLabel("ADB executable location"); textAdbExecutable = new JTextField(Configuration.adb.executable()); lblAdbExecutableLocation.setLabelFor(textAdbExecutable); textAdbExecutable.setColumns(10); JButton btBrowseAdb = new JButton("..."); btBrowseAdb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileChooser(); int result = fileChooser.showOpenDialog(ConfigurationDialog.this); if (result == JFileChooser.APPROVE_OPTION) { textAdbExecutable.setText(fileChooser.getSelectedFile().getAbsolutePath()); } } }); GroupLayout gl_contentPanel = new GroupLayout(contentPanel); gl_contentPanel.setHorizontalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup().addComponent(lblAdbExecutableLocation) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textAdbExecutable, GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(btBrowseAdb, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE))); gl_contentPanel.setVerticalGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPanel.createSequentialGroup() .addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING) .addComponent(lblAdbExecutableLocation) .addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE) .addComponent(textAdbExecutable, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btBrowseAdb))) .addContainerGap(375, Short.MAX_VALUE))); contentPanel.setLayout(gl_contentPanel); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton(acOk); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(acCancel); buttonPane.add(cancelButton); } } }
From source file:org.drools.planner.examples.cloudbalancing.swingui.CloudBalancingPanel.java
public CloudBalancingPanel() { GroupLayout layout = new GroupLayout(this); setLayout(layout);/*from w ww.j a v a2 s. co m*/ JPanel headerPanel = createHeaderPanel(); JPanel computersPanel = createComputersPanel(); layout.setHorizontalGroup( layout.createParallelGroup().addComponent(headerPanel).addComponent(computersPanel)); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(computersPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)); }
From source file:org.drools.planner.examples.machinereassignment.swingui.MachineReassignmentPanel.java
public MachineReassignmentPanel() { GroupLayout layout = new GroupLayout(this); setLayout(layout);/*from w w w. ja v a 2 s.c o m*/ createMachineListPanel(); JPanel headerPanel = new JPanel(); layout.setHorizontalGroup( layout.createParallelGroup().addComponent(headerPanel).addComponent(machineListPanel)); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(machineListPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)); }
From source file:org.drools.planner.examples.nurserostering.swingui.NurseRosteringPanel.java
public NurseRosteringPanel() { GroupLayout layout = new GroupLayout(this); setLayout(layout);/* ww w .java2 s .c o m*/ createEmployeeListPanel(); JPanel headerPanel = createHeaderPanel(); layout.setHorizontalGroup( layout.createParallelGroup().addComponent(headerPanel).addComponent(employeeListPanel)); layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(employeeListPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)); }
From source file:org.opendatakit.appengine.updater.UpdaterWindow.java
/** * Create the application.//from w w w . j a v a 2s. c om */ public UpdaterWindow(CommandLine cmd) { super(); AnnotationProcessor.process(this);// if not using AOP this.cmd = cmd; frame = new JFrame(); frame.setBounds(100, 100, isLinux() ? 720 : 680, 595); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { } @Override public void windowClosed(WindowEvent e) { } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } }); JLabel lblEmail = new JLabel(t(TranslatedStrings.EMAIL_LABEL)); txtEmail = new JTextField(); txtEmail.setFocusable(true); txtEmail.setEditable(true); txtEmail.setColumns(60); txtEmail.setMaximumSize(txtEmail.getPreferredSize()); if (cmd.hasOption(ArgumentNameConstants.EMAIL)) { txtEmail.setText(cmd.getOptionValue(ArgumentNameConstants.EMAIL)); } lblEmail.setLabelFor(txtEmail); JLabel lblToken = new JLabel(t(TranslatedStrings.TOKEN_GRANTING_LABEL)); txtToken = new JTextField(); txtToken.setColumns(60); txtToken.setMaximumSize(txtToken.getPreferredSize()); txtToken.setFocusable(false); txtToken.setEditable(false); if (cmd.hasOption(ArgumentNameConstants.TOKEN_GRANTING_CODE)) { txtToken.setText(cmd.getOptionValue(ArgumentNameConstants.TOKEN_GRANTING_CODE)); } lblToken.setLabelFor(txtToken); // set up listener for updating warning message txtEmail.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateUI(); } @Override public void removeUpdate(DocumentEvent e) { updateUI(); } @Override public void changedUpdate(DocumentEvent e) { updateUI(); } }); // set up listener for updating warning message txtToken.getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { updateUI(); } @Override public void removeUpdate(DocumentEvent e) { updateUI(); } @Override public void changedUpdate(DocumentEvent e) { updateUI(); } }); if ((txtEmail.getText().length() > 0) && ((txtToken.getText().length() > 0) || perhapsHasToken())) { lblWarning = new JLabel(t(TranslatedStrings.WARNING_ERRANT_LABEL)); } else { lblWarning = new JLabel(t(TranslatedStrings.WARNING_REDIRECT_LABEL)); } JLabel outputArea = new JLabel(t(TranslatedStrings.OUTPUT_LBL)); editorArea = new JTextPane(new DefaultStyledDocument()); editorArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); //Put the editor pane in a scroll pane. editorScrollPane = new JScrollPane(editorArea); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(400, 300)); editorScrollPane.setMinimumSize(new Dimension(10, 10)); outputArea.setLabelFor(editorScrollPane); // Create a container so that we can add a title around // the scroll pane. Can't add a title directly to the // scroll pane because its background would be white. // Lay out the label and scroll pane from top to bottom. JPanel listPane = new JPanel(); listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS)); listPane.add(outputArea); listPane.add(Box.createRigidArea(new Dimension(0, 5))); listPane.add(editorScrollPane); listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); btnDeleteToken = new JButton(t(TranslatedStrings.DELETE_TOKEN_LABEL)); btnDeleteToken.addActionListener(new DeleteTokenActionListener()); btnDeleteToken.setEnabled(perhapsHasToken()); btnChoose = new JButton(t(TranslatedStrings.GET_TOKEN_LABEL)); if ((txtEmail.getText().length() > 0) && (txtToken.getText().length() > 0) || perhapsHasToken()) { if (perhapsHasToken()) { btnChoose.setText(t(TranslatedStrings.VERIFY_TOKEN_LABEL)); } else { btnChoose.setText(t(TranslatedStrings.SET_TOKEN_LABEL)); } } else { btnChoose.setText(t(TranslatedStrings.GET_TOKEN_LABEL)); } btnChoose.addActionListener(new GetTokenActionListener()); btnChoose.setEnabled(txtEmail.getText().length() > 0); btnUpload = new JButton(t(TranslatedStrings.UPLOAD_LABEL)); btnUpload.addActionListener(new UploadActionListener()); btnUpload.setEnabled((txtEmail.getText().length() > 0) && perhapsHasToken()); btnRollback = new JButton(t(TranslatedStrings.ROLLBACK_LABEL)); btnRollback.addActionListener(new RollbackActionListener()); btnRollback.setEnabled((txtEmail.getText().length() > 0) && perhapsHasToken()); GroupLayout groupLayout = new GroupLayout(frame.getContentPane()); groupLayout .setHorizontalGroup( groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblEmail) .addComponent(txtEmail).addComponent(lblToken).addComponent(txtToken) .addComponent(lblWarning).addComponent(listPane) .addGroup(groupLayout.createSequentialGroup().addComponent(btnDeleteToken) .addGap(3 * HorizontalSpacing).addComponent(btnChoose) .addGap(HorizontalSpacing).addComponent(btnUpload) .addGap(3 * HorizontalSpacing, 4 * HorizontalSpacing, Short.MAX_VALUE) .addComponent(btnRollback))) .addContainerGap()); groupLayout.setVerticalGroup(groupLayout.createSequentialGroup().addContainerGap().addComponent(lblEmail) .addPreferredGap(ComponentPlacement.RELATED).addComponent(txtEmail) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblToken) .addPreferredGap(ComponentPlacement.RELATED).addComponent(txtToken) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(lblWarning) .addPreferredGap(ComponentPlacement.UNRELATED).addComponent(listPane) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnDeleteToken) .addComponent(btnChoose).addComponent(btnUpload).addComponent(btnRollback)) .addContainerGap()); frame.getContentPane().setLayout(groupLayout); frame.addWindowListener(this); }
From source file:org.opendatakit.briefcase.ui.MainBriefcaseWindow.java
/** * Create the application.//from ww w . ja v a 2 s .co m */ public MainBriefcaseWindow() { frame = new JFrame(); frame.setBounds(100, 100, 680, 595); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { } @Override public void windowClosed(WindowEvent e) { } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } }); JLabel lblBriefcaseDirectory = new JLabel(MessageStrings.BRIEFCASE_STORAGE_LOCATION); txtBriefcaseDir = new JTextField(); txtBriefcaseDir.setFocusable(false); txtBriefcaseDir.setEditable(false); txtBriefcaseDir.setColumns(10); btnChoose = new JButton("Change..."); btnChoose.addActionListener(new FolderActionListener()); tabbedPane = new JTabbedPane(JTabbedPane.TOP); GroupLayout groupLayout = new GroupLayout(frame.getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout .createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(tabbedPane, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 628, Short.MAX_VALUE) .addGroup(groupLayout.createSequentialGroup().addComponent(lblBriefcaseDirectory).addGap(18) .addComponent(txtBriefcaseDir, GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE) .addGap(18).addComponent(btnChoose))) .addContainerGap())); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(txtBriefcaseDir, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnChoose).addComponent(lblBriefcaseDirectory)) .addGap(33).addComponent(tabbedPane, GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE) .addContainerGap())); gatherPanel = new PullTransferPanel(transferTerminationFuture); tabbedPane.addTab(PullTransferPanel.TAB_NAME, null, gatherPanel, null); PullTransferPanel.TAB_POSITION = 0; uploadPanel = new PushTransferPanel(transferTerminationFuture); tabbedPane.addTab(PushTransferPanel.TAB_NAME, null, uploadPanel, null); PushTransferPanel.TAB_POSITION = 1; exportPanel = new ExportPanel(exportTerminationFuture); tabbedPane.addTab(ExportPanel.TAB_NAME, null, exportPanel, null); frame.getContentPane().setLayout(groupLayout); ExportPanel.TAB_POSITION = 2; frame.addWindowListener(this); setFullUIEnabled(false); frame.setFocusTraversalPolicy(new FocusTraversalPolicy() { @Override public Component getComponentAfter(Container arg0, Component arg1) { ArrayList<Component> componentOrdering = new ArrayList<Component>(); for (;;) { int nextPanel = PullTransferPanel.TAB_POSITION; componentOrdering.clear(); componentOrdering.add(txtBriefcaseDir); componentOrdering.add(btnChoose); componentOrdering.add(tabbedPane); int idx = tabbedPane.getSelectedIndex(); if (idx == PullTransferPanel.TAB_POSITION) { componentOrdering.addAll(gatherPanel.getTraversalOrdering()); nextPanel = PushTransferPanel.TAB_POSITION; } else if (idx == PushTransferPanel.TAB_POSITION) { componentOrdering.addAll(uploadPanel.getTraversalOrdering()); nextPanel = ExportPanel.TAB_POSITION; } else if (idx == ExportPanel.TAB_POSITION) { componentOrdering.addAll(exportPanel.getTraversalOrdering()); nextPanel = PullTransferPanel.TAB_POSITION; } componentOrdering.add(btnChoose); boolean found = false; for (int i = 0; i < componentOrdering.size() - 1; ++i) { if (found || arg1 == componentOrdering.get(i)) { found = true; Component comp = componentOrdering.get(i + 1); if (comp == tabbedPane) { return comp; } if (comp.isVisible() && comp.isEnabled() && (!(comp instanceof JTextField) || ((JTextField) comp).isEditable())) { return comp; } } } if (!found) { return componentOrdering.get(0); } tabbedPane.setSelectedIndex(nextPanel); } } @Override public Component getComponentBefore(Container arg0, Component arg1) { ArrayList<Component> componentOrdering = new ArrayList<Component>(); for (;;) { int nextPanel = PullTransferPanel.TAB_POSITION; componentOrdering.clear(); componentOrdering.add(txtBriefcaseDir); componentOrdering.add(btnChoose); componentOrdering.add(tabbedPane); int idx = tabbedPane.getSelectedIndex(); if (idx == PullTransferPanel.TAB_POSITION) { componentOrdering.addAll(gatherPanel.getTraversalOrdering()); nextPanel = ExportPanel.TAB_POSITION; } else if (idx == PushTransferPanel.TAB_POSITION) { componentOrdering.addAll(uploadPanel.getTraversalOrdering()); nextPanel = PullTransferPanel.TAB_POSITION; } else if (idx == ExportPanel.TAB_POSITION) { componentOrdering.addAll(exportPanel.getTraversalOrdering()); nextPanel = PushTransferPanel.TAB_POSITION; } componentOrdering.add(btnChoose); boolean found = false; for (int i = componentOrdering.size() - 1; i > 0; --i) { if (found || arg1 == componentOrdering.get(i)) { found = true; Component comp = componentOrdering.get(i - 1); if (comp == tabbedPane) { return comp; } if (comp.isVisible() && comp.isEnabled() && (!(comp instanceof JTextField) || ((JTextField) comp).isEditable())) { return comp; } } } if (!found) { return componentOrdering.get(componentOrdering.size() - 1); } tabbedPane.setSelectedIndex(nextPanel); } } @Override public Component getDefaultComponent(Container arg0) { return btnChoose; } @Override public Component getFirstComponent(Container arg0) { return btnChoose; } @Override public Component getLastComponent(Container arg0) { return tabbedPane; } }); }
From source file:org.opendatakit.briefcase.ui.MainFormUploaderWindow.java
/** * Initialize the contents of the frame. *///from ww w.j a va 2 s . c om private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 680, 206); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel lblFormDefinitionFile = new JLabel("Form Definition to upload:"); txtFormDefinitionFile = new JTextField(); txtFormDefinitionFile.setFocusable(false); txtFormDefinitionFile.setEditable(false); txtFormDefinitionFile.setColumns(10); btnChoose = new JButton("Choose..."); btnChoose.addActionListener(new FormDefinitionActionListener()); txtDestinationName = new JTextField(); txtDestinationName.setFocusable(false); txtDestinationName.setEditable(false); txtDestinationName.setColumns(10); btnChooseServer = new JButton("Configure..."); btnChooseServer.addActionListener(new DestinationActionListener()); lblUploading = new JLabel(""); btnDetails = new JButton("Details..."); btnDetails.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (fs != null) { ScrollingStatusListDialog.showDialog(MainFormUploaderWindow.this.frame, fs.getFormDefinition(), fs.getStatusHistory()); } } }); btnUploadForm = new JButton("Upload Form"); btnUploadForm.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setActiveTransferState(true); File formDefn = new File(txtFormDefinitionFile.getText()); TransferAction.uploadForm(MainFormUploaderWindow.this.frame.getOwner(), destinationServerInfo, terminationFuture, formDefn, fs); } }); btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { terminationFuture.markAsCancelled(new TransferAbortEvent("Form upload cancelled by user.")); } }); btnClose = new JButton("Close"); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (transferStateActive) { if (JOptionPane.YES_OPTION != JOptionPane.showOptionDialog(frame, "An upload is in progress. Are you sure you want to abort and exit?", "Confirm Stop Form Upload", JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, null, null, null)) { return; // no-op } terminationFuture.markAsCancelled(new TransferAbortEvent("User closes window")); } frame.setVisible(false); frame.dispose(); System.exit(0); } }); JLabel lblUploadToServer = new JLabel("Upload to server:"); GroupLayout groupLayout = new GroupLayout(frame.getContentPane()); groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(lblFormDefinitionFile) .addComponent(lblUploadToServer).addComponent(lblUploading)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(txtFormDefinitionFile, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(txtDestinationName, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup().addComponent(btnDetails) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnUploadForm) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnCancel))) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING) .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addComponent(btnChoose, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent(btnChooseServer, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)) .addComponent(btnClose)) .addContainerGap()); groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING) .addGroup(groupLayout.createSequentialGroup().addContainerGap() .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) .addComponent(txtFormDefinitionFile, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblFormDefinitionFile).addComponent(btnChoose)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup( groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblUploadToServer) .addComponent(txtDestinationName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btnChooseServer)) .addPreferredGap(ComponentPlacement.UNRELATED, 10, Short.MAX_VALUE) .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(lblUploading) .addComponent(btnDetails).addComponent(btnUploadForm).addComponent(btnCancel) .addComponent(btnClose)) .addContainerGap())); frame.getContentPane().setLayout(groupLayout); setActiveTransferState(false); }