List of usage examples for javax.swing JScrollPane setViewportView
public void setViewportView(Component view)
From source file:com.mgmtp.perfload.loadprofiles.ui.dialog.SettingsDialog.java
private void initComponents() { getContentPane().setLayout(new MigLayout("", "[grow]", "[][grow][grow][grow][]")); {//from w ww. j av a 2s. c o m JPanel pnlConfigurations = new JPanel(); pnlConfigurations.setBorder(new TitledBorder(null, "Saved Configurations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlConfigurations.setName("pnlConfigurations"); getContentPane().add(pnlConfigurations, "cell 0 0, growx"); pnlConfigurations.setLayout(new MigLayout("", "[grow]", "[]")); { JLabel lblFileName = new JLabel("File Name"); lblFileName.setName("lblFileName"); pnlConfigurations.add(lblFileName, "flowx,cell 0 0"); } { cboConfigurationFile = new JComboBox() { @Override public void setSelectedItem(final Object anObject) { if (checkDirty()) { super.setSelectedItem(anObject); } } }; cboConfigurationFile.addItemListener(new CboConfigurationFileItemListener()); pnlConfigurations.add(cboConfigurationFile, "cell 0 0,growx"); cboConfigurationFile.setName("cboConfigurationFile"); } { JButton btnNewConfigurationFile = new JButtonExt("New..."); btnNewConfigurationFile.addActionListener(new BtnNewConfigurationFileActionListener()); pnlConfigurations.add(btnNewConfigurationFile, "cell 0 0, sg btns"); btnNewConfigurationFile.setName("btnNewButton"); } { JButton btnCopy = new JButtonExt("Copy..."); btnCopy.addActionListener(new BtnCopyActionListener()); btnCopy.setName("btnCopy"); pnlConfigurations.add(btnCopy, "cell 0 0, sg btns"); } { JButton btnDelete = new JButtonExt("Delete..."); btnDelete.addActionListener(new BtnDeleteActionListener()); btnDelete.setName("btnDelete"); pnlConfigurations.add(btnDelete, "cell 0 0, sg btns"); } } { JPanel pnlOperations = new JPanel(); getContentPane().add(pnlOperations, "cell 0 1, grow"); pnlOperations.setBorder( new TitledBorder(null, "Operations", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlOperations.setName("pnlOperations"); pnlOperations.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spOperations = new JScrollPane(); spOperations.setName("spOperations"); pnlOperations.add(spOperations, "cell 0 0 1 2, height 180::, grow"); { tblOperations = new JTableExt(); tblOperations.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblOperations.setFillsViewportHeight(true); tblOperations.setName("tblOperations"); spOperations.setViewportView(tblOperations); } } { JButton btnAddOperation = new JButtonExt("Add Operation"); btnAddOperation.addActionListener(new BtnAddOperationActionListener()); btnAddOperation.setMargin(new Insets(2, 2, 2, 2)); btnAddOperation.setName("btnAddOperation"); pnlOperations.add(btnAddOperation, "cell 1 0, grow"); } { JButton btnRemoveOperation = new JButtonExt("Delete Operation"); btnRemoveOperation.addActionListener(new BtnRemoveOperationActionListener()); btnRemoveOperation.setMargin(new Insets(2, 2, 2, 2)); btnRemoveOperation.setName("btnRemoveOperation"); pnlOperations.add(btnRemoveOperation, "cell 1 1, growx, top"); } } { JPanel pnlTargets = new JPanel(); getContentPane().add(pnlTargets, "cell 0 2, grow"); pnlTargets.setBorder( new TitledBorder(null, "Targets", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlTargets.setName("pnlTargets"); pnlTargets.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spTargets = new JScrollPane(); spTargets.setName("spTargets"); pnlTargets.add(spTargets, "cell 0 0 1 2, height 50::, grow"); { tblTargets = new JTableExt(); tblTargets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblTargets.setFillsViewportHeight(true); tblTargets.setName("tblTargets"); spTargets.setViewportView(tblTargets); } } { JButton btnAddTarget = new JButtonExt("Add Target"); btnAddTarget.addActionListener(new BtnAddTargetActionListener()); btnAddTarget.setMargin(new Insets(2, 2, 2, 2)); btnAddTarget.setName("btnAddClientConfig"); pnlTargets.add(btnAddTarget, "cell 1 0, growx"); } { JButton btnRemoveTarget = new JButtonExt("Delete Target"); btnRemoveTarget.addActionListener(new BtnRemoveTargetActionListener()); btnRemoveTarget.setMargin(new Insets(2, 2, 2, 2)); btnRemoveTarget.setName("btnRemoveClientConfig"); pnlTargets.add(btnRemoveTarget, "cell 1 1, growx, top"); } } { JPanel pnlClients = new JPanel(); getContentPane().add(pnlClients, "cell 0 3, grow"); pnlClients.setBorder( new TitledBorder(null, "Clients", TitledBorder.LEADING, TitledBorder.TOP, null, null)); pnlClients.setName("pnlClientConfigs"); pnlClients.setLayout(new MigLayout("insets 4", "[grow][110!]", "[][]")); { JScrollPane spClients = new JScrollPane(); spClients.setName("spClients"); pnlClients.add(spClients, "cell 0 0 1 2, height 50::, grow"); { tblClients = new JTableExt(); tblClients.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tblClients.setFillsViewportHeight(true); tblClients.setName("tblClients"); spClients.setViewportView(tblClients); } } { JButton btnAddClient = new JButtonExt("Add Client"); btnAddClient.addActionListener(new BtnAddClientActionListener()); btnAddClient.setMargin(new Insets(2, 2, 2, 2)); btnAddClient.setName("btnAddClient"); pnlClients.add(btnAddClient, "cell 1 0, growx"); } { JButton btnRemoveClient = new JButtonExt("Delete Client"); btnRemoveClient.addActionListener(new BtnRemoveClientActionListener()); btnRemoveClient.setMargin(new Insets(2, 2, 2, 2)); btnRemoveClient.setName("btnRemoveClient"); pnlClients.add(btnRemoveClient, "cell 1 1, growx, top"); } } { JButton btnOk = new JButtonExt("OK"); getRootPane().setDefaultButton(btnOk); btnOk.addActionListener(new BtnOkActionListener()); btnOk.setName("btnOk"); getContentPane().add(btnOk, "cell 0 4,alignx right"); } { JButton btnCancel = new JButtonExt("Cancel"); btnCancel.addActionListener(new BtnCancelActionListener()); btnCancel.setName("btnCancel"); getContentPane().add(btnCancel, "cell 0 4,alignx right"); } }
From source file:com.vgi.mafscaling.OpenLoop.java
protected void createRunPanel(JPanel dataPanel) { JScrollPane dataScrollPane = new JScrollPane(); GridBagConstraints gbc_dataScrollPane = new GridBagConstraints(); gbc_dataScrollPane.weightx = 1.0;// www . j a v a2 s .co m gbc_dataScrollPane.weighty = 1.0; gbc_dataScrollPane.fill = GridBagConstraints.BOTH; gbc_dataScrollPane.gridx = 0; gbc_dataScrollPane.gridy = 3; dataPanel.add(dataScrollPane, gbc_dataScrollPane); JPanel dataRunPanel = new JPanel(); dataScrollPane.setViewportView(dataRunPanel); GridBagLayout gbl_dataRunPanel = new GridBagLayout(); gbl_dataRunPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; gbl_dataRunPanel.rowHeights = new int[] { 0 }; gbl_dataRunPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 }; gbl_dataRunPanel.rowWeights = new double[] { 0.0 }; dataRunPanel.setLayout(gbl_dataRunPanel); createRunTables(dataRunPanel); }
From source file:com.vgi.mafscaling.ClosedLoop.java
private void createLogDataTable(JScrollPane dataScrollPane) { JPanel dataRunPanel = new JPanel(); dataScrollPane.setViewportView(dataRunPanel); GridBagLayout gbl_dataRunPanel = new GridBagLayout(); gbl_dataRunPanel.columnWidths = new int[] { 0 }; gbl_dataRunPanel.rowHeights = new int[] { 0 }; gbl_dataRunPanel.columnWeights = new double[] { 0.0 }; gbl_dataRunPanel.rowWeights = new double[] { 0.0 }; dataRunPanel.setLayout(gbl_dataRunPanel); logDataTable = new JTable(); logDataTable.getTableHeader().setReorderingAllowed(false); logDataTable.setModel(new DefaultTableModel(LogDataRowCount, ColumnCount)); logDataTable.setColumnSelectionAllowed(true); logDataTable.setCellSelectionEnabled(true); logDataTable.setBorder(new LineBorder(new Color(0, 0, 0))); logDataTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); logDataTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); logDataTable.getColumnModel().getColumn(0).setHeaderValue("Time"); logDataTable.getColumnModel().getColumn(1).setHeaderValue("Load"); logDataTable.getColumnModel().getColumn(2).setHeaderValue("RPM"); logDataTable.getColumnModel().getColumn(3).setHeaderValue("MafV"); logDataTable.getColumnModel().getColumn(4).setHeaderValue("AFR"); logDataTable.getColumnModel().getColumn(5).setHeaderValue("STFT"); logDataTable.getColumnModel().getColumn(6).setHeaderValue("LTFT"); logDataTable.getColumnModel().getColumn(7).setHeaderValue("dV/dt"); logDataTable.getColumnModel().getColumn(8).setHeaderValue("IAT"); Utils.initializeTable(logDataTable, ColumnWidth); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(0, 0, 0, 0); gbc.anchor = GridBagConstraints.PAGE_START; gbc.gridx = 0;// w w w .j a v a 2 s .co m gbc.gridy = 0; dataRunPanel.add(logDataTable.getTableHeader(), gbc); gbc.gridy = 1; dataRunPanel.add(logDataTable, gbc); excelAdapter.addTable(logDataTable, true, false); }
From source file:com.floreantpos.ui.model.PizzaItemForm.java
private JPanel getModifierGroupTab() { JPanel tabModifierGroup = new JPanel(new MigLayout("fill")); JButton btnNewModifierGroup = new javax.swing.JButton(); JButton btnEditModifierGroup = new javax.swing.JButton(); JButton btnDeleteModifierGroup = new javax.swing.JButton(); tableTicketItemModifierGroups = new javax.swing.JTable(); JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1.setViewportView(tableTicketItemModifierGroups); tabModifierGroup.add(jScrollPane1, "span,grow"); tabModifierGroup.add(btnNewModifierGroup, "left,split 3"); tabModifierGroup.add(btnEditModifierGroup); tabModifierGroup.add(btnDeleteModifierGroup); btnNewModifierGroup.setText(com.floreantpos.POSConstants.ADD); btnNewModifierGroup.setActionCommand("AddModifierGroup"); //$NON-NLS-1$ btnNewModifierGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNewModifierGroupActionPerformed(evt); }//from w ww . j av a 2s . co m }); btnDeleteModifierGroup.setText(com.floreantpos.POSConstants.DELETE); btnDeleteModifierGroup.setActionCommand("DeleteModifierGroup"); //$NON-NLS-1$ btnEditModifierGroup.setText(com.floreantpos.POSConstants.EDIT); btnEditModifierGroup.setActionCommand("EditModifierGroup"); //$NON-NLS-1$ menuItemMGListModel = new MenuItemMGListModel(); tableTicketItemModifierGroups.setModel(menuItemMGListModel); btnNewModifierGroup.addActionListener(this); btnEditModifierGroup.addActionListener(this); btnDeleteModifierGroup.addActionListener(this); return tabModifierGroup; }
From source file:userinterface.properties.GUIGraphPicker.java
/** According to what is stored in 'rc', set up the table to pick the constants */// w w w .j ava 2 s. com private void init() { // set up "define other constants" table // create header GraphConstantHeader header = new GraphConstantHeader(); constantTablePanel.add(header, BorderLayout.NORTH); // create scroller JScrollPane scroller = new JScrollPane(); constantTablePanel.add(scroller, BorderLayout.CENTER); // create picker list pickerList = new GraphConstantPickerList(); scroller.setViewportView(pickerList); // determine if 3d charts can be plotted or not plotType2d.setSelected(true); selectYaxisConstantCombo.setEnabled(false); if (resultsCollection.getRangingConstants().size() == 1) { plotType3d.setEnabled(false); } // for each ranging constant in rc, add: // (1) a row in the picker list // (2) an item in the "x axis" drop down menu for (int i = 0; i < resultsCollection.getRangingConstants().size(); i++) { DefinedConstant dc = (DefinedConstant) resultsCollection.getRangingConstants().get(i); pickerList.addConstant(new GraphConstantLine(dc, this)); this.selectAxisConstantCombo.addItem(dc.getName()); } // select the default constant for the x axis // (first property if there is one, if not first model one) if (selectAxisConstantCombo.getItemCount() > 0) { if (resultsCollection.getNumPropertyRangingConstants() > 0) selectAxisConstantCombo.setSelectedIndex(resultsCollection.getNumModelRangingConstants()); else selectAxisConstantCombo.setSelectedIndex(0); } // now check if the second axis can be selected or not if (resultsCollection.getRangingConstants().size() == 1) { selectYaxisConstantCombo.setEnabled(false); } else { for (int i = 0; i < resultsCollection.getRangingConstants().size(); i++) { DefinedConstant dc = (DefinedConstant) resultsCollection.getRangingConstants().get(i); this.selectYaxisConstantCombo.addItem(dc.getName()); } this.selectYaxisConstantCombo.setSelectedIndex(1); } // and disable it in the picker list pickerList.disableLine(0); // if there is only one ranging constant, disable controls if (resultsCollection.getRangingConstants().size() == 1) { selectAxisConstantCombo.setEnabled(false); pickerList.setEnabled(false); header.setEnabled(false); this.middleLabel.setEnabled(false); this.topComboLabel.setEnabled(false); } // default graph option is "new graph" this.newGraphRadio.setSelected(true); // add existing graphs to choose from for (int i = 0; i < graphHandler.getNumModels(); i++) { if (graphHandler.getModel(i) instanceof Graph) existingGraphCombo.addItem(graphHandler.getGraphName(i)); } // default to latest one if (existingGraphCombo.getItemCount() > 0) { existingGraphCombo.setSelectedIndex(existingGraphCombo.getItemCount() - 1); } // if there are no graphs, disable control else { existingGraphCombo.setEnabled(false); this.existingGraphRadio.setEnabled(false); } // create a default series name resetAutoSeriesName(); // other enables/disables doEnables(); pack(); }
From source file:com.polivoto.vistas.Charts.java
private void crearTabla(Pregunta pregunta) { JScrollPane scrollPanel = new JScrollPane(); JPanel panel = new JPanel(new GridLayout(0, 1)); if (pregunta.obtenerCantidadDePerfiles() > 1) { for (int i = 0; i < pregunta.obtenerCantidadDePerfiles(); i++) { JPanel p = hacerTabla(pregunta, ((ResultadoPorPerfil) pregunta.obtenerResultadoPorPerfil(i)).getOpciones(), ((ResultadoPorPerfil) pregunta.obtenerResultadoPorPerfil(i)).getPerfil()); panel.add(p);/*from w w w . ja va 2 s .co m*/ } } JPanel p = hacerTabla(pregunta, pregunta.obtenerOpciones(), "Todos"); panel.add(p); scrollPanel.setViewportView(panel); scrollPanel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); JScrollBar vertical = scrollPanel.getVerticalScrollBar(); vertical.setValue(0); vertical.setUnitIncrement(30); panelGrafica.add(scrollPanel, BorderLayout.CENTER); panel.repaint(); panel.revalidate(); panelGrafica.repaint(); panelGrafica.revalidate(); }
From source file:gda.gui.BatonPanel.java
private void initGUI() { try {/*from w ww. j ava 2s . c o m*/ { BorderLayout thisLayout = new BorderLayout(); this.setLayout(thisLayout); this.setPreferredSize(new java.awt.Dimension(902, 431)); } { JPanel jPanel1 = new JPanel(); this.add(jPanel1, BorderLayout.WEST); this.add(getPnlMessages(), BorderLayout.CENTER); jPanel1.setLayout(null); jPanel1.setPreferredSize(new java.awt.Dimension(480, 419)); { sudoPanel = new JPanel(); BorderLayout sudoPanelLayout = new BorderLayout(); sudoPanel.setLayout(sudoPanelLayout); jPanel1.add(sudoPanel); sudoPanel.add(getPnlSudoButtons(), BorderLayout.CENTER); sudoPanel.add(getPnlSUMessage(), BorderLayout.NORTH); sudoPanel.setBorder(BorderFactory.createTitledBorder("Switch User")); sudoPanel.setBounds(12, 340, 456, 80); } { otherClientPanel = new JPanel(); jPanel1.add(otherClientPanel); otherClientPanel.setBorder(BorderFactory.createTitledBorder("Clients on this beamline")); otherClientPanel.setBounds(12, 15, 456, 215); otherClientPanel.setLayout(null); { lblUser = new JLabel(); otherClientPanel.add(lblUser); lblUser.setText("You are logged in as: abc123"); lblUser.setBounds(15, 36, 422, 14); lblUser.setHorizontalAlignment(SwingConstants.CENTER); lblUser.setHorizontalTextPosition(SwingConstants.CENTER); } { lblBaton = new JLabel(); otherClientPanel.add(lblBaton); lblBaton.setText("You hold the baton and have control of the beamline"); lblBaton.setBounds(15, 66, 422, 14); lblBaton.setHorizontalTextPosition(SwingConstants.CENTER); lblBaton.setInheritsPopupMenu(false); lblBaton.setHorizontalAlignment(SwingConstants.CENTER); } { JScrollPane jScrollPane1 = new JScrollPane(); otherClientPanel.add(jScrollPane1); jScrollPane1.setBounds(73, 96, 306, 97); { userClients = new JTable(); jScrollPane1.setViewportView(userClients); userClients.setModel(this.new BatonTableModel()); userClients.setAutoCreateRowSorter(true); userClients.setPreferredSize(new java.awt.Dimension(213, 97)); userClients.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); userClients.setColumnSelectionAllowed(false); userClients.getSelectionModel().addListSelectionListener(this); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(SwingConstants.CENTER); userClients.getColumnModel().getColumn(0).setCellRenderer(renderer); userClients.getColumnModel().getColumn(1).setCellRenderer(renderer); userClients.getColumnModel().getColumn(2).setCellRenderer(renderer); JTableHeader th = userClients.getTableHeader(); th.addMouseListener(this); } } } { buttonsPanel = new JPanel(); BorderLayout buttonsPanelLayout = new BorderLayout(); buttonsPanel.setLayout(buttonsPanelLayout); jPanel1.add(buttonsPanel); buttonsPanel.setBorder(BorderFactory.createTitledBorder("Baton control")); buttonsPanel.setBounds(12, 242, 456, 92); buttonsPanel.add(getPnlControlButton(), BorderLayout.CENTER); buttonsPanel.add(getPnlTickBox(), BorderLayout.SOUTH); } } } catch (Exception e) { logger.error(e.getMessage(), e); } }
From source file:SuitaDetails.java
private void showLib() { JScrollPane jScrollPane1 = new JScrollPane(); JList jList1 = new JList(); JPanel libraries = new JPanel(); jScrollPane1.setViewportView(jList1); GroupLayout layout = new GroupLayout(libraries); libraries.setLayout(layout);/* w w w.j a va 2 s . co m*/ layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)); try { Object[] s = (Object[]) RunnerRepository.getRPCClient().execute("getLibrariesList", new Object[] { RunnerRepository.user }); String[] libs = new String[s.length]; for (int i = 0; i < s.length; i++) { libs[i] = s[i].toString(); } ArrayList<Integer> ind = new ArrayList<Integer>(); jList1.setModel(new DefaultComboBoxModel(libs)); for (String st : globallib) { for (int i = 0; i < libs.length; i++) { if (libs[i].equals(st)) { ind.add(new Integer(i)); } } } int[] indices = new int[ind.size()]; for (int i = 0; i < ind.size(); i++) { indices[i] = ind.get(i); } jList1.setSelectedIndices(indices); } catch (Exception e) { System.out.println("There was an error on calling getLibrariesList on CE"); e.printStackTrace(); } int resp = (Integer) CustomDialog.showDialog(libraries, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, RunnerRepository.window, "Libraries", null); if (resp == JOptionPane.OK_OPTION) { Object[] val = jList1.getSelectedValues(); globallib = new String[val.length]; for (int s = 0; s < val.length; s++) { globallib[s] = val[s].toString(); } } }
From source file:SuitaDetails.java
public void showSuiteLib() { JScrollPane jScrollPane1 = new JScrollPane(); JList jList1 = new JList(); JPanel libraries = new JPanel(); jScrollPane1.setViewportView(jList1); GroupLayout layout = new GroupLayout(libraries); libraries.setLayout(layout);// ww w .j ava 2 s. c o m layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)); try { Object[] s = (Object[]) RunnerRepository.getRPCClient().execute("getLibrariesList", new Object[] { RunnerRepository.user }); String[] libs = new String[s.length]; for (int i = 0; i < s.length; i++) { libs[i] = s[i].toString(); } ArrayList<Integer> ind = new ArrayList<Integer>(); jList1.setModel(new DefaultComboBoxModel(libs)); if (parent.getLibs() != null) { for (String st : parent.getLibs()) { for (int i = 0; i < libs.length; i++) { if (libs[i].equals(st)) { ind.add(new Integer(i)); } } } int[] indices = new int[ind.size()]; for (int i = 0; i < ind.size(); i++) { indices[i] = ind.get(i); } jList1.setSelectedIndices(indices); } } catch (Exception e) { System.out.println("There was an error on calling getLibrariesList on CE"); e.printStackTrace(); } int resp = (Integer) CustomDialog.showDialog(libraries, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, RunnerRepository.window, "Libraries", null); if (resp == JOptionPane.OK_OPTION) { Object[] val = jList1.getSelectedValues(); String[] libs = new String[val.length]; for (int s = 0; s < val.length; s++) { libs[s] = val[s].toString(); } parent.setLibs(libs); } }
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); GroupLayout layout = new GroupLayout(suiteoptions); suiteoptions.setLayout(layout);//from w w w . jav a2 s.co m 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 }); }