com.alee.laf.button.WebButton Java Examples
The following examples show how to use
com.alee.laf.button.WebButton.
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: JFileChooserExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { return CollectionUtils.asList ( new WebButton ( getExampleLanguageKey ( "show" ), new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { // Displaying file chooser final JFileChooser fileChooser = new JFileChooser (); final int result = fileChooser.showSaveDialog ( DemoApplication.getInstance () ); // Displaying result notification showNotification ( ( JComponent ) e.getSource (), fileChooser, result ); } } ) ); }
Example #2
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 #3
Source File: WebCustomTooltipExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton (); button.setLanguage ( getPreviewLanguagePrefix () + "text", 0 ); button.addHotkey ( Hotkey.CTRL_D ); button.setToolTip ( getPreviewLanguagePrefix () + "tip" ); button.addActionListener ( new ActionListener () { private int counter = 0; @Override public void actionPerformed ( final ActionEvent e ) { counter++; button.updateLanguage ( counter ); } } ); return CollectionUtils.asList ( button ); }
Example #4
Source File: JToolBarExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final JToolBar toolBar = new JToolBar ( SwingConstants.HORIZONTAL ); toolBar.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () ); toolBar.add ( new WebButton ( getExampleLanguageKey ( "button1" ) ) ); toolBar.add ( new WebButton ( getExampleLanguageKey ( "button2" ) ) ); toolBar.add ( new WebButton ( getExampleLanguageKey ( "button3" ) ) ); toolBar.addSeparator ( new Dimension ( 10, 10 ) ); final WebToggleButton toggle1 = new WebToggleButton ( DemoIcons.win16, SystemUtils.isWindows () ); final WebToggleButton toggle2 = new WebToggleButton ( DemoIcons.mac16, SystemUtils.isMac () ); final WebToggleButton toggle3 = new WebToggleButton ( DemoIcons.unix16, SystemUtils.isUnix () ); final WebToggleButton toggle4 = new WebToggleButton ( DemoIcons.solaris16, SystemUtils.isSolaris () ); toolBar.add ( new GroupPane ( toggle1, toggle2, toggle3, toggle4 ) ); toolBar.addSeparator ( new Dimension ( 10, 10 ) ); toolBar.add ( new WebLabel ( getExampleLanguageKey ( "label1" ) ) ); toolBar.add ( new WebComboBox ( SampleData.createComboBoxModel () ) ); return CollectionUtils.asList ( toolBar ); }
Example #5
Source File: WebDirectoryChooserExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { return CollectionUtils.asList ( new WebButton ( getExampleLanguageKey ( "show" ), new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { // Displaying directory chooser directly and waiting for selected directory final String title = getPreviewLanguageKey ( "title" ); final File file = WebDirectoryChooser.showDialog ( DemoApplication.getInstance (), title ); // Displaying result notification showNotification ( ( JComponent ) e.getSource (), file ); } } ) ); }
Example #6
Source File: WebDirectoryChooserExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { return CollectionUtils.asList ( new WebButton ( getExampleLanguageKey ( "show" ), new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { // Customizing directory chooser final String title = getPreviewLanguageKey ( "title" ); final WebDirectoryChooser chooser = new WebDirectoryChooser ( DemoApplication.getInstance (), title ); chooser.setFilter ( new NonHiddenFilter () ); chooser.setSelectedDirectory ( FileUtils.getUserHome () ); // Displaying directory chooser and waiting for result final int result = chooser.showDialog (); // Displaying result notification showNotification ( ( JComponent ) e.getSource (), chooser, result ); } } ) ); }
Example #7
Source File: JFileChooserExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { return CollectionUtils.asList ( new WebButton ( getExampleLanguageKey ( "show" ), new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { // Displaying file chooser final JFileChooser fileChooser = new JFileChooser (); fileChooser.setMultiSelectionEnabled ( true ); final int result = fileChooser.showOpenDialog ( DemoApplication.getInstance () ); // Displaying result notification showNotification ( ( JComponent ) e.getSource (), fileChooser, result ); } } ) ); }
Example #8
Source File: TabTitleComponent.java From weblaf with GNU General Public License v3.0 | 6 votes |
/** * Returns newly created tab close {@link AbstractButton}. * * @param paneData {@link PaneData} containing opened document * @param document document to create tab close {@link AbstractButton} for * @return newly created tab close {@link AbstractButton} */ @NotNull protected AbstractButton createCloseButton ( @NotNull final PaneData<T> paneData, @NotNull final T document ) { final WeakReference<T> weakDocument = new WeakReference<T> ( document ); final StyleId closeButtonStyleId = StyleId.documentpaneTabCloseButton.at ( this ); final WebButton closeButton = new WebButton ( closeButtonStyleId, Icons.crossSmall, Icons.crossSmallHover ); closeButton.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { paneData.close ( weakDocument.get () ); } } ); return closeButton; }
Example #9
Source File: WebNotificationExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { final String title = getPreviewLanguagePrefix () + "text"; NotificationManager.showNotification ( button, title ); } } ); return CollectionUtils.asList ( button ); }
Example #10
Source File: WebNotificationExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { final String title = getPreviewLanguagePrefix () + "text"; NotificationManager.showNotification ( button, title, NotificationIcon.question.getIcon (), NotificationOption.yes, NotificationOption.no, NotificationOption.retry ); } } ); return CollectionUtils.asList ( button ); }
Example #11
Source File: WebNotificationExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { final WebLabel title = new WebLabel ( getPreviewLanguagePrefix () + "text", WebLabel.CENTER ); final WebImage logo = new WebImage ( WebLookAndFeel.getIcon ( 256 ) ); final GroupPanel content = new GroupPanel ( 15, false, title, logo ); NotificationManager.showNotification ( button, content, ( Icon ) null ); } } ); return CollectionUtils.asList ( button ); }
Example #12
Source File: JDialogExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { final Window parent = CoreSwingUtils.getNonNullWindowAncestor ( button ); final String title = getExampleLanguagePrefix () + "content"; final JDialog dialog = new JDialog ( parent ); UILanguageManager.registerComponent ( dialog.getRootPane (), title ); dialog.getRootPane ().putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () ); dialog.setIconImages ( WebLookAndFeel.getImages () ); dialog.add ( new WebLabel ( title, WebLabel.CENTER ) ); dialog.setSize ( 500, 400 ); dialog.setLocationRelativeTo ( DemoApplication.getInstance () ); dialog.setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE ); dialog.setVisible ( true ); } } ); return CollectionUtils.asList ( button ); }
Example #13
Source File: JFrameExample.java From weblaf with GNU General Public License v3.0 | 6 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { final String title = getExampleLanguagePrefix () + "content"; final JFrame frame = new JFrame (); UILanguageManager.registerComponent ( frame.getRootPane (), title ); frame.getRootPane ().putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () ); frame.setIconImages ( WebLookAndFeel.getImages () ); frame.add ( new WebLabel ( title, WebLabel.CENTER ) ); frame.setAlwaysOnTop ( true ); frame.setSize ( 500, 400 ); frame.setLocationRelativeTo ( DemoApplication.getInstance () ); frame.setDefaultCloseOperation ( WindowConstants.DISPOSE_ON_CLOSE ); frame.setVisible ( true ); } } ); return CollectionUtils.asList ( button ); }
Example #14
Source File: WebOverlayExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebOverlay overlay = new WebOverlay ( getStyleId (), SampleInterface.createAuthForm () ); final WebStyledLabel blockingOverlay = new WebStyledLabel ( DemoStyles.blockingLayerLabel, getPreviewLanguageKey ( "overlay.text" ), SwingConstants.CENTER ); NoOpMouseListener.install ( blockingOverlay ); NoOpKeyListener.install ( blockingOverlay ); final WebButton control = new WebButton ( getPreviewLanguageKey ( "overlay.show" ) ); control.addActionListener ( new ActionListener () { @Override public void actionPerformed ( @NotNull final ActionEvent e ) { if ( blockingOverlay.isShowing () ) { overlay.removeOverlay ( blockingOverlay ); control.setLanguage ( getPreviewLanguageKey ( "overlay.show" ) ); } else { overlay.addOverlay ( new FillOverlay ( blockingOverlay ) ); control.setLanguage ( getPreviewLanguageKey ( "overlay.hide" ) ); } } } ); return CollectionUtils.asList ( overlay, new AlignPanel ( control, SwingConstants.CENTER, SwingConstants.CENTER ) ); }
Example #15
Source File: JPanelExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final JPanel panel = new JPanel ( new BorderLayout ( 15, 15 ) ); panel.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () ); PainterSupport.setPadding ( panel, new Insets ( 15, 15, 15, 15 ) ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "NORTH", WebLabel.CENTER ), BorderLayout.NORTH ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "EAST" ), BorderLayout.EAST ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "SOUTH", WebLabel.CENTER ), BorderLayout.SOUTH ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "WEST" ), BorderLayout.WEST ); panel.add ( new WebButton ( "CENTER" ), BorderLayout.CENTER ); return CollectionUtils.asList ( panel ); }
Example #16
Source File: MyToolBar.java From JByteMod-Beta with GNU General Public License v2.0 | 5 votes |
protected JButton makeNavigationButton(String action, ImageIcon i, ActionListener a) { JButton button = WebButton.createIconWebButton(i, StyleConstants.smallRound, true); button.setToolTipText(action); button.addActionListener(a); button.setFocusable(false); button.setBorderPainted(false); button.setRolloverEnabled(false); return button; }
Example #17
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 #18
Source File: WebProgressOverlayExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebProgressOverlay overlay = new WebProgressOverlay ( getStyleId () ); final WebButton button = new WebButton ( getPreviewLanguageKey ( "show" ) ); button.setPreferredWidth ( 250 ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( @NotNull final ActionEvent e ) { if ( overlay.isProgressDisplayed () ) { overlay.hideProgress (); button.setLanguage ( getPreviewLanguageKey ( "show" ) ); } else { overlay.displayProgress (); button.setLanguage ( getPreviewLanguageKey ( "hide" ) ); } } } ); overlay.setContent ( button ); return CollectionUtils.asList ( overlay ); }
Example #19
Source File: WebPanelExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebPanel panel = new WebPanel ( getStyleId (), new BorderLayout ( 15, 15 ) ); panel.setPadding ( 15 ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "NORTH", WebLabel.CENTER ), BorderLayout.NORTH ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "EAST" ), BorderLayout.EAST ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "SOUTH", WebLabel.CENTER ), BorderLayout.SOUTH ); panel.add ( new WebLabel ( DemoStyles.placeholderLabel, "WEST" ), BorderLayout.WEST ); panel.add ( new WebButton ( "CENTER" ), BorderLayout.CENTER ); return CollectionUtils.asList ( panel ); }
Example #20
Source File: SampleInterface.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Returns sample auth form UI. * * @return sample auth form UI */ @NotNull public static JComponent createAuthForm () { final WebPanel form = new WebPanel ( StyleId.panelDecorated, new FormLayout ( 10, 10 ) ); form.setPadding ( 15, 25, 15, 25 ); form.add ( new WebStyledLabel ( "demo.sample.interface.auth.title", SwingConstants.CENTER ), FormLayout.LINE ); form.add ( new WebLabel ( "demo.sample.interface.auth.login", SwingConstants.RIGHT ) ); form.add ( new WebTextField ( 15 ) ); form.add ( new WebLabel ( "demo.sample.interface.auth.password", SwingConstants.RIGHT ) ); form.add ( new WebPasswordField ( 15 ) ); form.add ( new AlignPanel ( new GroupPanel ( 5, true, new WebButton ( "demo.sample.interface.auth.buttons.login" ).setPreferredWidth ( 100 ), new WebButton ( "demo.sample.interface.auth.buttons.cancel" ).setPreferredWidth ( 100 ) ), AlignPanel.CENTER, AlignPanel.CENTER ), FormLayout.LINE ); return form; }
Example #21
Source File: WebTreeFilterField.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Initializes filter icon. */ protected void initFilterIcon () { filterIcon = new WebButton ( StyleId.treefilterfieldSettings.at ( this ), Icons.filter, Icons.filterHover ); filterIcon.setCursor ( Cursor.getDefaultCursor () ); filterIcon.addActionListener ( new ActionListener () { @Override public void actionPerformed ( @NotNull final ActionEvent e ) { settingsMenu.showBelowStart ( filterIcon ); } } ); setLeadingComponent ( filterIcon ); }
Example #22
Source File: WebDateFieldUI.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Installs date field UI elements. */ protected void installComponents () { SwingUtils.setHandlesEnableStateMark ( dateField ); dateField.setLayout ( new BorderLayout ( 0, 0 ) ); field = new WebFormattedTextField ( StyleId.datefieldField.at ( dateField ) ); dateField.add ( field, BorderLayout.CENTER ); button = new WebButton ( StyleId.datefieldButton.at ( dateField ), Icons.calendar, Icons.calendarHover ); dateField.add ( button, BorderLayout.LINE_END ); }
Example #23
Source File: WebMultiSplitPaneDivider.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns new {@link WebButton} that can be used to expand component to the right of this {@link WebMultiSplitPaneDivider}. * * @return new {@link WebButton} that can be used to expand component to the right of this {@link WebMultiSplitPaneDivider} */ protected WebButton createLeftOneTouchButton () { final OneTouchButton button = new OneTouchButton ( StyleId.multisplitpanedividerOneTouchLeftButton.at ( this ), this ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { multiSplitPane.getModel ().toggleViewToRight ( WebMultiSplitPaneDivider.this ); } } ); return button; }
Example #24
Source File: WebMultiSplitPaneDivider.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns new {@link WebButton} that can be used to expand component to the left of this {@link WebMultiSplitPaneDivider}. * * @return new {@link WebButton} that can be used to expand component to the left of this {@link WebMultiSplitPaneDivider} */ protected WebButton createRightOneTouchButton () { final OneTouchButton button = new OneTouchButton ( StyleId.multisplitpanedividerOneTouchRightButton.at ( this ), this ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { multiSplitPane.getModel ().toggleViewToLeft ( WebMultiSplitPaneDivider.this ); } } ); return button; }
Example #25
Source File: WebSpinnerUI.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected Component createNextButton () { final WebButton nextButton = new WebButton ( StyleId.spinnerNextButton.at ( spinner ), Icons.upSmall ); nextButton.setName ( "Spinner.nextButton" ); installNextButtonListeners ( nextButton ); return nextButton; }
Example #26
Source File: WebSpinnerUI.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected Component createPreviousButton () { final WebButton prevButton = new WebButton ( StyleId.spinnerPreviousButton.at ( spinner ), Icons.downSmall ); prevButton.setName ( "Spinner.previousButton" ); installPreviousButtonListeners ( prevButton ); return prevButton; }
Example #27
Source File: WebSplitPaneDivider.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns new {@link WebButton} that can be used to collapse the left component in {@link JSplitPane}. * * @return new {@link WebButton} that can be used to collapse the left component in {@link JSplitPane} */ protected WebButton createLeftOneTouchButton () { final OneTouchButton button = new OneTouchButton ( StyleId.splitpanedividerOneTouchLeftButton.at ( this ) ); button.addActionListener ( new OneTouchActionHandler ( true ) ); return button; }
Example #28
Source File: WebSplitPaneDivider.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Creates and returns new {@link WebButton} that can be used to collapse the right component in {@link JSplitPane}. * * @return new {@link WebButton} that can be used to collapse the right component in {@link JSplitPane} */ protected WebButton createRightOneTouchButton () { final OneTouchButton button = new OneTouchButton ( StyleId.splitpanedividerOneTouchRightButton.at ( this ) ); button.addActionListener ( new OneTouchActionHandler ( false ) ); return button; }
Example #29
Source File: WebOptionPaneUI.java From weblaf with GNU General Public License v3.0 | 5 votes |
/** * Applies default option pane button settings. * * @param button button to configure */ private void configureButton ( @NotNull final WebButton button ) { // Minimum size button.setMinimumSize ( new Dimension ( 70, 0 ) ); // Proper font final Font buttonFont = UIManager.getFont ( "OptionPane.buttonFont" ); if ( buttonFont != null ) { button.setFont ( buttonFont ); } }
Example #30
Source File: WebPopOverExample.java From weblaf with GNU General Public License v3.0 | 5 votes |
@NotNull @Override protected List<? extends JComponent> createPreviewElements () { final WebButton button = new WebButton ( getExampleLanguagePrefix () + "show" ); button.addActionListener ( new ActionListener () { @Override public void actionPerformed ( final ActionEvent e ) { final Window parent = CoreSwingUtils.getNonNullWindowAncestor ( button ); final WebPopOver popOver = new WebPopOver ( getStyleId (), parent ); popOver.setIconImages ( WebLookAndFeel.getImages () ); popOver.setCloseOnFocusLoss ( true ); popOver.setPadding ( 10 ); final WebPanel container = new WebPanel ( StyleId.panelTransparent, new BorderLayout ( 5, 5 ) ); final WebLabel label = new WebLabel ( getExampleLanguagePrefix () + "label", WebLabel.CENTER ); container.add ( label, BorderLayout.NORTH ); final String text = LM.get ( getExampleLanguagePrefix () + "text" ); final WebTextField field = new WebTextField ( text, 20 ); field.setHorizontalAlignment ( WebTextField.CENTER ); container.add ( field, BorderLayout.CENTER ); popOver.add ( container ); popOver.show ( button, PopOverDirection.down ); } } ); return CollectionUtils.asList ( button ); }