Java Code Examples for com.alee.laf.WebLookAndFeel#getIcon()

The following examples show how to use com.alee.laf.WebLookAndFeel#getIcon() . 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: WebSplitButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebSplitButton button = new WebSplitButton ( getStyleId (), "Select one..." );
    button.setPopupMenu ( createSamplePopupMenu ( button, false, true ) );

    final WebSplitButton first = new WebSplitButton ( getStyleId (), "Select one..." );
    first.setMenuIcon ( DemoIcons.menu16 );
    first.setPopupMenu ( createSamplePopupMenu ( first, false, true ) );

    final WebSplitButton second = new WebSplitButton ( getStyleId (), "Select one...", WebLookAndFeel.getIcon ( 16 ) );
    second.setPopupMenu ( createSamplePopupMenu ( second, true, true ) );

    final WebSplitButton icon = new WebSplitButton ( getStyleId (), "Select one...", WebLookAndFeel.getIcon ( 16 ) );
    icon.setMenuIcon ( DemoIcons.menu16 );
    icon.setPopupMenu ( createSamplePopupMenu ( icon, true, true ) );

    return CollectionUtils.asList ( button, new GroupPane ( first, second ), icon );
}
 
Example 2
Source File: WebStyledLabelExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebStyledLabel leading = new WebStyledLabel ( getStyleId (), WebStyledLabel.LEADING );
    leading.setText ( "{Leading:b} {text:c(blue)}" );

    final ImageIcon icon = WebLookAndFeel.getIcon ( 16 );
    final WebStyledLabel center = new WebStyledLabel ( getStyleId (), icon, WebStyledLabel.CENTER );
    center.setText ( "{Centered:b} {text:c(blue)} {with:u} {icon:c(red)}" );

    final WebStyledLabel trailing = new WebStyledLabel ( getStyleId (), WebStyledLabel.TRAILING );
    trailing.setText ( "{Trailing:c(blue)} {text:b}" );

    return CollectionUtils.asList ( leading, center, trailing );
}
 
Example 3
Source File: JLabelExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JLabel leading = new JLabel ( "Leading text", JLabel.LEADING );
    leading.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final ImageIcon icon = WebLookAndFeel.getIcon ( 16 );
    final JLabel center = new JLabel ( "Centered text with icon", icon, JLabel.CENTER );
    center.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JLabel trailing = new JLabel ( "Trailing text", JLabel.TRAILING );
    trailing.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    return CollectionUtils.asList ( leading, center, trailing );
}
 
Example 4
Source File: WebLinkExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final ImageIcon icon = WebLookAndFeel.getIcon ( 16 );
    final String text = getPreviewLanguagePrefix () + "link";
    final WebLink link = new WebLink ( getStyleId (), new AbstractLinkAction ( icon, text )
    {
        @Override
        public void linkExecuted ( @NotNull final ActionEvent event )
        {
            NotificationManager.showNotification ( ( Component ) event.getSource (), getPreviewLanguagePrefix () + "notification" );
        }
    } );
    return CollectionUtils.asList ( link );
}
 
Example 5
Source File: JToggleButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JToggleButton basic = new JToggleButton ( "", true );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "styled.text.basic" ) );

    final JToggleButton group1 = new JToggleButton ( "", true );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "styled.text.group1" ) );

    final JToggleButton group2 = new JToggleButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "styled.text.group2" ) );

    final JToggleButton group3 = new JToggleButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "styled.text.group3" ) );

    final JToggleButton icon = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "styled.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example 6
Source File: JToggleButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JToggleButton basic = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JToggleButton group1 = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JToggleButton group2 = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JToggleButton group3 = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ) );
}
 
Example 7
Source File: JToggleButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JToggleButton basic = new JToggleButton ( "", true );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "plain.text.basic" ) );

    final JToggleButton group1 = new JToggleButton ( "", true );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "plain.text.group1" ) );

    final JToggleButton group2 = new JToggleButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "plain.text.group2" ) );

    final JToggleButton group3 = new JToggleButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "plain.text.group3" ) );

    final JToggleButton icon = new JToggleButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "plain.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example 8
Source File: JButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JButton basic = new JButton ();
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "styled.text.basic" ) );

    final JButton group1 = new JButton ();
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "styled.text.group1" ) );

    final JButton group2 = new JButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "styled.text.group2" ) );

    final JButton group3 = new JButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "styled.text.group3" ) );

    final JButton icon = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "styled.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example 9
Source File: JButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JButton basic = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JButton group1 = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JButton group2 = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JButton group3 = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ) );
}
 
