Package com.alee.laf.panel

Examples of com.alee.laf.panel.WebPanel


    @Override
    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Decorated panel
        WebPanel panel = new WebPanel ();
        panel.setUndecorated ( false );
        panel.setLayout ( new BorderLayout () );
        panel.setMargin ( 20 );
        panel.setRound ( StyleConstants.largeRound );

        panel.add ( new WebLabel ( "Decorated panel", WebLabel.CENTER ) );

        return new GroupPanel ( panel );
    }
View Full Code Here


        final Component form2 = createForm ();

        // Output area
        final TitledBorderPainter painter = new TitledBorderPainter ( "Focus changes:" );
        painter.setTitleAlignment ( SwingConstants.CENTER );
        final WebPanel panel = new WebPanel ( painter );
        final WebTextArea info = new WebTextArea ();
        info.setEditable ( false );
        info.setRows ( 1 );
        info.setMargin ( 5 );
        final WebScrollPane infoScroll = new WebScrollPane ( info );
        infoScroll.setPreferredWidth ( 150 );
        panel.add ( infoScroll );

        // Form #1 focus tracker
        // It tracks only focus loss/gain by form overall and doesn't inform about focus changes within the form
        focusTracker1 = new DefaultFocusTracker ( true )
        {
View Full Code Here

    private Component createForm ()
    {
        final TitledBorderPainter painter = new TitledBorderPainter ( "Form 1" );
        painter.setTitleAlignment ( SwingConstants.CENTER );

        final WebPanel panel = new WebPanel ( painter );
        panel.setMargin ( 5 );
        final double[][] constraints = { { TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED } };
        final TableLayout layout = new TableLayout ( constraints );
        layout.setHGap ( 5 );
        layout.setVGap ( 5 );
        panel.setLayout ( layout );

        panel.add ( new WebLabel ( "Field 1:" ), "0,0" );
        panel.add ( new WebTextField (), "1,0" );

        panel.add ( new WebLabel ( "Field 2:" ), "0,1" );
        panel.add ( new WebCheckBox ( "Some check" ), "1,1" );

        return panel;
    }
View Full Code Here

        // Image and loader lists
        final List<WebImage> images = CollectionUtils.copy ( createImage ( "1.png" ), createImage ( "2.png" ), createImage ( "3.png" ) );
        final List<WebLabel> loaders = CollectionUtils.copy ( createLoader (), createLoader (), createLoader () );

        // Images panel
        final WebPanel imagesPanel = new WebPanel ( new HorizontalFlowLayout ( 5, false ) );
        imagesPanel.addAncestorListener ( new AncestorAdapter ()
        {
            @Override
            public void ancestorAdded ( AncestorEvent event )
            {
                // 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 ()
View Full Code Here

    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Panel styled with nine-patch icon painter
        final WebPanel panel = new WebPanel ();
        panel.setPainter ( NinePatchUtils.loadNinePatchIconPainter ( getResource ( "panel.xml" ) ) );

        // Panel content
        final WebLabel label = new WebLabel ( "<html><center>Sample text inside styled panel<br>" +
                "Note that margins are automatically set by the image file</center></html>" );
        label.setHorizontalAlignment ( WebLabel.CENTER );
        label.setForeground ( Color.WHITE );
        panel.add ( label );

        return panel;
    }
View Full Code Here

    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Left part content
        WebLabel leftLabel = new WebLabel ( "left", WebLabel.CENTER );
        leftLabel.setMargin ( 5 );
        WebPanel leftPanel = new WebPanel ( true, leftLabel );

        // Right part content
        WebLabel rightLabel = new WebLabel ( "right", WebLabel.CENTER );
        rightLabel.setMargin ( 5 );
        WebPanel rightPanel = new WebPanel ( true, rightLabel );

        // Split
        WebSplitPane splitPane = new WebSplitPane ( HORIZONTAL_SPLIT, leftPanel, rightPanel );
        splitPane.setOneTouchExpandable ( true );
        splitPane.setPreferredSize ( new Dimension ( 250, 200 ) );
View Full Code Here

    public Component getPreview ( WebLookAndFeelDemo owner )
    {
        // Top part content
        WebLabel topLabel = new WebLabel ( "top", WebLabel.CENTER );
        topLabel.setMargin ( 5 );
        WebPanel topPanel = new WebPanel ( true, topLabel );

        // Bottom part content
        WebLabel bottomLabel = new WebLabel ( "bottom", WebLabel.CENTER );
        bottomLabel.setMargin ( 5 );
        WebPanel bottomPanel = new WebPanel ( true, bottomLabel );

        // Split
        WebSplitPane splitPane = new WebSplitPane ( VERTICAL_SPLIT, topPanel, bottomPanel );
        splitPane.setOneTouchExpandable ( true );
        splitPane.setPreferredSize ( new Dimension ( 250, 200 ) );
View Full Code Here

        itemsAmount = new WebTextField ( new IntTextDocument (), "5", 4 );
        final GroupPanel iag = new GroupPanel ( 5, new WebLabel ( "Items amount:" ), itemsAmount );

        drawBorder = new WebCheckBox ( "Show custom border", true );

        final WebPanel clickPanel = new WebPanel ( true );
        clickPanel.setWebColoredBackground ( false );
        clickPanel.setShadeWidth ( 20 );
        clickPanel.setBackground ( Color.WHITE );
        clickPanel.add ( new WebLabel ( "Click with left mouse button here to show menu", WebLabel.CENTER ) );
        clickPanel.addMouseListener ( new MouseAdapter ()
        {
            @Override
            public void mousePressed ( final MouseEvent e )
            {
                if ( SwingUtils.isLeftMouseButton ( e ) )
View Full Code Here

    @Override
    public Component getPreview ( final WebLookAndFeelDemo owner )
    {
        // Panel with focusable field
        final WebPanel panel1 = new WebPanel ( true );
        panel1.setPaintFocus ( true );
        panel1.setMargin ( 10 );
        panel1.add ( new WebLabel ( "Some field:", WebLabel.CENTER ), BorderLayout.NORTH );
        panel1.add ( new WebTextField ( "TextField", 6 ), BorderLayout.CENTER );

        // Panel with focusable button
        final WebPanel panel2 = new WebPanel ( true );
        panel2.setPaintFocus ( true );
        panel2.setMargin ( 10 );
        panel2.add ( new WebLabel ( "Some button:", WebLabel.CENTER ), BorderLayout.NORTH );
        panel2.add ( new WebButton ( "Button" ), BorderLayout.CENTER );

        // Panel with focusable combobox
        final WebPanel panel3 = new WebPanel ( true );
        panel3.setPaintFocus ( true );
        panel3.setMargin ( 10 );
        panel3.add ( new WebLabel ( "Some combo:", WebLabel.CENTER ), BorderLayout.NORTH );
        panel3.add ( new WebComboBox ( new String[]{ "ComboBox" } ), BorderLayout.CENTER );

        // Equalizing panel widths
        SwingUtils.equalizeComponentsWidths ( panel1, panel2, panel3 );

        return new GroupPanel ( 4, panel1, panel2, panel3 );
View Full Code Here

        return new GroupPanel ( createFirstPanel (), createSecondPanel () );
    }

    private WebPanel createFirstPanel ()
    {
        final WebPanel panel = new WebPanel ();
        panel.setUndecorated ( false );
        panel.setLayout ( new BorderLayout () );
        panel.setWebColoredBackground ( false );

        final WebPanel northPanel = new WebPanel ();
        northPanel.setPaintSides ( false, false, true, false );
        setupPanel ( northPanel, NORTH );
        panel.add ( northPanel, BorderLayout.NORTH );

        final WebPanel southPanel = new WebPanel ();
        southPanel.setPaintSides ( true, false, false, false );
        setupPanel ( southPanel, SOUTH );
        panel.add ( southPanel, BorderLayout.SOUTH );

        final WebPanel leadingPanel = new WebPanel ();
        leadingPanel.setPaintLeft ( false );
        setupPanel ( leadingPanel, WEST );
        panel.add ( leadingPanel, BorderLayout.LINE_START );

        final WebPanel trailingPanel = new WebPanel ();
        trailingPanel.setPaintRight ( false );
        setupPanel ( trailingPanel, EAST );
        panel.add ( trailingPanel, BorderLayout.LINE_END );

        final WebPanel centerPanel = new WebPanel ();
        setupPanel ( centerPanel, CENTER );
        panel.add ( centerPanel, BorderLayout.CENTER );

        return panel;
    }
View Full Code Here

TOP

Related Classes of com.alee.laf.panel.WebPanel

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.