Package com.alee.extended.layout

Examples of com.alee.extended.layout.ComponentPanelLayout


        // Default styling
        setWebColoredBackground ( false );

        // Elements layout
        container = new WebPanel ();
        container.setLayout ( new ComponentPanelLayout () );
        add ( container, BorderLayout.CENTER );

        // Previous action hotkeys
        final HotkeyRunnable prevAction = new HotkeyRunnable ()
        {
View Full Code Here


                @Override
                public void mouseReleased ( final MouseEvent e )
                {
                    final WebSelectablePanel wsp = WebSelectablePanel.this;
                    final ComponentPanelLayout cpl = getContainerLayout ();
                    if ( SwingUtilities.isLeftMouseButton ( e ) && dragged )
                    {
                        // Stop drag
                        dragged = false;

                        // Update if needed
                        if ( getY () - startY == 0 || cpl.getComponents ().size () <= 1 )
                        {
                            // Ignore drag if there is only 1 component or change is zero 
                            cpl.setComponentShift ( wsp, null );
                        }
                        else
                        {
                            // Dragged panel index and middle
                            final int oldIndex = cpl.indexOf ( wsp );
                            final int middle = getMiddleY ( wsp );

                            // Searching for insert index
                            int insertIndex = 0;
                            for ( final Component component : cpl.getComponents () )
                            {
                                if ( component != wsp && middle > getMiddleY ( component ) )
                                {
                                    insertIndex = cpl.indexOf ( component ) + 1;
                                }
                            }

                            // Fix index
                            if ( insertIndex > oldIndex )
                            {
                                insertIndex--;
                            }

                            // Resetting shift
                            cpl.setComponentShift ( wsp, null );

                            // Changing panel location if it has actually changed
                            if ( oldIndex != insertIndex )
                            {
                                // Updating panel indices
                                cpl.removeLayoutComponent ( wsp );
                                cpl.insertLayoutComponent ( insertIndex, wsp );
                                updateAllBorders ();

                                // Informing all listeners
                                fireComponentOrderChanged ( wsp.getComponent (), oldIndex, insertIndex );
                            }
View Full Code Here

TOP

Related Classes of com.alee.extended.layout.ComponentPanelLayout

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.