Example 10
Source File: JButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JButton basic = new JButton ();
    basic.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( basic, getExampleLanguageKey ( "plain.text.basic" ) );

    final JButton group1 = new JButton ();
    group1.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group1, getExampleLanguageKey ( "plain.text.group1" ) );

    final JButton group2 = new JButton ();
    group2.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group2, getExampleLanguageKey ( "plain.text.group2" ) );

    final JButton group3 = new JButton ();
    group3.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( group3, getExampleLanguageKey ( "plain.text.group3" ) );

    final JButton icon = new JButton ( WebLookAndFeel.getIcon ( 16 ) );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );
    UILanguageManager.registerComponent ( icon, getExampleLanguageKey ( "plain.text.icon" ) );

    return CollectionUtils.asList ( basic, new GroupPane ( group1, group2, group3 ), icon );
}
 
Example 11
Source File: WebSplitButtonExample.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final WebSplitButton button = new WebSplitButton ( getStyleId (), WebLookAndFeel.getIcon ( 16 ) );
    button.setMenuIcon ( DemoIcons.menu16 );
    button.setPopupMenu ( createSamplePopupMenu ( button, true, false ) );

    final WebSplitButton first = new WebSplitButton ( getStyleId (), WebLookAndFeel.getIcon ( 16 ) );
    first.setPopupMenu ( createSamplePopupMenu ( first, true, false ) );

    final WebSplitButton second = new WebSplitButton ( getStyleId (), WebLookAndFeel.getIcon ( 16 ) );
    second.setPopupMenu ( createSamplePopupMenu ( second, true, false ) );

    return CollectionUtils.asList ( button, new GroupPane ( first, second ) );
}
 
Example 12
Source File: JLabelExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final JLabel label = new JLabel ( "Simple text", JLabel.LEADING );
    label.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    final JLabel icon = new JLabel ( "Iconed text", WebLookAndFeel.getIcon ( 16 ), JLabel.LEADING );
    icon.putClientProperty ( StyleId.STYLE_PROPERTY, getStyleId () );

    return CollectionUtils.asList ( label, icon );
}
 
Example 13
Source File: WebStyledLabelExample.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
protected List<? extends JComponent> createPreviewElements ()
{
    final String labelText = "{Custom:b} {styled:c(blue)} {2:sup} text" + "\n" + "{And:b} {And:c(red)} And {another:b} row";
    final WebStyledLabel label = new WebStyledLabel ( getStyleId (), labelText );

    final String iconText = "{Iconed:b} text";
    final WebStyledLabel icon = new WebStyledLabel ( getStyleId (), iconText, WebLookAndFeel.getIcon ( 16 ) );

    return CollectionUtils.asList ( label, icon );
}
 
Example 14
Source File: DynamicMenu.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
protected WebDynamicMenu createMenu ()
{
    final WebDynamicMenu menu = new WebDynamicMenu ();
    menu.setType ( ( DynamicMenuType ) type.getSelectedItem () );
    menu.setHideType ( ( DynamicMenuType ) hidingType.getSelectedItem () );
    menu.setRadius ( Integer.parseInt ( radius.getText () ) );
    menu.setFadeStepSize ( 0.07f );

    final int items = Integer.parseInt ( amount.getText () );
    for ( int i = 1; i <= items; i++ )
    {
        final ImageIcon icon = WebLookAndFeel.getIcon ( 24 );
        final ActionListener action = new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                System.out.println ( icon );
            }
        };
        final WebDynamicMenuItem item = new WebDynamicMenuItem ( icon, action );
        item.setMargin ( new Insets ( 8, 8, 8, 8 ) );
        menu.addItem ( item );
    }

    return menu;
}
 
Example 15
Source File: AboutLibraryDialog.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns library version panel.
 *
 * @return library version panel
 */
@NotNull
private WebPanel createLibraryVersionPanel ()
{
    final Version version = new Version ( AboutLibraryDialog.class );

    final WebImage icon = new WebImage ( WebLookAndFeel.getIcon ( 32 ) );

    final WebLink versionNumber = new WebLink ( version.toString (), new UrlLinkAction ( "https://github.com/mgarin/weblaf" ) );
    versionNumber.setBoldFont ();

    final WebLabel versionName = new WebLabel ( version.name () );

    return new GroupPanel ( StyleId.panelTransparent, 15, icon, new GroupPanel ( false, versionNumber, versionName ) );
}
 
Example 16
Source File: ComponentInstantiationTest.java    From weblaf with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns {@link Icon} that can be used for tests.
 *
 * @return {@link Icon} that can be used for tests
 */
@NotNull
private static Icon icon16 ()
{
    return WebLookAndFeel.getIcon ( 16 );
}
 
Example 17
Source File: ComponentInstantiationTest.java    From weblaf with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Returns {@link ImageIcon} that can be used for tests.
 *
 * @return {@link ImageIcon} that can be used for tests
 */
@NotNull
private static ImageIcon imageIcon16 ()
{
    return WebLookAndFeel.getIcon ( 16 );
}