List of usage examples for javax.swing JSeparator setMaximumSize
@BeanProperty(description = "The maximum size of the component.") public void setMaximumSize(Dimension maximumSize)
From source file:com.codeasylum.liquibase.Liquidate.java
public Liquidate() { super("Liquidate"); ParaboxLayoutManager layout;//from w w w .jav a2 s . c om ParallelBox goalHorizontalBox; SerialBox sourceHorizontalBox; ParallelBox sourceVerticalBox; SerialBox goalVerticalBox; JSeparator buttonSeparator; JRadioButton[] sourceButtons; JRadioButton[] goalButtons; JLabel databaseLabel; JLabel hostLabel; JLabel colonLabel; JLabel schemaLabel; JLabel userLabel; JLabel passwordLabel; JLabel sourceLabel; JLabel goalLabel; JLabel outputLabel; int sourceIndex = 0; int goalIndex = 0; config = new LiquidateConfig(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLayout(layout = new ParaboxLayoutManager(getContentPane())); databaseLabel = new JLabel("Database:"); databaseCombo = new JComboBox(Database.values()); databaseCombo.addItemListener(this); hostLabel = new JLabel("Host and Port:"); hostTextField = new JTextField(); hostTextField.getDocument().addDocumentListener(this); portTextField = new JTextField(); portTextField.setHorizontalAlignment(JTextField.RIGHT); portTextField.setPreferredSize(new Dimension(50, (int) portTextField.getPreferredSize().getHeight())); portTextField.setMaximumSize(portTextField.getPreferredSize()); portTextField.getDocument().addDocumentListener(this); colonLabel = new JLabel(":"); schemaLabel = new JLabel("Schema:"); schemaTextField = new JTextField(); schemaTextField.getDocument().addDocumentListener(this); userLabel = new JLabel("User:"); userTextField = new JTextField(); userTextField.getDocument().addDocumentListener(this); passwordLabel = new JLabel("Password:"); passwordField = new JPasswordField(); passwordField.getDocument().addDocumentListener(this); sourceLabel = new JLabel("Change Log:"); sourceButtonGroup = new EventCoalescingButtonGroup(); sourceButtons = new JRadioButton[Source.values().length]; for (Source source : Source.values()) { sourceButtonGroup.add(sourceButtons[sourceIndex] = new JRadioButton( StringUtilities.toDisplayCase(source.name(), '_'))); sourceButtons[sourceIndex++].setActionCommand(source.name()); } sourceButtons[0].setSelected(true); sourceButtonGroup.addActionListener(this); changeLogTextField = new JTextField(); changeLogTextField.getDocument().addDocumentListener(this); goalLabel = new JLabel("Goal:"); goalButtonGroup = new EventCoalescingButtonGroup(); goalButtons = new JRadioButton[Goal.values().length - 1]; for (Goal goal : Goal.values()) { if (!goal.equals(Goal.NONE)) { goalButtonGroup.add( goalButtons[goalIndex] = new JRadioButton(StringUtilities.toDisplayCase(goal.name(), '_'))); goalButtons[goalIndex++].setActionCommand(goal.name()); } } goalButtons[0].setSelected(true); goalButtonGroup.addActionListener(this); outputLabel = new JLabel("Output:"); browseButton = new JButton("Browse...", BROWSE_ICON); browseButton.setMargin(new Insets(2, 2, 2, 2)); browseButton.setFocusable(false); browseButton.setToolTipText("browse for a file"); browseButton.addActionListener(this); browseButton.setEnabled(false); outputTextField = new JTextField(); outputTextField.getDocument().addDocumentListener(this); outputTextField.setEnabled(false); buttonSeparator = new JSeparator(JSeparator.HORIZONTAL); buttonSeparator.setMaximumSize( new Dimension(Integer.MAX_VALUE, (int) buttonSeparator.getPreferredSize().getHeight())); startButton = new JButton("Start"); startButton.addActionListener(this); layout.setHorizontalBox(layout.parallelBox().add(layout.sequentialBox() .add(layout.parallelBox(Alignment.TRAILING).add(databaseLabel).add(hostLabel).add(schemaLabel) .add(userLabel).add(passwordLabel).add(sourceLabel).add(goalLabel).add(outputLabel)) .add(goalHorizontalBox = layout.parallelBox().add(databaseCombo, Constraint.expand()) .add(layout.sequentialBox(3).add(hostTextField, Constraint.expand()).add(colonLabel) .add(portTextField)) .add(schemaTextField, Constraint.expand()).add(userTextField, Constraint.expand()) .add(passwordField, Constraint.expand()).add(sourceHorizontalBox = layout.sequentialBox()) .add(changeLogTextField, Constraint.expand()) .add(layout.parallelBox(Alignment.TRAILING).add(outputTextField, Constraint.expand()) .add(browseButton)))) .add(buttonSeparator, Constraint.expand()) .add(layout.sequentialBox(Justification.LAST, true).add(startButton))); for (JRadioButton sourceButton : sourceButtons) { sourceHorizontalBox.add(sourceButton); } for (JRadioButton goalButton : goalButtons) { goalHorizontalBox.add(goalButton); } layout.setVerticalBox(layout.sequentialBox() .add(layout.sequentialBox() .add(layout.parallelBox(Alignment.BASELINE).add(databaseLabel).add(databaseCombo)) .add(layout.parallelBox(Alignment.BASELINE).add(hostLabel).add(hostTextField) .add(colonLabel).add(portTextField)) .add(layout.parallelBox(Alignment.BASELINE).add(schemaLabel).add(schemaTextField)) .add(layout.parallelBox(Alignment.BASELINE).add(userLabel).add(userTextField)) .add(layout.parallelBox(Alignment.BASELINE).add(passwordLabel).add(passwordField))) .add(layout.sequentialBox(3) .add(layout.parallelBox(Alignment.CENTER).add(sourceLabel) .add(sourceVerticalBox = layout.parallelBox())) .add(changeLogTextField)) .add(goalVerticalBox = layout.sequentialBox(Gap.NONE) .add(layout.parallelBox(Alignment.BASELINE).add(goalLabel).add(goalButtons[0])))); for (JRadioButton sourceButton : sourceButtons) { sourceVerticalBox.add(sourceButton); } for (int count = 1; count < goalButtons.length; count++) { goalVerticalBox.add(goalButtons[count]); } layout.getVerticalBox() .add(layout.sequentialBox(Gap.RELATED) .add(layout.parallelBox(Alignment.BASELINE).add(outputLabel).add(outputTextField)) .add(browseButton)) .add(layout.sequentialBox(Gap.RELATED).add(buttonSeparator).add(startButton)); setSize(new Dimension(((int) getLayout().preferredLayoutSize(this).getWidth()) + 150, ((int) getLayout().preferredLayoutSize(this).getHeight()) + 50)); setResizable(false); setLocationByPlatform(true); }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Creates a separator of the specified height. * /*from ww w. java 2 s . co m*/ * @param h The desired height. * @return See above. */ public static JSeparator createSeparator(int h) { if (h <= 0) h = DEFAULT_ICON_HEIGHT; JSeparator s = new JSeparator(JSeparator.VERTICAL); Dimension d = s.getPreferredSize(); s.setMaximumSize(new Dimension(d.width, h)); return s; }
From source file:org.ut.biolab.medsavant.client.view.UpdatesPanel.java
private JSeparator createSeparator() { JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); sep.setMaximumSize(new Dimension(1000, 1)); sep.setBackground(Color.WHITE); sep.setForeground(Color.LIGHT_GRAY); return sep;//w w w .j a v a2 s.co m }