Java Code Examples for com.alee.utils.SwingUtils#equalizeComponentsWidth()
The following examples show how to use
com.alee.utils.SwingUtils#equalizeComponentsWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GroupPaneExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { // First row final WebComboBox e1 = new WebComboBox ( new String[]{ "First", "Second", "Third" } ); final WebButton e2 = new WebButton ( "Second" ); final WebTextField e3 = new WebTextField ( "Third" ); // Second row final WebPanel e4 = new WebPanel ( StyleId.panelDecorated, new WebLabel ( "First", WebLabel.CENTER ) ); final WebTextField e5 = new WebTextField ( "Second" ); final WebButton e6 = new WebButton ( "Third" ); // Third row final WebSpinner e7 = new WebSpinner ( new SpinnerNumberModel ( 100, 0, 100, 1 ) ); final WebButton e8 = new WebButton ( "Second" ); final WebPasswordField e9 = new WebPasswordField ( "Third" ); final GroupPane groupPane = new GroupPane ( getStyleId (), 3, 3, e1, e2, e3, e4, e5, e6, e7, e8, e9 ); SwingUtils.equalizeComponentsWidth ( groupPane.getComponents () ); return CollectionUtils.asList ( groupPane ); }
Example 2
Source File: GroupPaneExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton e1 = new WebButton ( "First" ); final WebComboBox e2 = new WebComboBox ( new String[]{ "First", "Second", "Third" }, 1 ); final WebTextField e3 = new WebTextField ( "Third" ); final WebButton e4 = new WebButton ( "Last" ); final GroupPane groupPane = new GroupPane ( getStyleId (), e1, e2, e3, e4 ); SwingUtils.equalizeComponentsWidth ( groupPane.getComponents () ); return CollectionUtils.asList ( groupPane ); }
Example 3
Source File: GroupPaneExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebToggleButton b1 = new WebToggleButton ( "First", true ); final WebToggleButton b2 = new WebToggleButton ( "Second" ); final WebToggleButton b3 = new WebToggleButton ( "Third" ); final WebToggleButton b4 = new WebToggleButton ( "Last" ); final GroupPane groupPane = new GroupPane ( getStyleId (), b1, b2, b3, b4 ); SwingUtils.equalizeComponentsWidth ( groupPane.getComponents () ); return CollectionUtils.asList ( groupPane ); }
Example 4
Source File: WebSwitch.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Sets new switch components. * * @param selected new selected switch component * @param deselected new deselected switch component */ public void setSwitchComponents ( final JComponent selected, final JComponent deselected ) { setSelectedComponentImpl ( selected ); setDeselectedComponentImpl ( deselected ); SwingUtils.equalizeComponentsWidth ( selectedComponent, deselectedComponent ); revalidate (); }
Example 5
Source File: WebNotification.java From weblaf with GNU General Public License v3.0 | 4 votes |
/** * Updates visible notification options. */ protected void updateOptionButtons () { optionsPanel.removeAll (); if ( CollectionUtils.notEmpty ( options ) ) { for ( final NotificationOption option : options ) { final StyleId id = StyleId.notificationOption.at ( WebNotification.this ); final WebButton optionButton = new WebButton ( id, option.getLanguageKey (), new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { fireOptionSelected ( option ); if ( closeOnOptionSelection ) { acceptAndHide (); } } } ); optionsPanel.add ( optionButton ); } if ( equalizeButtonWidths ) { final List<String> properties = new ImmutableList<String> ( AbstractButton.TEXT_CHANGED_PROPERTY ); SwingUtils.equalizeComponentsWidth ( properties, optionsPanel.getComponents () ); } if ( !contains ( southPanel ) ) { add ( southPanel, BorderLayout.SOUTH ); } } else { if ( contains ( southPanel ) ) { remove ( southPanel ); } } revalidate (); pack (); }
Example 6
Source File: WebInnerNotification.java From weblaf with GNU General Public License v3.0 | 4 votes |
/** * Updates visible notification options. */ protected void updateOptionButtons () { optionsPanel.removeAll (); if ( CollectionUtils.notEmpty ( options ) ) { for ( final NotificationOption option : options ) { final StyleId id = StyleId.notificationOption.at ( WebInnerNotification.this ); final WebButton optionButton = new WebButton ( id, option.getLanguageKey (), new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { fireOptionSelected ( option ); if ( closeOnOptionSelection ) { acceptAndHide (); } } } ); optionsPanel.add ( optionButton ); } if ( equalizeButtonWidths ) { final List<String> properties = new ImmutableList<String> ( AbstractButton.TEXT_CHANGED_PROPERTY ); SwingUtils.equalizeComponentsWidth ( properties, optionsPanel.getComponents () ); } if ( !contains ( southPanel ) ) { add ( southPanel, BorderLayout.SOUTH ); } } else { if ( contains ( southPanel ) ) { remove ( southPanel ); } } revalidate (); }
Example 7
Source File: ContainerMethodsImpl.java From weblaf with GNU General Public License v3.0 | 2 votes |
/** * Makes all {@link Container} child {@link Component} widths equal. * * @param container {@link Container} * @param <C> provided {@link Container} type * @param <T> actual {@link Container} type * @return this {@link Container} */ public static <C extends Container, T extends C> T equalizeComponentsWidth ( final C container ) { SwingUtils.equalizeComponentsWidth ( container.getComponents () ); return ( T ) container; }