List of usage examples for javax.swing Box createHorizontalStrut
public static Component createHorizontalStrut(int width)
From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGuiClassifier.java
protected JPanel getProtocolAndMethodPanel() { // Implementation if (showImplementation) { httpImplementation = new JLabeledChoice(JMeterUtils.getResString("http_implementation"), // $NON-NLS-1$ HTTPSamplerFactory.getImplementations()); httpImplementation.addValue(""); }/*from ww w. j a v a 2 s. c om*/ // PROTOCOL protocol = new JTextField(4); JLabel protocolLabel = new JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$ protocolLabel.setLabelFor(protocol); // CONTENT_ENCODING contentEncoding = new JTextField(10); JLabel contentEncodingLabel = new JLabel(JMeterUtils.getResString("content_encoding")); // $NON-NLS-1$ contentEncodingLabel.setLabelFor(contentEncoding); if (notConfigOnly) { method = new JLabeledChoice(JMeterUtils.getResString("method"), // $NON-NLS-1$ HTTPSamplerBase.getValidMethodsAsArray()); } JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); if (showImplementation) { panel.add(httpImplementation); } panel.add(protocolLabel); panel.add(protocol); panel.add(Box.createHorizontalStrut(5)); if (notConfigOnly) { panel.add(method); } panel.setMinimumSize(panel.getPreferredSize()); panel.add(Box.createHorizontalStrut(5)); panel.add(contentEncodingLabel); panel.add(contentEncoding); panel.setMinimumSize(panel.getPreferredSize()); return panel; }
From source file:org.apache.jmeter.protocol.system.gui.SystemSamplerGui.java
/** * @return JPanel return code config//from ww w . j av a 2 s . co m */ private JPanel makeReturnCodePanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("return_code_config_box_title"))); // $NON-NLS-1$ checkReturnCode = new JCheckBox(JMeterUtils.getResString("check_return_code_title")); // $NON-NLS-1$ checkReturnCode.addItemListener(this); desiredReturnCode = new JLabeledTextField(JMeterUtils.getResString("expected_return_code_title")); // $NON-NLS-1$ desiredReturnCode.setSize(desiredReturnCode.getSize().height, 30); panel.add(checkReturnCode); panel.add(Box.createHorizontalStrut(5)); panel.add(desiredReturnCode); checkReturnCode.setSelected(true); return panel; }
From source file:org.apache.jmeter.testbeans.gui.GenericTestBeanCustomizer.java
/** * Initialize the GUI.//w ww. j a v a 2 s. c o m */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) setLayout(new GridBagLayout()); GridBagConstraints cl = new GridBagConstraints(); // for labels cl.gridx = 0; cl.anchor = GridBagConstraints.EAST; cl.insets = new Insets(0, 1, 0, 1); GridBagConstraints ce = new GridBagConstraints(); // for editors ce.fill = GridBagConstraints.BOTH; ce.gridx = 1; ce.weightx = 1.0; ce.insets = new Insets(0, 1, 0, 1); GridBagConstraints cp = new GridBagConstraints(); // for panels cp.fill = GridBagConstraints.BOTH; cp.gridx = 1; cp.gridy = GridBagConstraints.RELATIVE; cp.gridwidth = 2; cp.weightx = 1.0; JPanel currentPanel = this; String currentGroup = DEFAULT_GROUP; int y = 0; for (int i = 0; i < editors.length; i++) { if (editors[i] == null) { continue; } if (log.isDebugEnabled()) { log.debug("Laying property " + descriptors[i].getName()); } String g = group(descriptors[i]); if (!currentGroup.equals(g)) { if (currentPanel != this) { add(currentPanel, cp); } currentGroup = g; currentPanel = new JPanel(new GridBagLayout()); currentPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), groupDisplayName(g))); cp.weighty = 0.0; y = 0; } Component customEditor = editors[i].getCustomEditor(); boolean multiLineEditor = false; if (customEditor.getPreferredSize().height > 50 || customEditor instanceof JScrollPane || descriptors[i].getValue(MULTILINE) != null) { // TODO: the above works in the current situation, but it's // just a hack. How to get each editor to report whether it // wants to grow bigger? Whether the property label should // be at the left or at the top of the editor? ...? multiLineEditor = true; } JLabel label = createLabel(descriptors[i]); label.setLabelFor(customEditor); cl.gridy = y; cl.gridwidth = multiLineEditor ? 2 : 1; cl.anchor = multiLineEditor ? GridBagConstraints.CENTER : GridBagConstraints.EAST; currentPanel.add(label, cl); ce.gridx = multiLineEditor ? 0 : 1; ce.gridy = multiLineEditor ? ++y : y; ce.gridwidth = multiLineEditor ? 2 : 1; ce.weighty = multiLineEditor ? 1.0 : 0.0; cp.weighty += ce.weighty; currentPanel.add(customEditor, ce); y++; } if (currentPanel != this) { add(currentPanel, cp); } // Add a 0-sized invisible component that will take all the vertical // space that nobody wants: cp.weighty = 0.0001; add(Box.createHorizontalStrut(0), cp); }
From source file:org.ciscavate.cjwizard.WizardContainer.java
/** * /*from w w w . j av a 2s.c o m*/ */ private void initComponents() { final JButton prevBtn = new JButton(_prevAction); final JButton nextBtn = new JButton(_nextAction); final JButton finishBtn = new JButton(_finishAction); final JButton cancelBtn = new JButton(_cancelAction); final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(prevBtn); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(nextBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(finishBtn); buttonPanel.add(Box.createHorizontalStrut(10)); buttonPanel.add(cancelBtn); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 15, 5, 15)); this.setLayout(new BorderLayout()); this.add(_template, BorderLayout.CENTER); this.add(buttonPanel, BorderLayout.SOUTH); }
From source file:org.codinjutsu.tools.nosql.couchbase.view.CouchbasePanel.java
private void initToolbar() { toolBarPanel.setLayout(new BorderLayout()); rowLimitField.setColumns(5);//from w ww. ja v a 2 s . c o m rowLimitField.setDocument(new NumberDocument()); rowLimitField.setText("100"); JPanel rowLimitPanel = new NonOpaquePanel(); rowLimitPanel.add(new JLabel("Row limit:"), BorderLayout.WEST); rowLimitPanel.add(rowLimitField, BorderLayout.CENTER); rowLimitPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST); toolBarPanel.add(rowLimitPanel, BorderLayout.WEST); addCommonsActions(); }
From source file:org.codinjutsu.tools.nosql.redis.view.RedisPanel.java
protected void buildQueryToolBar() { toolBarPanel.setLayout(new BorderLayout()); filterField = new JBTextField("*"); filterField.setColumns(10);/*from w ww . ja va 2 s . c o m*/ NonOpaquePanel westPanel = new NonOpaquePanel(); NonOpaquePanel filterPanel = new NonOpaquePanel(); filterPanel.add(new JLabel("Filter: "), BorderLayout.WEST); filterPanel.add(filterField, BorderLayout.CENTER); filterPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST); westPanel.add(filterPanel, BorderLayout.WEST); toolBarPanel.add(westPanel, BorderLayout.WEST); addCommonsActions(); }
From source file:org.colombbus.tangara.AboutWindow.java
private JPanel bodyPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.setOpaque(false);//w ww . jav a 2 s.c o m panel.add(Box.createHorizontalStrut(marginLeft)); panel.add(getTextZone()); panel.add(Box.createHorizontalStrut(marginButton)); panel.add(getCloseButton()); panel.add(Box.createHorizontalStrut(marginButton)); return panel; }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes mainPanel//from www . j av a 2s .co m * * @return javax.swing.JPanel */ private JPanel getMainPanel() { if (mainPanel == null) { mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(getHelpText(), BorderLayout.NORTH); mainPanel.add(Box.createHorizontalStrut(MARGIN_X), BorderLayout.WEST); mainPanel.add(getCentralPanel(), BorderLayout.CENTER); mainPanel.add(Box.createHorizontalStrut(MARGIN_X), BorderLayout.EAST); mainPanel.add(getPanelButtons(), BorderLayout.SOUTH); } return mainPanel; }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes panelButtons/* w ww. j av a2 s. c om*/ * * @return javax.swing.JPanel */ private JPanel getPanelButtons() { if (panelButtons == null) { panelButtons = new JPanel(); panelButtons.setBorder(new EmptyBorder(MARGIN_Y, MARGIN_X, MARGIN_Y, MARGIN_X)); panelButtons.setLayout(new BoxLayout(panelButtons, BoxLayout.X_AXIS)); panelButtons.add(Box.createHorizontalStrut(MARGIN_BUTTON)); panelButtons.add(getLeftButton(), null); panelButtons.add(Box.createHorizontalGlue()); panelButtons.add(getRightButton(), null); panelButtons.add(Box.createHorizontalStrut(MARGIN_BUTTON)); } return panelButtons; }
From source file:org.colombbus.tangara.CommandSelection.java
/** * This method initializes panelSelection * * @return javax.swing.JPanel/* w ww . j ava 2 s . c om*/ */ private JPanel getPanelSelection() { if (panelSelection == null) { panelSelection = new JPanel(); panelSelection.setBorder(new EmptyBorder(MARGIN_Y / 2, MARGIN_X, MARGIN_Y / 2, MARGIN_X)); panelSelection.setLayout(new BoxLayout(panelSelection, BoxLayout.X_AXIS)); panelSelection.add(Box.createHorizontalStrut(MARGIN_BUTTON)); panelSelection.add(getButtonSelectAll()); panelSelection.add(Box.createHorizontalGlue()); panelSelection.add(getButtonSelectNone()); panelSelection.add(Box.createHorizontalStrut(MARGIN_BUTTON)); } return panelSelection; }