Package com.alee.extended.transition

Examples of com.alee.extended.transition.ComponentTransition


                // Initial transition on first panel appearance
                imagesPanel.removeAncestorListener ( this );
                for ( int i = 0; i < imagesPanel.getComponentCount (); i++ )
                {
                    // Delayed image fade-in
                    ComponentTransition componentTransition = ( ComponentTransition ) imagesPanel.getComponent ( i );
                    componentTransition.delayTransition ( 1000 + i * 500, images.get ( i ) );
                }
            }
        } );

        // States switch buttons
        final WebButton reloadView = new WebButton ( loadIcon ( "switch.png" ) );
        reloadView.setEnabled ( false );
        reloadView.setDrawFocus ( false );
        reloadView.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                reloadView.setEnabled ( false );
                for ( int i = 0; i < imagesPanel.getComponentCount (); i++ )
                {
                    // Switching to loader first
                    ComponentTransition componentTransition = ( ComponentTransition ) imagesPanel.getComponent ( i );
                    componentTransition.performTransition ( loaders.get ( i ) );

                    // Delayed image fade-in
                    componentTransition.delayTransition ( 1000 + i * 500, images.get ( i ) );
                }
            }
        } );

        // Transition panels
        for ( int i = 0; i < images.size (); i++ )
        {
            // Single transition panel with loader as initial component
            final ComponentTransition transition = new ComponentTransition ( loaders.get ( i ), new FadeTransitionEffect () );
            imagesPanel.add ( transition );

            if ( i == images.size () - 1 )
            {
                // Transition listener for reload button enabling
                transition.addTransitionListener ( new TransitionAdapter ()
                {
                    @Override
                    public void transitionFinished ()
                    {
                        if ( transition.getContent () instanceof WebImage )
                        {
                            reloadView.setEnabled ( true );
                        }
                    }
                } );
View Full Code Here


    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Transition panel
        final ComponentTransition componentTransition = new ComponentTransition ();

        // Transition effect
        final BlocksTransitionEffect effect = new BlocksTransitionEffect ();
        effect.setDirection ( Direction.random );
        effect.setType ( BlockType.cascade );
        effect.setSize ( 40 );
        effect.setSpeed ( 4 );
        effect.setFade ( false );
        componentTransition.setTransitionEffect ( effect );

        // Effects
        final WebImage image1 = new WebImage ( loadIcon ( "pictures/1.jpg" ) );
        final WebImage image2 = new WebImage ( loadIcon ( "pictures/2.jpg" ) );
        final WebImage image3 = new WebImage ( loadIcon ( "pictures/3.jpg" ) );

        // Initial transition panel state
        componentTransition.setContent ( image1 );
        componentTransition.setPreferredSize ( SwingUtils.max ( image1, image2 ) );

        // Images switch button
        final WebButton switchView = new WebButton ( loadIcon ( "switch.png" ) );
        switchView.setDrawFocus ( false );
        switchView.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( componentTransition.getContent () == image1 )
                {
                    componentTransition.performTransition ( image2 );
                }
                else if ( componentTransition.getContent () == image2 )
                {
                    componentTransition.performTransition ( image3 );
                }
                else
                {
                    componentTransition.performTransition ( image1 );
                }
            }
        } );
        componentTransition.addTransitionListener ( new TransitionListener ()
        {
            @Override
            public void transitionStarted ()
            {
                switchView.setEnabled ( false );
View Full Code Here

    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Transition panel
        final ComponentTransition componentTransition = new ComponentTransition ();

        // Transition effect
        final CurtainTransitionEffect effect = new CurtainTransitionEffect ();
        effect.setType ( CurtainType.fade );
        effect.setSize ( 10 );
        effect.setSpeed ( 2 );
        componentTransition.setTransitionEffect ( effect );

        // Toolbar #1
        final WebToolBar toolBar1 = new WebToolBar ( WebToolBar.HORIZONTAL );
        toolBar1.setFloatable ( false );
        toolBar1.add ( WebButton.createIconWebButton ( loadIcon ( "toolbar/1.png" ), true ) );
        toolBar1.addSeparator ();
        toolBar1.add ( WebButton.createIconWebButton ( loadIcon ( "toolbar/2.png" ), true ) );
        toolBar1.addSeparator ();
        toolBar1.add ( WebButton.createIconWebButton ( loadIcon ( "toolbar/3.png" ), true ) );
        toolBar1.addToEnd ( WebButton.createIconWebButton ( loadIcon ( "toolbar/4.png" ), true ) );

        // Toolbar #2
        final WebToolBar toolBar2 = new WebToolBar ( WebToolBar.HORIZONTAL );
        toolBar2.setFloatable ( false );
        toolBar2.addSpacing ();
        toolBar2.add ( new WebLabel ( "Curtain transition example" ) );
        toolBar2.addSpacing ();
        componentTransition.setContent ( toolBar2 );

        // Initial transition panel state
        componentTransition.setContent ( toolBar1 );
        componentTransition.setPreferredSize ( SwingUtils.max ( toolBar1, toolBar2 ) );

        // States switch button
        final WebButton switchView = new WebButton ( loadIcon ( "switch.png" ) );
        switchView.setDrawFocus ( false );
        switchView.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( componentTransition.getContent () == toolBar1 )
                {
                    effect.setDirection ( Direction.right );
                    componentTransition.performTransition ( toolBar2 );
                }
                else
                {
                    effect.setDirection ( Direction.left );
                    componentTransition.performTransition ( toolBar1 );
                }
            }
        } );
        componentTransition.addTransitionListener ( new TransitionListener ()
        {
            @Override
            public void transitionStarted ()
            {
                switchView.setEnabled ( false );
View Full Code Here

        // 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 );
View Full Code Here

    private void performTransitions ( WebPanel imagesPanel, List<ImageIcon> images, Direction direction )
    {
        for ( int i = 0; i < imagesPanel.getComponentCount (); i++ )
        {
            ComponentTransition componentTransition = ( ComponentTransition ) imagesPanel.getComponent ( i );
            ( ( SlideTransitionEffect ) componentTransition.getTransitionEffect () ).setDirection ( direction );
            componentTransition.performTransition ( new WebImage ( images.get ( i ) ) );
        }
    }
View Full Code Here

    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Transition panel
        final ComponentTransition componentTransition = new ComponentTransition ();

        // Transition effects (one of them is choosen randomly when transition occurs)
        componentTransition.addTransitionEffect ( createFadeTransitionEffect () );
        componentTransition.addTransitionEffect ( createFadeCurtainEffect () );
        componentTransition.addTransitionEffect ( createFillCurtainEffect () );
        componentTransition.addTransitionEffect ( createHorizontalSlideCurtainEffect () );
        componentTransition.addTransitionEffect ( createVerticalSlideCurtainEffect () );
        componentTransition.addTransitionEffect ( createFadeBlockTransitionEffect () );
        componentTransition.addTransitionEffect ( createBlockTransitionEffect () );
        componentTransition.addTransitionEffect ( createFadeSlideTransitionEffect () );
        componentTransition.addTransitionEffect ( createSlideTransitionEffect () );
        componentTransition.addTransitionEffect ( createZoomTransitionEffect () );

        // Effects
        final WebImage image1 = new WebImage ( loadIcon ( "pictures/1.jpg" ) );
        final WebImage image2 = new WebImage ( loadIcon ( "pictures/2.jpg" ) );
        final WebImage image3 = new WebImage ( loadIcon ( "pictures/3.jpg" ) );

        // Initial transition panel state
        componentTransition.setContent ( image1 );
        componentTransition.setPreferredSize ( SwingUtils.max ( image1, image2 ) );

        // Images switch button
        final WebButton switchView = new WebButton ( loadIcon ( "switch.png" ) );
        switchView.setDrawFocus ( false );
        switchView.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( ActionEvent e )
            {
                if ( componentTransition.getContent () == image1 )
                {
                    componentTransition.performTransition ( image2 );
                }
                else if ( componentTransition.getContent () == image2 )
                {
                    componentTransition.performTransition ( image3 );
                }
                else
                {
                    componentTransition.performTransition ( image1 );
                }
            }
        } );
        componentTransition.addTransitionListener ( new TransitionListener ()
        {
            @Override
            public void transitionStarted ()
            {
                switchView.setEnabled ( false );
View Full Code Here

        // Jar class structure creation
        sourceViewer = new SourceViewer ( ExamplesManager.createJarStructure ( progress ) );

        // Content
        containerTransition = new ComponentTransition ( exampleTabs );
        containerTransition.setTransitionEffect ( new FadeTransitionEffect () );
        containerTransition.addTransitionListener ( new TransitionAdapter ()
        {
            @Override
            public void transitionFinished ()
            {
                // To show back tooltip once
                if ( !isSourceTipShownOnce () && containerTransition.getContent () == sourceViewer )
                {
                    // Marking the fact we already seen this tip
                    setSourceTipShownOnce ();

                    // Showing helpful tip
                    TooltipManager.showOneTimeTooltip ( locationBreadcrumb.getComponent ( 0 ), null, infoIcon,
                            "You can go back to demos at anytime " + "using this breadcrumb", TooltipWay.up );
                }
            }
        } );

        contentPane.add ( containerTransition, BorderLayout.CENTER );

        // Status bar
        contentPane.add ( createStatusBar (), BorderLayout.SOUTH );
        exampleTabs.setSelectedIndex ( 0 );

        // Base content
        appearanceTransition = new ComponentTransition ( createBackgroundPanel () )
        {
            @Override
            public Dimension getPreferredSize ()
            {
                return contentPane.getPreferredSize ();
View Full Code Here

        leftHeader.setOpaque ( false );
        leftHeader.add ( previousSkip, BorderLayout.WEST );
        leftHeader.add ( previous, BorderLayout.EAST );
        header.add ( leftHeader, BorderLayout.WEST );

        titlePanel = new ComponentTransition ( createTitleLabel () );
        titlePanel.setOpaque ( false );
        titlePanel.setTransitionEffect ( new FadeTransitionEffect () );
        titlePanel.addMouseListener ( new MouseAdapter ()
        {
            @Override
            public void mousePressed ( final MouseEvent e )
            {
                if ( SwingUtilities.isLeftMouseButton ( e ) )
                {
                    setShownDate ( new Date () );
                }
            }
        } );
        header.add ( titlePanel, BorderLayout.CENTER );

        next = WebButton.createIconWebButton ( nextIcon, StyleConstants.smallRound, true );
        next.setDrawFocus ( false );
        next.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                changeMonth ( 1 );
            }
        } );

        nextSkip = WebButton.createIconWebButton ( nextSkipIcon, StyleConstants.smallRound, true );
        nextSkip.setDrawFocus ( false );
        nextSkip.addActionListener ( new ActionListener ()
        {
            @Override
            public void actionPerformed ( final ActionEvent e )
            {
                changeYear ( 1 );
            }
        } );

        final WebPanel rightHeader = new WebPanel ( new BorderLayout () );
        rightHeader.setOpaque ( false );
        rightHeader.add ( next, BorderLayout.WEST );
        rightHeader.add ( nextSkip, BorderLayout.EAST );
        header.add ( rightHeader, BorderLayout.EAST );

        // Week days
        weekHeaders = new WebPanel ();
        weekHeaders.setUndecorated ( false );
        weekHeaders.setPaintSides ( true, false, true, false );
        weekHeaders.setShadeWidth ( 0 );
        weekHeaders.setOpaque ( false );
        weekHeaders.setMargin ( StyleConstants.shadeWidth, StyleConstants.shadeWidth - 1, StyleConstants.shadeWidth + 1,
                StyleConstants.shadeWidth - 1 );
        weekHeaders.setLayout ( new TableLayout ( new double[][]{
                { TableLayout.FILL, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED,
                        TableLayout.FILL, TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED, TableLayout.FILL,
                        TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.PREFERRED } } ) );
        centerPanel.add ( weekHeaders, BorderLayout.NORTH );
        updateWeekHeaders ();

        // Month days
        monthDays = createMonthPanel ();
        updateMonth ( monthDays );
        monthDaysTransition = new ComponentTransition ( monthDays );
        monthDaysTransition.setOpaque ( false );
        monthDaysTransition.addTransitionListener ( new TransitionAdapter ()
        {
            @Override
            public void transitionFinished ()
View Full Code Here

TOP

Related Classes of com.alee.extended.transition.ComponentTransition

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.