List of usage examples for javax.swing UIManager getBorder
public static Border getBorder(Object key)
From source file:com.projity.pm.graphic.chart.AxisPanel.java
AxisPanel(ChartInfo chartInfo) { this.chartInfo = chartInfo; setBorder(UIManager.getBorder("TableHeader.cellBorder")); }
From source file:logdruid.ui.DateEditor.java
/** * Create the panel.//from ww w . j a v a2s.c o m */ public DateEditor(Repository rep) { repository = rep; model = new MyTableModel2(data, header); GridBagLayout gridBagLayout = new GridBagLayout(); gridBagLayout.columnWidths = new int[] { 15, 550, 15 }; gridBagLayout.rowHeights = new int[] { 152, 300 }; gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0 }; gridBagLayout.rowWeights = new double[] { 0.0, 1.0 }; setLayout(gridBagLayout); JPanel panel_1 = new JPanel(); GridBagConstraints gbc_panel_1 = new GridBagConstraints(); gbc_panel_1.fill = GridBagConstraints.BOTH; gbc_panel_1.insets = new Insets(5, 0, 5, 5); gbc_panel_1.gridx = 1; gbc_panel_1.gridy = 0; add(panel_1, gbc_panel_1); panel_1.setLayout(new BorderLayout(0, 0)); table = new JTable(model); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.setBorder(UIManager.getBorder("TextPane.border")); table.setPreferredScrollableViewportSize(new Dimension(0, 0)); table.setFillsViewportHeight(true); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // ((table.getSelectedRow()!=-1)?table.convertRowIndexToModel(table.getSelectedRow()):-1) // persist repository // display selected row if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1) >= 0) { /* * recEditor = new RecordingEditor(repository * .getRecordings().get(((table.getSelectedRow()!=-1)?table. * convertRowIndexToModel(table.getSelectedRow()):-1)), * repository); jPanelDetail.removeAll(); */ // jPanelDetail.add(recEditor, gbc_jPanelDetail); DateFormat df = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); if (df != null) { textFieldName.setText((String) df.getName()); textFieldPattern.setText((String) df.getPattern()); textField.setText((String) df.getDateFormat()); } // jPanelDetail.revalidate(); // jPanelDetail.repaint(); // jPanelDetail.setVisible(true); // reloadTable(); those 2 ******** // jPanelDetail.revalidate(); } } }); JScrollPane scrollPane = new JScrollPane(table); panel_1.add(scrollPane, BorderLayout.CENTER); // Set up column sizes. initColumnSizes(table); JPanel panel = new JPanel(); FlowLayout flowLayout = (FlowLayout) panel.getLayout(); flowLayout.setAlignment(FlowLayout.LEFT); flowLayout.setVgap(2); flowLayout.setHgap(2); panel_1.add(panel, BorderLayout.SOUTH); JButton btnNew = new JButton("New"); panel.add(btnNew); btnNew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { DateFormat df = new DateFormat("name", "\\w{3}\\s[0-9]{1}/[0-9]{2}/[0-9]{2}\\s\\d\\d:\\d\\d:\\d\\d", "EEE. MM/dd/yy HH:mm:ss"); repository.addDateFormat(df); data.add(new Object[] { df.getName(), df.getPattern(), df.getDateFormat() }); table.repaint(); } }); JButton btnDuplicate = new JButton("Duplicate"); btnDuplicate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1) >= 0) { DateFormat df = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); repository.addDateFormat(df); reloadTable(); // data.add(new Object[] { table.getRowCount()+1, // df.getName(),df.getDateFormat()}); table.repaint(); } } }); panel.add(btnDuplicate); JButton btnDelete = new JButton("Delete"); btnDelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int selectedRow = ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1); if (selectedRow >= 0) { repository.deleteDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); data.remove( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); reloadTable(); table.setRowSelectionInterval(selectedRow, selectedRow); table.repaint(); } } }); panel.add(btnDelete); jPanelDetail = new JPanel(); gbc_jPanelDetail = new GridBagConstraints(); gbc_jPanelDetail.anchor = GridBagConstraints.NORTH; gbc_jPanelDetail.fill = GridBagConstraints.HORIZONTAL; gbc_jPanelDetail.gridx = 1; gbc_jPanelDetail.gridy = 1; add(jPanelDetail, gbc_jPanelDetail); GridBagLayout gbl_jPanelDetail = new GridBagLayout(); gbl_jPanelDetail.columnWidths = new int[] { 169 }; gbl_jPanelDetail.rowHeights = new int[] { 0, 0, 0, 0, 150, 0 }; gbl_jPanelDetail.columnWeights = new double[] { 1.0, 0.0 }; gbl_jPanelDetail.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0, 0.0 }; jPanelDetail.setLayout(gbl_jPanelDetail); JPanel panel_2 = new JPanel(); panel_2.setBorder(null); GridBagConstraints gbc_panel_2 = new GridBagConstraints(); gbc_panel_2.gridwidth = 2; gbc_panel_2.anchor = GridBagConstraints.NORTHWEST; gbc_panel_2.insets = new Insets(0, 0, 5, 0); gbc_panel_2.gridx = 0; gbc_panel_2.gridy = 0; jPanelDetail.add(panel_2, gbc_panel_2); panel_2.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); JLabel label = new JLabel("Name"); panel_2.add(label); textFieldName = new JTextField(); textFieldName.setColumns(20); panel_2.add(textFieldName); JPanel panel_3 = new JPanel(); FlowLayout flowLayout_1 = (FlowLayout) panel_3.getLayout(); flowLayout_1.setAlignment(FlowLayout.LEFT); panel_3.setBorder(null); GridBagConstraints gbc_panel_3 = new GridBagConstraints(); gbc_panel_3.insets = new Insets(0, 0, 5, 0); gbc_panel_3.gridwidth = 2; gbc_panel_3.anchor = GridBagConstraints.NORTHWEST; gbc_panel_3.gridx = 0; gbc_panel_3.gridy = 1; jPanelDetail.add(panel_3, gbc_panel_3); labelPattern = new JLabel("Pattern"); panel_3.add(labelPattern); textFieldPattern = new JTextField(); textFieldPattern.setColumns(40); panel_3.add(textFieldPattern); JButton btnSave = new JButton("Save"); btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DateFormat df1 = repository.getDateFormat( ((table.getSelectedRow() != -1) ? table.convertRowIndexToModel(table.getSelectedRow()) : -1)); df1.update(textFieldName.getText(), textFieldPattern.getText(), textField.getText()); reloadTable(); } }); JPanel panel_4 = new JPanel(); FlowLayout flowLayout_2 = (FlowLayout) panel_4.getLayout(); flowLayout_2.setAlignment(FlowLayout.LEFT); GridBagConstraints gbc_panel_4 = new GridBagConstraints(); gbc_panel_4.anchor = GridBagConstraints.WEST; gbc_panel_4.insets = new Insets(0, 0, 5, 5); gbc_panel_4.gridx = 0; gbc_panel_4.gridy = 2; jPanelDetail.add(panel_4, gbc_panel_4); JLabel lblFastDateFormat = new JLabel("FastDateFormat"); panel_4.add(lblFastDateFormat); textField = new JTextField(); panel_4.add(textField); textField.setColumns(30); JPanel panel_5 = new JPanel(); FlowLayout flowLayout_3 = (FlowLayout) panel_5.getLayout(); flowLayout_3.setAlignment(FlowLayout.LEFT); GridBagConstraints gbc_panel_5 = new GridBagConstraints(); gbc_panel_5.insets = new Insets(0, 0, 5, 5); gbc_panel_5.fill = GridBagConstraints.BOTH; gbc_panel_5.gridx = 0; gbc_panel_5.gridy = 3; jPanelDetail.add(panel_5, gbc_panel_5); JLabel lblSampleLabel = new JLabel("Sample"); panel_5.add(lblSampleLabel); JPanel panel_6 = new JPanel(); panel_6.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); GridBagConstraints gbc_panel_6 = new GridBagConstraints(); gbc_panel_6.ipady = 1; gbc_panel_6.ipadx = 1; gbc_panel_6.insets = new Insets(0, 0, 5, 5); gbc_panel_6.fill = GridBagConstraints.BOTH; gbc_panel_6.gridx = 0; gbc_panel_6.gridy = 4; jPanelDetail.add(panel_6, gbc_panel_6); panel_6.setLayout(new BorderLayout(0, 0)); JTextPane textPane = new JTextPane(); textPane.setBackground(UIManager.getColor("windowBorder")); panel_6.add(textPane); GridBagConstraints gbc_btnSave = new GridBagConstraints(); gbc_btnSave.anchor = GridBagConstraints.WEST; gbc_btnSave.insets = new Insets(0, 0, 0, 5); gbc_btnSave.gridx = 0; gbc_btnSave.gridy = 5; jPanelDetail.add(btnSave, gbc_btnSave); reloadTable(); }
From source file:CheckBoxList.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (value instanceof CheckBoxListEntry) { CheckBoxListEntry checkbox = (CheckBoxListEntry) value; checkbox.setBackground(isSelected ? list.getSelectionBackground() : list.getBackground()); if (checkbox.isRed()) { checkbox.setForeground(Color.red); } else {/*from ww w .j a v a 2 s.c o m*/ checkbox.setForeground(isSelected ? list.getSelectionForeground() : list.getForeground()); } checkbox.setEnabled(isEnabled()); checkbox.setFont(getFont()); checkbox.setFocusPainted(false); checkbox.setBorderPainted(true); checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder); return checkbox; } else { return super.getListCellRendererComponent(list, value.getClass().getName(), index, isSelected, cellHasFocus); } }
From source file:com.projity.pm.graphic.chart.TimeChartPanel.java
public void configureScrollPaneHeaders(JScrollPane scrollPane, JComponent rowHeader) { viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) return;//from ww w . j a v a 2 s .c o m JViewport vp = new JViewport(); vp.setView(rowHeader); vp.setPreferredSize(rowHeader.getPreferredSize()); scrollPane.setRowHeader(vp); scrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, new ChartCorner(this)); Border border = scrollPane.getBorder(); if (border == null || border instanceof UIResource) { scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } // left scale synchro viewport.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { updateTimeScaleComponentSize(); } }); }
From source file:TableCellRenderTest.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { setBackground((Color) value); if (hasFocus) setBorder(UIManager.getBorder("Table.focusCellHighlightBorder")); else/*www . j a v a2 s. c o m*/ setBorder(null); return this; }
From source file:ExpenseReport.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (value instanceof Boolean) { Boolean b = (Boolean) value; setSelected(b.booleanValue());//from w w w. j a va2 s .co m } setBackground(isSelected && !hasFocus ? table.getSelectionBackground() : table.getBackground()); setForeground(isSelected && !hasFocus ? table.getSelectionForeground() : table.getForeground()); setFont(table.getFont()); setBorder(hasFocus ? UIManager.getBorder("Table.focusCellHighlightBorder") : m_noFocusBorder); return this; }
From source file:edu.ku.brc.stats.StatGroupTable.java
/** * Constructor with the localized name of the Group * @param name name of the group (already been localized) * @param useSeparator use non-border separator titles *///from w w w . j a va 2 s . c o m public StatGroupTable(final String name, final String[] columnNames, final boolean useSeparator, final int numRows) { this.name = name; this.useSeparator = useSeparator; this.skinItem = SkinsMgr.getSkinItem("StatGroup"); if (progressIcon == null) { progressIcon = IconManager.getIcon("Progress", IconManager.IconSize.Std16); } setLayout(new BorderLayout()); setBackground(Color.WHITE); model = new StatGroupTableModel(this, columnNames); //table = numRows > SCROLLPANE_THRESOLD ? (new SortableJTable(new SortableTableModel(model))) : (new JTable(model)); if (numRows > SCROLLPANE_THRESOLD) { table = new SortableJTable(new SortableTableModel(model)) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } else { table = new JTable(model) { protected void configureEnclosingScrollPane() { Container p = getParent(); if (p instanceof JViewport) { Container gp = p.getParent(); if (gp instanceof JScrollPane) { JScrollPane scrollPane = (JScrollPane) gp; // Make certain we are the viewPort's view and not, for // example, the rowHeaderView of the scrollPane - // an implementor of fixed columns might do this. JViewport viewport = scrollPane.getViewport(); if (viewport == null || viewport.getView() != this) { return; } // scrollPane.setColumnHeaderView(getTableHeader()); //scrollPane.getViewport().setBackingStoreEnabled(true); scrollPane.setBorder(UIManager.getBorder("Table.scrollPaneBorder")); } } } }; } table.setShowVerticalLines(false); table.setShowHorizontalLines(false); if (SkinsMgr.shouldBeOpaque(skinItem)) { table.setOpaque(false); setOpaque(false); } else { table.setOpaque(true); setOpaque(true); } table.addMouseMotionListener(new TableMouseMotion()); table.addMouseListener(new LinkListener()); if (table.getColumnModel().getColumnCount() == 1) { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.CENTER, 1)); } else { table.getColumnModel().getColumn(0) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.LEFT, 2)); table.getColumnModel().getColumn(1) .setCellRenderer(new StatGroupTableCellRenderer(SwingConstants.RIGHT, 2)); } //table.setRowSelectionAllowed(true); if (numRows > SCROLLPANE_THRESOLD) { scrollPane = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); if (table instanceof SortableJTable) { ((SortableJTable) table).installColumnHeaderListeners(); } scrollPane.setOpaque(false); scrollPane.getViewport().setOpaque(false); scrollPane.setBorder(BorderFactory.createEmptyBorder()); //scrollPane.getViewport().setBorder(BorderFactory.createEmptyBorder()); } if (useSeparator) { setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); CellConstraints cc = new CellConstraints(); if (StringUtils.isNotEmpty(name)) { builder.addSeparator(name, cc.xy(1, 1)); } builder.add(scrollPane != null ? scrollPane : table, cc.xy(1, 2)); builder.getPanel().setOpaque(false); add(builder.getPanel()); } else { setBorder(BorderFactory.createEmptyBorder(15, 2, 2, 2)); setBorder(BorderFactory.createCompoundBorder(new CurvedBorder(new Color(160, 160, 160)), getBorder())); add(scrollPane != null ? scrollPane : table, BorderLayout.CENTER); } }
From source file:it.isislab.dmason.tools.batch.BatchWizard.java
/** * Create the frame.//from w w w. j a v a 2s .com */ public BatchWizard() { setPreferredSize(new Dimension(800, 600)); setTitle("Batch wizard"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 849, 620); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new GridLayout(1, 0, 0, 0)); JPanel panel = new JPanel(); panel.setToolTipText(""); contentPane.add(panel); panel_1 = new JPanel(); panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Param Option", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); JPanel panel_2 = new JPanel(); panel_2.setBorder( new TitledBorder(null, "Params List", TitledBorder.LEADING, TitledBorder.TOP, null, null)); JPanel panel_3 = new JPanel(); JPanel panel_4 = new JPanel(); GroupLayout gl_panel = new GroupLayout(panel); gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel .createSequentialGroup().addContainerGap() .addComponent( panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel.createSequentialGroup() .addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE).addGap(20)) .addGroup(gl_panel.createSequentialGroup() .addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE).addGap(4)))) .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 823, Short.MAX_VALUE)); gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel .createSequentialGroup() .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel.createSequentialGroup() .addComponent(panel_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(25) .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)) .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); final JButton btnSave = new JButton("Save"); btnSave.setEnabled(false); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { File saveFile = SaveFileChooser(); createXML(saveFile.getAbsoluteFile().getPath()); } }); lblTotTests = new JLabel(totTestsMessage); GroupLayout gl_panel_4 = new GroupLayout(panel_4); gl_panel_4.setHorizontalGroup(gl_panel_4.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_4.createSequentialGroup().addGap(21).addComponent(lblTotTests) .addPreferredGap(ComponentPlacement.RELATED, 515, Short.MAX_VALUE).addComponent(btnSave) .addGap(21))); gl_panel_4.setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_4.createSequentialGroup().addContainerGap() .addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE).addComponent(btnSave) .addComponent(lblTotTests)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_4.setLayout(gl_panel_4); top = new DefaultMutableTreeNode("Parameters"); JScrollPane scrollPaneTree = new JScrollPane(); JLabel lblNumberOfWorkers = new JLabel("Number of Workers:"); textFieldNumberOfWorkers = new JTextField(); textFieldNumberOfWorkers.setText("1"); textFieldNumberOfWorkers.setColumns(10); textFieldNumberOfWorkers.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { if (textFieldNumberOfWorkers.isVisible()) { boolean checkNumberOfWorkers = true; while (checkNumberOfWorkers) { String dist = textFieldNumberOfWorkers.getText(); boolean validateDist = dist.matches("(\\d)+"); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldNumberOfWorkers.setText(newDist); } else { checkNumberOfWorkers = false; } } } } }); checkBoxLoadBalancing = new JCheckBox("Load Balancing", false); checkBoxLoadBalancing.setEnabled(true); GroupLayout gl_panel_2 = new GroupLayout(panel_2); gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_2 .createSequentialGroup().addContainerGap() .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING) .addComponent(scrollPaneTree, GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE) .addGroup(gl_panel_2.createSequentialGroup().addComponent(lblNumberOfWorkers) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(textFieldNumberOfWorkers, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)) .addComponent(checkBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 114, GroupLayout.PREFERRED_SIZE)) .addContainerGap())); gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_2 .createSequentialGroup().addContainerGap() .addComponent(scrollPaneTree, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE) .addGap(33) .addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE).addComponent(lblNumberOfWorkers) .addComponent(textFieldNumberOfWorkers, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(checkBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE) .addContainerGap(56, Short.MAX_VALUE))); final JTree treeParams = new JTree(top); scrollPaneTree.setViewportView(treeParams); treeParams.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent selected) { // DefaultMutableTreeNode parent = // selected.getPath().getParentPath() DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeParams.getLastSelectedPathComponent(); if (node.getParent() != null) { if (node.getParent() == simParams || node.getParent().equals(generalParams)) { selectedParam = (Param) node.getUserObject(); if (node.getParent() == simParams) { selectedParamIndex = simParams.getIndex(node); paramType = "simParam"; } else { selectedParamIndex = generalParams.getIndex(node); paramType = "generalParam"; } if (selectedParam instanceof ParamFixed) { ParamFixed pf = (ParamFixed) selectedParam; lblParamType.setText(pf.getName() + ": " + pf.getType()); if (suggestion.get(pf.getName()) != null) { lblDomain.setText("Domain: " + suggestion.get(pf.getName()).getDomain()); lblSuggested.setText( "Suggested Value: " + suggestion.get(pf.getName()).getSuggestedValue()); } textFieldRuns.setText("" + pf.getRuns()); textFieldValue.setText(pf.getValue()); rdbtnFixed.doClick(); lblMessage.setVisible(false); setModifyControlEnable(true); } if (selectedParam instanceof ParamRange) { ParamRange pf = (ParamRange) selectedParam; lblParamType.setText(pf.getName() + ": " + pf.getType()); if (suggestion.get(pf.getName()) != null) { lblDomain.setText("Domain: " + suggestion.get(pf.getName()).getDomain()); lblSuggested.setText( "Suggested Value: " + suggestion.get(pf.getName()).getSuggestedValue()); } textFieldRuns.setText("" + pf.getRuns()); textFieldStartValue.setText(pf.getStart()); textFieldEndValue.setText(pf.getEnd()); textFieldIncrement.setText(pf.getIncrement()); rdbtnRange.doClick(); lblMessage.setVisible(false); setModifyControlEnable(true); } if (selectedParam instanceof ParamList) { ParamList pl = (ParamList) selectedParam; if (suggestion.get(pl.getName()) != null) { lblDomain.setText("Domain: " + suggestion.get(pl.getName()).getDomain()); lblSuggested.setText( "Suggested Value: " + suggestion.get(pl.getName()).getSuggestedValue()); } lblParamType.setText(pl.getName() + ": " + pl.getType()); textFieldRuns.setText("" + pl.getRuns()); StringBuilder b = new StringBuilder(); boolean isFirst = true; for (String element : pl.getValues()) { if (isFirst) { b.append(element); isFirst = false; } else b.append("," + element); } textFieldList.setText(b.toString()); rdbtnByvalues.doClick(); setListControlvisibility(true); lblMessage.setVisible(false); setModifyControlEnable(true); } if (selectedParam instanceof ParamDistribution) { DistributionType distType = DistributionType.none; if (selectedParam instanceof ParamDistributionUniform) { ParamDistributionUniform pu = (ParamDistributionUniform) selectedParam; lblParamType.setText(pu.getName() + ": " + pu.getType()); if (suggestion.get(pu.getName()) != null) { lblDomain.setText("Domain: " + suggestion.get(pu.getName()).getDomain()); lblSuggested.setText( "Suggested Value: " + suggestion.get(pu.getName()).getSuggestedValue()); } textFieldRuns.setText("" + pu.getRuns()); textFieldA.setText(pu.getA()); textFieldB.setText(pu.getB()); textFieldNumberOfValues.setText("" + pu.getNumberOfValues()); distType = DistributionType.uniform; } if (selectedParam instanceof ParamDistributionExponential) { ParamDistributionExponential pe = (ParamDistributionExponential) selectedParam; lblParamType.setText(pe.getName() + ": " + pe.getType()); if (suggestion.get(pe.getName()) != null) { lblDomain.setText("Domain: " + suggestion.get(pe.getName()).getDomain()); lblSuggested.setText( "Suggested Value: " + suggestion.get(pe.getName()).getSuggestedValue()); } textFieldRuns.setText("" + pe.getRuns()); textFieldA.setText(pe.getLambda()); textFieldNumberOfValues.setText("" + pe.getNumberOfValues()); distType = DistributionType.exponential; } if (selectedParam instanceof ParamDistributionNormal) { ParamDistributionNormal pn = (ParamDistributionNormal) selectedParam; lblParamType.setText(pn.getName() + ": " + pn.getType()); if (suggestion.get(pn.getName()) != null) { lblDomain.setText("Domain: " + suggestion.get(pn.getName()).getDomain()); lblSuggested.setText( "Suggested Value: " + suggestion.get(pn.getName()).getSuggestedValue()); } textFieldRuns.setText("" + pn.getRuns()); textFieldA.setText(pn.getMean()); textFieldB.setText(pn.getStdDev()); textFieldNumberOfValues.setText("" + pn.getNumberOfValues()); distType = DistributionType.normal; } rdbtnByDistribution.doClick(); setDistributionControlVisibility(distType); setDistributionComboBoxVisibility(true); lblMessage.setVisible(false); setModifyControlEnable(true); } } } } }); panel_2.setLayout(gl_panel_2); JLabel lblSelectSimulationJar = new JLabel("Select simulation jar:"); textFieldSimJarPath = new JTextField(); textFieldSimJarPath.setColumns(10); btnLoadParams = new JButton("Load Params"); btnLoadParams.setEnabled(false); btnLoadParams.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ArrayList<Param> params = loadParams(); if (params != null) { top.removeAllChildren(); createNodes(top, params); treeParams.expandPath(new TreePath(top.getPath())); treeParams.expandPath(new TreePath(simParams.getPath())); treeParams.expandPath(new TreePath(generalParams.getPath())); } lblTotTests.setText(totTestsMessage + " " + getTotTests()); btnSave.setEnabled(true); } }); JButton bntChooseSimulation = new JButton(); bntChooseSimulation.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { simulationFile = showFileChooser(); if (simulationFile != null) { textFieldSimJarPath.setText(simulationFile.getAbsolutePath()); btnLoadParams.setEnabled(true); isThin = isThinSimulation(simulationFile); checkBoxLoadBalancing.setEnabled(!isThin); } } }); bntChooseSimulation.setIcon( new ImageIcon(BatchWizard.class.getResource("/it.isislab.dmason/resource/image/openFolder.png"))); GroupLayout gl_panel_3 = new GroupLayout(panel_3); gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3 .createSequentialGroup().addContainerGap().addComponent(lblSelectSimulationJar) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textFieldSimJarPath, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(bntChooseSimulation, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE) .addGap(26).addComponent(btnLoadParams).addContainerGap(172, Short.MAX_VALUE))); gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3 .createSequentialGroup().addContainerGap() .addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3 .createParallelGroup(Alignment.BASELINE).addComponent(lblSelectSimulationJar) .addComponent(textFieldSimJarPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(bntChooseSimulation, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)) .addComponent(btnLoadParams)) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); panel_3.setLayout(gl_panel_3); lblParamType = new JLabel("Param : type"); lblParamType.setFont(new Font("Tahoma", Font.BOLD, 11)); JLabel lblRuns = new JLabel("Runs:"); textFieldRuns = new JTextField(); textFieldRuns.setColumns(10); textFieldRuns.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { if (textFieldRuns.isVisible()) { boolean checkRuns = true; while (checkRuns) { String dist = textFieldRuns.getText(); boolean validateDist = dist.matches("(\\d)+"); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldRuns.setText(newDist); } else { checkRuns = false; } } } } }); JLabel lblParameterSpace = new JLabel("Parameter Space"); lblParameterSpace.setFont(new Font("Tahoma", Font.BOLD, 11)); lblValue = new JLabel("Value:"); textFieldValue = new JTextField(); textFieldValue.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { String regex = "(\\d)+|((\\d)+\\.(\\d)+)"; if (textFieldValue.isVisible()) { boolean checkValue = true; while (checkValue) { String dist = textFieldValue.getText(); boolean validateDist = dist.matches(regex); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldValue.setText(newDist); } else { checkValue = false; } } } } }); textFieldValue.setColumns(10); /*textFieldValue.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent arg0) {} @Override public void keyReleased(KeyEvent arg0) { checkError(); } @Override public void keyPressed(KeyEvent arg0) {} }); */ lblStartValue = new JLabel("Start value:"); textFieldStartValue = new JTextField(); textFieldStartValue.setText("1"); textFieldStartValue.setColumns(10); textFieldStartValue.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { String regex = "(\\d)+|((\\d)+\\.(\\d)+)"; if (textFieldStartValue.isVisible()) { boolean checkStartValue = true; while (checkStartValue) { String dist = textFieldStartValue.getText(); boolean validateDist = dist.matches(regex); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldStartValue.setText(newDist); } else { checkStartValue = false; } } } } }); lblEndValue = new JLabel("End value:"); textFieldEndValue = new JTextField(); textFieldEndValue.setText("1"); textFieldEndValue.setColumns(10); textFieldEndValue.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { String regex = "(\\d)+|((\\d)+\\.(\\d)+)"; if (textFieldEndValue.isVisible()) { boolean checkEndValue = true; while (checkEndValue) { String dist = textFieldEndValue.getText(); boolean validateDist = dist.matches(regex); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldEndValue.setText(newDist); } else { checkEndValue = false; } } } } }); lblIncrement = new JLabel("Increment:"); textFieldIncrement = new JTextField(); textFieldIncrement.setText("1"); textFieldIncrement.setColumns(10); textFieldIncrement.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { String regex = "(\\d)+|((\\d)+\\.(\\d)+)"; if (textFieldIncrement.isVisible()) { boolean checkIncrement = true; while (checkIncrement) { String dist = textFieldIncrement.getText(); boolean validateDist = dist.matches(regex); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldIncrement.setText(newDist); } else { checkIncrement = false; } } } } }); rdbtnFixed = new JRadioButton("Fixed"); rdbtnFixed.setSelected(true); rdbtnFixed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { setListControlvisibility(false); setDistributionComboBoxVisibility(false); setRangeControlVisibility(false); setFixedControlVisibility(true); setDistributionControlVisibility(DistributionType.none); } }); rdbtnRange = new JRadioButton("Range"); rdbtnRange.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setRangeControlVisibility(true); setFixedControlVisibility(false); setListControlvisibility(false); setDistributionComboBoxVisibility(false); setDistributionControlVisibility(DistributionType.none); } }); rdbtnByvalues = new JRadioButton("By Values"); rdbtnByvalues.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setRangeControlVisibility(false); setFixedControlVisibility(false); setListControlvisibility(true); setDistributionComboBoxVisibility(false); setDistributionControlVisibility(DistributionType.none); } }); rdbtnByDistribution = new JRadioButton("By Distribution"); rdbtnByDistribution.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setRangeControlVisibility(false); setFixedControlVisibility(false); setListControlvisibility(false); setDistributionComboBoxVisibility(true); setDistributionControlVisibility(DistributionType.none); } }); // Group the radio buttons. ButtonGroup group = new ButtonGroup(); group.add(rdbtnFixed); group.add(rdbtnRange); group.add(rdbtnByvalues); group.add(rdbtnByDistribution); setRangeControlVisibility(false); setFixedControlVisibility(false); lblMessage = new JLabel(message); btnModify = new JButton("Modify"); btnModify.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { if (rdbtnFixed.isSelected()) { ParamFixed param = new ParamFixed(selectedParam.getName(), selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()), textFieldValue.getText()); DefaultMutableTreeNode p = new DefaultMutableTreeNode(param); if (paramType.equals("simParam")) { simParams.remove(selectedParamIndex); simParams.insert(p, selectedParamIndex); } else { generalParams.remove(selectedParamIndex); generalParams.insert(p, selectedParamIndex); } treeParams.updateUI(); /* * ((ParamFixed) * selectedParam).setValue(textFieldValue.getText()); * selectedParam * .setRuns(Integer.parseInt(textFieldRuns.getText())); * treeParams.repaint(); */ } if (rdbtnRange.isSelected()) { ParamRange param = new ParamRange(selectedParam.getName(), selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()), textFieldStartValue.getText(), textFieldEndValue.getText(), textFieldIncrement.getText()); DefaultMutableTreeNode p = new DefaultMutableTreeNode(param); if (paramType.equals("simParam")) { simParams.remove(selectedParamIndex); simParams.insert(p, selectedParamIndex); } else { generalParams.remove(selectedParamIndex); generalParams.insert(p, selectedParamIndex); } treeParams.updateUI(); // treeParams.repaint(); } if (rdbtnByvalues.isSelected()) { StringTokenizer st = new StringTokenizer(textFieldList.getText(), ","); ArrayList<String> values = new ArrayList<String>(); while (st.hasMoreTokens()) values.add(st.nextToken()); ParamList param = new ParamList(selectedParam.getName(), selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()), values); DefaultMutableTreeNode p = new DefaultMutableTreeNode(param); if (paramType.equals("simParam")) { simParams.remove(selectedParamIndex); simParams.insert(p, selectedParamIndex); } else { generalParams.remove(selectedParamIndex); generalParams.insert(p, selectedParamIndex); } treeParams.updateUI(); // treeParams.repaint(); } if (rdbtnByDistribution.isSelected()) { DefaultMutableTreeNode p; switch (selectedDistribution) { case uniform: p = new DefaultMutableTreeNode( new ParamDistributionUniform(selectedParam.getName(), selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(), textFieldB.getText(), Integer.parseInt(textFieldNumberOfValues.getText()))); break; case exponential: p = new DefaultMutableTreeNode(new ParamDistributionExponential(selectedParam.getName(), selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(), Integer.parseInt(textFieldNumberOfValues.getText()))); break; case normal: p = new DefaultMutableTreeNode( new ParamDistributionNormal(selectedParam.getName(), selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(), textFieldA.getText(), Integer.parseInt(textFieldNumberOfValues.getText()))); break; default: p = new DefaultMutableTreeNode(); break; } if (paramType.equals("simParam")) { simParams.remove(selectedParamIndex); simParams.insert(p, selectedParamIndex); } else { generalParams.remove(selectedParamIndex); generalParams.insert(p, selectedParamIndex); } treeParams.updateUI(); // treeParams.repaint(); } lblMessage.setVisible(true); setModifyControlEnable(false); setDistributionControlVisibility(DistributionType.none); setDistributionComboBoxVisibility(false); setListControlvisibility(false); int tot = getTotTests(); if (tot >= testAlertThreshold) lblTotTests.setForeground(Color.RED); else lblTotTests.setForeground(Color.BLACK); lblTotTests.setText(totTestsMessage + " " + tot); } }); btnCancel = new JButton("Cancel"); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { lblMessage.setVisible(true); setModifyControlEnable(false); } }); lblCommaSeparatedList = new JLabel("List:"); lblCommaSeparatedList.setVisible(false); textFieldList = new JTextField(); textFieldList.setVisible(false); textFieldList.setToolTipText("Comma separated"); textFieldList.setColumns(10); textFieldList.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { /*if(textFieldList.isVisible()) { boolean checkList=true; while(checkList){ String dist=textFieldList.getText(); boolean validateDist=dist.matches("(\\d)+|((\\d)+\\.(\\d)+)(,(\\d)+|((\\d)+\\.(\\d)+))*"); if(!validateDist){ String newDist= JOptionPane.showInputDialog(null,"Insert comma separate number list","Number Format Error", 0); textFieldList.setText(newDist); } else{ checkList=false; } } }*/ } }); lblDistribution = new JLabel("Distribution"); lblDistribution.setVisible(false); lblA = new JLabel("a:"); lblA.setVisible(false); textFieldA = new JTextField(); textFieldA.setText("1"); textFieldA.setVisible(false); textFieldA.setColumns(10); textFieldA.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { String regex = "(\\d)+|((\\d)+\\.(\\d)+)"; if (textFieldA.isVisible()) { boolean checkA = true; while (checkA) { String dist = textFieldA.getText(); boolean validateDist = dist.matches(regex); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldA.setText(newDist); } else { checkA = false; } } } } }); lblB = new JLabel("b:"); lblB.setVisible(false); textFieldB = new JTextField(); textFieldB.setText("1"); textFieldB.setVisible(false); textFieldB.setColumns(10); textFieldB.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { String regex = "(\\d)+|((\\d)+\\.(\\d)+)"; if (textFieldB.isVisible()) { boolean checkB = true; while (checkB) { String dist = textFieldB.getText(); boolean validateDist = dist.matches(regex); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldB.setText(newDist); } else { checkB = false; } } } } }); jComboBoxDistribution = new JComboBox(); jComboBoxDistribution.setVisible(false); jComboBoxDistribution.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { // Prevent executing listener's actions two times if (e.getStateChange() != ItemEvent.SELECTED) return; selectedDistribution = ((DistributionType) jComboBoxDistribution.getSelectedItem()); setDistributionControlVisibility(DistributionType.none); setDistributionControlVisibility(selectedDistribution); } }); lblOfValues = new JLabel("# of values:"); lblOfValues.setVisible(false); textFieldNumberOfValues = new JTextField(); textFieldNumberOfValues.setText("1"); textFieldNumberOfValues.setVisible(false); textFieldNumberOfValues.setColumns(10); textFieldNumberOfValues.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent arg0) { if (textFieldNumberOfValues.isVisible()) { boolean checkNumberOfValues = true; while (checkNumberOfValues) { String dist = textFieldNumberOfValues.getText(); boolean validateDist = dist.matches("(\\d)+"); if (!validateDist) { String newDist = JOptionPane.showInputDialog(null, "Insert a number", "Number Format Error", 0); textFieldNumberOfValues.setText(newDist); } else { checkNumberOfValues = false; } } } } }); lblSuggested = new JLabel("Suggested Value:"); lblDomain = new JLabel("Domain:"); GroupLayout gl_panel_1 = new GroupLayout(panel_1); gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel_1 .createSequentialGroup().addContainerGap() .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel_1 .createSequentialGroup() .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addComponent(lblParamType) .addComponent(lblMessage).addComponent(lblSuggested)) .addContainerGap(77, Short.MAX_VALUE)) .addGroup(gl_panel_1.createSequentialGroup().addComponent(btnModify) .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnCancel) .addContainerGap()) .addGroup(gl_panel_1.createSequentialGroup().addGroup(gl_panel_1 .createParallelGroup(Alignment.LEADING).addComponent(lblParameterSpace) .addGroup(gl_panel_1.createSequentialGroup() .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING) .addComponent(rdbtnFixed).addComponent(rdbtnRange)) .addGap(31) .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING) .addComponent(rdbtnByDistribution).addComponent(rdbtnByvalues))) .addGroup(gl_panel_1.createSequentialGroup().addGroup(gl_panel_1 .createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblValue) .addPreferredGap(ComponentPlacement.RELATED, 59, Short.MAX_VALUE) .addComponent(textFieldValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(Alignment.LEADING, gl_panel_1.createSequentialGroup().addComponent(lblStartValue) .addPreferredGap(ComponentPlacement.RELATED, 46, Short.MAX_VALUE) .addComponent(textFieldStartValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_1.createSequentialGroup() .addComponent(lblCommaSeparatedList) .addPreferredGap(ComponentPlacement.RELATED, 69, Short.MAX_VALUE) .addComponent(textFieldList, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_1.createSequentialGroup() .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING) .addComponent(lblEndValue).addComponent(lblIncrement) .addComponent(lblDistribution)) .addGap(45) .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING) .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING) .addGroup(gl_panel_1 .createParallelGroup(Alignment.LEADING, false) .addComponent(jComboBoxDistribution, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(textFieldA, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(textFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addComponent(textFieldIncrement, 89, 89, 89)) .addComponent(textFieldEndValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))) .addPreferredGap(ComponentPlacement.RELATED, 8, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblA).addPreferredGap( ComponentPlacement.RELATED, 173, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblB).addPreferredGap( ComponentPlacement.RELATED, 173, GroupLayout.PREFERRED_SIZE)) .addComponent(lblOfValues) .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblRuns) .addPreferredGap(ComponentPlacement.RELATED) .addComponent(textFieldRuns, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(ComponentPlacement.RELATED, 65, GroupLayout.PREFERRED_SIZE))) .addGap(35)) .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblDomain).addContainerGap(186, Short.MAX_VALUE))))); gl_panel_1.setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_1 .createSequentialGroup().addGap(4).addComponent(lblMessage).addGap(18).addComponent(lblParamType) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblSuggested) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblDomain).addGap(7) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblRuns).addComponent( textFieldRuns, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblParameterSpace) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnFixed) .addComponent(rdbtnByvalues)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnRange) .addComponent(rdbtnByDistribution)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE) .addComponent(textFieldValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblValue)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE) .addComponent(textFieldList, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblCommaSeparatedList)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblStartValue) .addComponent(textFieldStartValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblEndValue).addComponent( textFieldEndValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE) .addComponent(textFieldIncrement, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblIncrement)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE) .addComponent(jComboBoxDistribution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(lblDistribution)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel_1 .createParallelGroup(Alignment.BASELINE).addComponent(lblA).addComponent(textFieldA, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED) .addGroup(gl_panel_1 .createParallelGroup(Alignment.BASELINE).addComponent(lblB).addComponent(textFieldB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.UNRELATED) .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblOfValues).addComponent( textFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(ComponentPlacement.RELATED, 18, Short.MAX_VALUE).addGroup(gl_panel_1 .createParallelGroup(Alignment.BASELINE).addComponent(btnModify).addComponent(btnCancel)))); panel_1.setLayout(gl_panel_1); panel.setLayout(gl_panel); setModifyControlEnable(false); loadDistribution(); }
From source file:com.mgmtp.perfload.loadprofiles.ui.AppFrame.java
/** * Creates the frame./*from www. j a v a 2s . com*/ * * @param configController * the config controller * @param loadProfilesController * the load profiles controller */ @Inject public AppFrame(final ConfigController configController, final LoadProfilesController loadProfilesController, @AppVersion final String appVersion) { this.loadProfilesController = loadProfilesController; this.configController = configController; this.appVersion = appVersion; ThisWindowListener windowAdapter = new ThisWindowListener(); addWindowStateListener(windowAdapter); addWindowListener(windowAdapter); addComponentListener(new ThisComponentListener()); initComponents(); initModels(); cardLayout.show(pnlCard, "none"); { chartPanel = new ChartPanel((JFreeChart) null); contentPane.add(chartPanel, "cell 0 2 2 1,grow"); chartPanel.setBorder(new CompoundBorder( new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Load Profiles", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)), new CompoundBorder(new EmptyBorder(4, 4, 4, 4), new EtchedBorder(EtchedBorder.LOWERED, null, null)))); chartPanel.setName("chartPanel"); chartPanel.setPopupMenu(null); } String fileName = configController.getAppProperties().getProperty("lpConfig.file"); if (fileName != null) { loadProfileConfigFile = new File(fileName); } fileName = configController.getAppProperties().getProperty("lpEvents.file"); if (fileName != null) { loadProfileEventsFile = new File(fileName); } }
From source file:net.sf.vfsjfilechooser.filepane.VFSFilePane.java
protected void installDefaults() { listViewBorder = UIManager.getBorder("FileChooser.listViewBorder"); listViewBackground = UIManager.getColor("FileChooser.listViewBackground"); listViewWindowsStyle = UIManager.getBoolean("FileChooser.listViewWindowsStyle"); readOnly = UIManager.getBoolean("FileChooser.readOnly"); // TODO: On windows, get the following localized strings from the OS viewMenuLabelText = VFSResources.getMessage("VFSJFileChooser.viewMenuLabelText"); refreshActionLabelText = VFSResources.getMessage("VFSJFileChooser.refreshActionLabelText"); newFolderActionLabelText = VFSResources.getMessage("VFSJFileChooser.newFolderActionLabelText"); viewTypeActionNames = new String[VIEWTYPE_COUNT]; viewTypeActionNames[VIEWTYPE_LIST] = VFSResources.getMessage("VFSJFileChooser.listViewActionLabelText"); viewTypeActionNames[VIEWTYPE_DETAILS] = VFSResources .getMessage("VFSJFileChooser.detailsViewActionLabelText"); renameErrorTitleText = VFSResources.getMessage("VFSJFileChooser.renameErrorTitleText"); renameErrorText = VFSResources.getMessage("VFSJFileChooser.renameErrorText"); renameErrorFileExistsText = VFSResources.getMessage("VFSJFileChooser.renameErrorFileExistsText"); fileNameHeaderText = VFSResources.getMessage("VFSJFileChooser.fileNameHeaderText"); fileSizeHeaderText = VFSResources.getMessage("VFSJFileChooser.fileSizeHeaderText"); fileDateHeaderText = VFSResources.getMessage("VFSJFileChooser.fileDateHeaderText"); }