Package com.alee.laf.button

Examples of com.alee.laf.button.WebButton


        // Images panel
        final WebPanel imagesPanel = new WebPanel ( new HorizontalFlowLayout ( 5, false ) );

        // States switch buttons
        final WebButton slideLeft = new WebButton ( loadIcon ( "left.png" ) );
        slideLeft.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                // Changing image positions in lsit
                ImageIcon first = images.remove ( 0 );
                images.add ( first );

                // Performing transitions
                performTransitions ( imagesPanel, images, Direction.left );
            }
        } );
        final WebButton slideRight = new WebButton ( loadIcon ( "right.png" ) );
        slideRight.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                // Changing image positions in lsit
                ImageIcon last = images.remove ( images.size () - 1 );
                images.add ( 0, last );

                // Performing transitions
                performTransitions ( imagesPanel, images, Direction.right );
            }
        } );
        final WebButtonGroup buttonGroup = new WebButtonGroup ( slideLeft, slideRight );
        buttonGroup.setButtonsDrawFocus ( false );

        // Transition panels
        boolean first = true;
        for ( ImageIcon image : images )
        {
            final ComponentTransition transition = new ComponentTransition ( new WebImage ( image ), createEffect () );
            imagesPanel.add ( transition );

            if ( first )
            {
                first = false;
                transition.addTransitionListener ( new TransitionListener ()
                {
                    @Override
                    public void transitionStarted ()
                    {
                        slideLeft.setEnabled ( false );
                        slideRight.setEnabled ( false );
                    }

                    @Override
                    public void transitionFinished ()
                    {
                        slideLeft.setEnabled ( true );
                        slideRight.setEnabled ( true );
                    }
                } );
            }
        }
View Full Code Here


        // Adding a custom language setter that supports custom states
        LanguageManager.registerLanguageUpdater ( new MyLabelUpdater () );

        // Creating example UI
        final WebButton myButton = new WebButton ();
        myButton.setLanguage ( "my.button" );
        myButton.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                final WebDialog myDialog = new WebDialog ( owner );
View Full Code Here

    {
        // Initial color
        final Color initialColor = SettingsManager.get ( "ColorChooserDialogExample.color", Color.WHITE );

        // Simple color chooser
        final WebButton colorChooserButton = new WebButton ( getColorText ( initialColor ), ImageUtils.createColorIcon ( initialColor ) );
        colorChooserButton.setLeftRightSpacing ( 0 );
        colorChooserButton.setMargin ( 0, 0, 0, 3 );
        colorChooserButton.addActionListener ( new ActionListener ()
        {
            private WebColorChooserDialog colorChooser = null;
            private Color lastColor = initialColor;

            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( colorChooser == null )
                {
                    colorChooser = new WebColorChooserDialog ( owner );
                }
                colorChooser.setColor ( lastColor );
                colorChooser.setVisible ( true );

                if ( colorChooser.getResult () == DialogOptions.OK_OPTION )
                {
                    Color color = colorChooser.getColor ();
                    lastColor = color;

                    colorChooserButton.setIcon ( ImageUtils.createColorIcon ( color ) );
                    colorChooserButton.setText ( getColorText ( color ) );
                }
            }
        } );

        return new GroupPanel ( colorChooserButton );
View Full Code Here

    private static Component createSourceButton ( final WebLookAndFeelDemo owner, final Example example )
    {
        final Class classType = example.getClass ();

        final WebButton sourceButton = WebButton.createIconWebButton ( JarEntry.javaIcon );
        TooltipManager.setTooltip ( sourceButton, JarEntry.javaIcon, ReflectUtils.getJavaClassName ( classType ), TooltipWay.up );
        sourceButton.setRolloverDecoratedOnly ( true );
        sourceButton.setFocusable ( false );

        sourceButton.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                owner.showSource ( classType );
View Full Code Here

        WebLabel titleLabel = new WebLabel ( title, icon );
        titleLabel.setMargin ( 0, 2, 0, 4 );
        removableTitle.add ( titleLabel, BorderLayout.CENTER );

        WebButton remove = WebButton.createIconWebButton ( REMOVE_ICON, StyleConstants.smallRound, 2, 2, true );
        remove.setFocusable ( false );
        remove.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                removeTabAt ( ids.indexOf ( id ) );
View Full Code Here

        updateClassPath ( null, false );
    }

    private WebButton createClassSearch ()
    {
        final WebButton classSearch = new WebButton ( classSearchIcon );
        classSearch.setDrawFocus ( false );
        classSearch.setRolloverDecoratedOnly ( true );
        classSearch.addHotkey ( Hotkey.CTRL_N );
        classSearch.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                showClassSearchPopup ();
View Full Code Here

        }
    }

    private WebButton createSettings ()
    {
        final WebButton settings = new WebButton ( new ImageIcon ( SourceViewer.class.getResource ( "icons/settings.png" ) ) );
        settings.setDrawFocus ( false );
        settings.setRolloverDecoratedOnly ( true );

        final WebButtonPopup wbp = new WebButtonPopup ( settings, PopupWay.downLeft );

        final WebPanel popupContent = new WebPanel ( new VerticalFlowLayout ( 5, 5 ) );
        popupContent.setMargin ( 5 );
View Full Code Here

                groupDescription.setText ( sg.getGroupDescription () );
            }
        } );

        // Update button
        final WebButton update = WebButton.createIconWebButton ( getUpdateIcon () );
        update.setVisible ( false );
        update.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                WebUtils.browseSiteSafely ( WEBLAF_SITE + "download/" );
            }
        } );
        statusBar.addToMiddle ( update );

        // Version checker
        WebTimer.repeat ( "WebLookAndFeelDemo.versionCheck", 60000L, 10000L, new ActionListener ()
        {
            private VersionInfo lastVersion = null;

            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                try
                {
                    final VersionInfo lv = getLastVersion ();
                    if ( lv != null && lv.compareTo ( VersionManager.getLibraryVersion () ) > 0 )
                    {
                        // Displaying update icon
                        update.setVisible ( true );

                        // Updating tips
                        final ImageIcon updateIcon = getUpdateIcon ();

                        final WebCustomTooltip versionTip = TooltipManager
                                .showOneTimeTooltip ( update, null, updateIcon, "New library version available: " + lv.toString () );
                        update.addMouseListener ( new MouseAdapter ()
                        {
                            @Override
                            public void mouseEntered ( final MouseEvent e )
                            {
                                versionTip.closeTooltip ();
                                update.removeMouseListener ( this );
                            }
                        } );

                        TooltipManager.setTooltip ( update, updateIcon, "Download new version: " + lv.toString () );
View Full Code Here

        updateBounds ();
    }

    private WebButton copy ( final WebButton button )
    {
        final WebButton copy = new WebButton ()
        {
            @Override
            public Dimension getPreferredSize ()
            {
                return button.getSize ();
            }
        };

        copySettings ( button, copy );

        copy.setFocusable ( true );
        copy.setUndecorated ( true );
        copy.setCursor ( button.getCursor () );

        return copy;
    }
View Full Code Here

    public static void main ( final String[] args )
    {
        WebLookAndFeel.install ();

        final WebButton b1 = new WebButton ( "1" );
        b1.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                EffectsManager.fadeOut ( b1 );
            }
        } );

        final WebButton b2 = new WebButton ( "2" );
        b2.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                EffectsManager.fadeOut ( b2 );
            }
        } );

        final WebButton b3 = new WebButton ( "3" );
        b3.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                EffectsManager.fadeOut ( b3 );
View Full Code Here

TOP

Related Classes of com.alee.laf.button.WebButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.