com.alee.utils.SwingUtils Java Examples

The following examples show how to use com.alee.utils.SwingUtils. 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: UISystemProxyConfirmationSupport.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean shouldUseSystemProxy ()
{
    // Whether should save the choice or not
    alwaysDoTheSame = new WebCheckBox ();
    alwaysDoTheSame.setLanguage ( "weblaf.proxy.use.system.save" );
    alwaysDoTheSame.setSelected ( false );
    alwaysDoTheSame.setFocusable ( false );

    // Ask for settings replacement with system ones
    final String message = LM.get ( "weblaf.proxy.use.system.text" );
    final String title = LM.get ( "weblaf.proxy.use.system.title" );
    final int options = WebExtendedOptionPane.YES_NO_OPTION;
    final int type = WebExtendedOptionPane.QUESTION_MESSAGE;
    final WebExtendedOptionPane dialog =
            WebExtendedOptionPane.showConfirmDialog ( SwingUtils.getActiveWindow (), message, alwaysDoTheSame, title, options, type );

    return dialog.getResult () == WebOptionPane.YES_OPTION;
}
 
Example #2
Source File: WebDateFieldUI.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Uninstalls date field UI elements.
 */
protected void uninstallComponents ()
{
    dateField.removeAll ();
    dateField.revalidate ();
    dateField.repaint ();

    if ( calendar != null )
    {
        calendar.resetStyleId ();
        calendar = null;
    }
    if ( popup != null )
    {
        popup.resetStyleId ();
        popup = null;
    }
    button.resetStyleId ();
    button = null;
    field.resetStyleId ();
    field = null;

    SwingUtils.removeHandlesEnableStateMark ( dateField );
}
 
Example #3
Source File: ProgressBarPainter.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@NotNull
@Override
public Dimension getPreferredSize ()
{
    // Minimum size
    final Dimension min = getMinimumContentSize ();
    int w = min.width;
    int h = min.height;

    // Text size
    // todo Retrieve size from painter
    if ( component.isStringPainted () )
    {
        final boolean hor = isHorizontal ();
        final FontMetrics fontSizer = component.getFontMetrics ( component.getFont () );
        final String progString = component.getString ();
        final int stringWidth = SwingUtils.stringWidth ( fontSizer, progString );
        final int stringHeight = fontSizer.getHeight () + fontSizer.getDescent ();
        w = Math.max ( w, hor ? stringWidth : stringHeight );
        h = Math.max ( h, hor ? stringHeight : stringWidth );
    }

    // Final size
    final Insets border = component.getInsets ();
    return new Dimension ( border.left + w + border.right, border.top + h + border.bottom );
}
 
Example #4
Source File: WLabelInputListener.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Performs on-release action.
 *
 * @param label {@link JLabel}
 */
protected void doRelease ( final L label )
{
    final Component labelFor = label.getLabelFor ();
    if ( labelFor != null && labelFor.isEnabled () )
    {
        final InputMap inputMap = SwingUtilities.getUIInputMap ( label, JComponent.WHEN_FOCUSED );
        if ( inputMap != null )
        {
            inputMap.remove ( KeyStroke.getKeyStroke ( label.getDisplayedMnemonic (), ActionEvent.ALT_MASK, true ) );
            inputMap.remove ( KeyStroke.getKeyStroke ( KeyEvent.VK_ALT, 0, true ) );
        }

        if ( labelFor instanceof Container && ( ( Container ) labelFor ).isFocusCycleRoot () )
        {
            labelFor.requestFocus ();
        }
        else
        {
            SwingUtils.compositeRequestFocus ( labelFor );
        }
    }
}
 
Example #5
Source File: AccordionPane.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Replaces content {@link Component}.
 *
 * @param content new content {@link Component}
 */
public void setContent ( @Nullable final Component content )
{
    if ( this.content != content )
    {
        if ( this.content != null )
        {
            remove ( this.content );
        }
        this.content = content;
        if ( this.content != null )
        {
            add ( this.content );
        }
        SwingUtils.update ( this );
    }
}
 
Example #6
Source File: WebGradientColorChooser.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void mouseClicked ( final MouseEvent e )
{
    if ( !isEnabled () )
    {
        return;
    }

    // Displaying color chooser dialog on double-click
    if ( SwingUtils.isDoubleClick ( e ) )
    {
        final GradientColorData colorData = getColorDataUnderPoint ( e.getPoint () );
        if ( colorData != null )
        {
            final Color newColor = WebColorChooser.showDialog ( WebGradientColorChooser.this, colorData.getColor () );
            if ( newColor != null )
            {
                // Updating color
                colorData.setColor ( newColor );

                fireStateChanged ();
                repaint ();
            }
        }
    }
}
 
Example #7
Source File: DictionariesTransferHandler.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
public DictionariesTransferHandler ( final DictionariesTree tree )
{
    super ();
    this.tree = tree;

    tree.addMouseMotionListener ( new MouseAdapter ()
    {
        @Override
        public void mouseDragged ( final MouseEvent e )
        {
            if ( SwingUtilities.isLeftMouseButton ( e ) )
            {
                exportAsDrag ( DictionariesTransferHandler.this.tree, e,
                        SwingUtils.isCtrl ( e ) ? TransferHandler.COPY : TransferHandler.MOVE );
            }
        }
    } );
}
 
Example #8
Source File: DynamicMenuLayout.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
protected void layoutPlainMenu ( final WebDynamicMenu menu, final float displayProgress, final DynamicMenuType type )
{
    final Dimension max = SwingUtils.maxPreferredSize ( menu.getComponents () );
    final int itemsCount = menu.getComponentCount ();

    switch ( type )
    {
        case list:
        {
            final int x = 0;
            int y = 0;
            for ( int i = 0; i < itemsCount; i++ )
            {
                placePlainElement ( menu, i, x, y );
                y += max.height * displayProgress;
            }
        }
        break;
    }
}
 
Example #9
Source File: WebDockableFrameUI.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Requests focus for frame content if possible.
 */
protected void requestFocusInFrame ()
{
    CoreSwingUtils.invokeLater ( new Runnable ()
    {
        @Override
        public void run ()
        {
            if ( !SwingUtils.hasFocusOwner ( frame ) )
            {
                final Component component = SwingUtils.findFocusableComponent ( frame );
                if ( component != null )
                {
                    // Pass focus to the first focusable component within container
                    component.requestFocusInWindow ();
                }
                else
                {
                    // Pass focus onto the frame itself
                    // Normally focus will never get onto the frame, but we can still use it when we have no other options
                    frame.requestFocusInWindow ();
                }
            }
        }
    } );
}
 
Example #10
Source File: WebAccordionModel.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Collapses {@link AccordionPane} with the specified identifier without any additional checks.
 * This method is intended for internal use only to avoid issues with overlapping minimum/maximum conditions.
 *
 * @param id {@link AccordionPane} identifier
 */
protected void collapseUnconditionally ( @NotNull final String id )
{
    getPaneState ( id ).setExpanded ( false );

    final WebAccordion accordion = getAccordion ();
    final AccordionPane pane = accordion.getPane ( id );

    final AccordionLayout layout = accordion.getLayout ();
    if ( layout != null )
    {
        layout.collapsePane ( accordion, id );
    }
    else
    {
        pane.fireCollapsing ( accordion );
        accordion.fireCollapsing ( pane );
        SwingUtils.update ( accordion );
        pane.fireCollapsed ( accordion );
        accordion.fireCollapsed ( pane );
    }
}
 
Example #11
Source File: EventMethodsImpl.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Shortcut method for mouse event triggering popup menu.
 *
 * @param component component to handle events for
 * @param runnable  mouse event runnable
 * @return created {@link MouseAdapter}
 */
@NotNull
public static MouseAdapter onMenuTrigger ( @NotNull final Component component, @NotNull final MouseEventRunnable runnable )
{
    final MouseAdapter mouseAdapter = new MouseAdapter ()
    {
        @Override
        public void mousePressed ( @NotNull final MouseEvent e )
        {
            if ( SwingUtils.isRightMouseButton ( e ) )
            {
                runnable.run ( e );
            }
        }
    };
    component.addMouseListener ( mouseAdapter );
    return mouseAdapter;
}
 
Example #12
Source File: WSplitPaneInputListener.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Toggles focus between split pane sides.
 *
 * @param splitPane {@link JSplitPane}
 */
protected void toggleFocus ( @NotNull final S splitPane )
{
    final Component left = splitPane.getLeftComponent ();
    final Component right = splitPane.getRightComponent ();
    final KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
    final Component focus = manager.getFocusOwner ();
    final Component focusOn = getNextSide ( splitPane, focus );
    if ( focusOn != null )
    {
        /**
         * Don't change the focus if the new focused component belongs to the same splitpane and the same side.
         */
        if ( focus == null ||
                !( SwingUtilities.isDescendingFrom ( focus, left ) && SwingUtilities.isDescendingFrom ( focusOn, left ) ||
                        SwingUtilities.isDescendingFrom ( focus, right ) && SwingUtilities.isDescendingFrom ( focusOn, right ) ) )
        {
            SwingUtils.compositeRequestFocus ( focusOn );
        }
    }
}
 
Example #13
Source File: EventMethodsImpl.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Shortcut method for double-click mouse event.
 *
 * @param component component to handle events for
 * @param runnable  mouse event runnable
 * @return created {@link MouseAdapter}
 */
@NotNull
public static MouseAdapter onDoubleClick ( @NotNull final Component component, @NotNull final MouseEventRunnable runnable )
{
    final MouseAdapter mouseAdapter = new MouseAdapter ()
    {
        @Override
        public void mouseClicked ( @NotNull final MouseEvent e )
        {
            if ( SwingUtils.isDoubleClick ( e ) )
            {
                runnable.run ( e );
            }
        }
    };
    component.addMouseListener ( mouseAdapter );
    return mouseAdapter;
}
 
Example #14
Source File: SizeCache.java    From weblaf with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns maximum {@link Dimension} combined from maximum sizes of all {@link Container}'s children.
 *
 * @param container {@link Container}
 * @param cache     {@link SizeCache} to reuse sizes from
 * @return maximum {@link Dimension} combined from maximum sizes of all {@link Container}'s children
 */
public Dimension maxMaximum ( @NotNull final Container container, @NotNull final SizeCache cache )
{
    if ( preferred == null )
    {
        preferred = new Dimension ( 0, 0 );
        for ( int index = 0; index < container.getComponentCount (); index++ )
        {
            preferred = SwingUtils.maxNonNull (
                    preferred,
                    cache.maximum ( container, index )
            );
        }
    }
    return preferred;
}
 
Example #15
Source File: AbstractTextFieldPainter.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Installs custom field settings.
 */
protected void installCustomSettings ()
{
    // Configuring enabled state handling
    SwingUtils.setHandlesEnableStateMark ( component );

    // Installing custom field layout that can handle leading and trailing components
    component.setLayout ( new TextFieldLayout ( this ) );
}
 
Example #16
Source File: AbstractTextContent.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void paintContent ( @NotNull final Graphics2D g2d, @NotNull final C c, @NotNull final D d, @NotNull final Rectangle bounds )
{
    // Ensure that text painting is allowed
    if ( !isEmpty ( c, d ) )
    {
        // Applying graphics settings
        final Font oldFont = GraphicsUtils.setupFont ( g2d, getFont ( c, d ) );

        // Installing text antialias settings
        final TextRasterization rasterization = getRasterization ( c, d );
        final Map oldHints = SwingUtils.setupTextAntialias ( g2d, rasterization );

        // Paint color
        final Paint op = GraphicsUtils.setupPaint ( g2d, getColor ( c, d ) );

        // Painting either HTML or plain text
        if ( isHtmlText ( c, d ) )
        {
            paintHtml ( g2d, c, d, bounds );
        }
        else
        {
            final int shadowWidth = isShadow ( c, d ) ? getShadowSize ( c, d ) : 0;
            bounds.x += shadowWidth;
            bounds.width -= shadowWidth * 2;
            paintText ( g2d, c, d, bounds );
        }

        // Restoring paint color
        GraphicsUtils.restorePaint ( g2d, op );

        // Restoring text antialias settings
        SwingUtils.restoreTextAntialias ( g2d, oldHints );

        // Restoring graphics settings
        GraphicsUtils.restoreFont ( g2d, oldFont );
    }
}
 
Example #17
Source File: ComponentTransition.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
protected void continueTransitionImpl ( final Component content, final int width, final int height,
                                        final BufferedImage currentSnapshot )
{
    // New content image
    removeAll ();
    if ( content != null )
    {
        add ( content, StackLayout.HIDDEN );
    }

    // Creating snapshot before removing all components
    final BufferedImage otherSnapshot = SwingUtils.createComponentSnapshot ( content, width, height );

    // Transition panel
    removeAll ();
    transition = new ImageTransition ( currentSnapshot, otherSnapshot );
    transition.setTransitionEffects ( transitionEffects );
    add ( transition );
    revalidate ();
    repaint ();

    // After-transition actions
    transition.addTransitionListener ( new TransitionListener ()
    {
        @Override
        public void transitionStarted ()
        {
            fireTransitionStarted ();
        }

        @Override
        public void transitionFinished ()
        {
            finishTransitionImpl ( content );
        }
    } );

    // Start transition
    transition.performTransition ();
}
 
Example #18
Source File: WebSwitch.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initializes switch animator.
 */
protected void createAnimator ()
{
    animator = new WebTimer ( "WebSwitch.animator", SwingUtils.frameRateDelay ( 60 ), new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            // Updating gripper location
            gripperLocation = gripperLocation + ( selected ? 0.1f : -0.1f );

            // Checking what to do
            if ( selected && gripperLocation >= 1f || !selected && gripperLocation <= 0f )
            {
                // Updating final gripper and view
                gripperLocation = selected ? 1f : 0f;
                revalidate ();

                // Finishing animation
                animating = false;
                animator.stop ();
            }
            else
            {
                // Updating view
                revalidate ();
            }
        }
    } );
}
 
Example #19
Source File: OverlayLayout.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void layoutContainer ( @NotNull final Container parent )
{
    final WebOverlay container = ( WebOverlay ) parent;
    final Insets overlayPadding = container.getInsets ();
    final Insets contentPadding = SwingUtils.increase ( overlayPadding, getOverlaysPadding ( container ) );
    final Rectangle contentBounds = new Rectangle (
            contentPadding.left,
            contentPadding.top,
            container.getWidth () - contentPadding.left - contentPadding.right,
            container.getHeight () - contentPadding.top - contentPadding.bottom
    );

    // Laying out content
    final JComponent content = container.getContent ();
    if ( content != null )
    {
        container.setComponentZOrder ( content, container.getComponentCount () - 1 );
        content.setBounds ( contentBounds );
    }

    // Laying out overlays
    for ( final Overlay overlay : container.getOverlays () )
    {
        // Each overlay is aligned according to it's own extra padding
        final Insets padding = overlay.margin ();
        overlay.component ().setBounds (
                overlay.bounds (
                        container,
                        content,
                        new Rectangle (
                                contentBounds.x - padding.left,
                                contentBounds.y - padding.top,
                                contentBounds.width + padding.left + padding.right,
                                contentBounds.height + padding.top + padding.bottom
                        )
                )
        );
    }
}
 
Example #20
Source File: AbstractGroupingLayout.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns descriptors for painted {@link Component} sides and lines.
 *
 * @param component painted {@link Component}
 * @return descriptors for painted {@link Component} sides and lines
 */
@NotNull
protected Pair<String, String> getDescriptors ( @NotNull final Component component )
{
    Pair<String, String> pair;
    if ( children != null )
    {
        pair = children.get ( component );
        if ( pair == null || pair.getKey () == null )
        {
            final Container parent = component.getParent ();
            if ( parent != null && isGrouping () )
            {
                pair = getDescriptors ( parent, component, SwingUtils.indexOf ( parent, component ) );
            }
            else
            {
                pair = new Pair<String, String> ();
            }
            children.put ( component, pair );
        }
    }
    else
    {
        pair = new Pair<String, String> ();
    }
    return pair;
}
 
Example #21
Source File: DefaultTransitionEffect.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Default methods
 */

@Override
public long getAnimationDelay ()
{
    return SwingUtils.frameRateDelay ( 36 );
}
 
Example #22
Source File: WebSplitButton.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the popup menu to be displayed, when the split part of the button is clicked.
 *
 * @param popupMenu popup menu to be displayed, when the split part of the button is clicked
 */
public void setPopupMenu ( final JPopupMenu popupMenu )
{
    final JPopupMenu old = this.popupMenu;
    this.popupMenu = popupMenu;
    SwingUtils.firePropertyChanged ( this, POPUP_MENU_PROPERTY, old, popupMenu );
}
 
Example #23
Source File: OverlayLayout.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns maximum overlays padding.
 *
 * @param container {@link WebOverlay}
 * @return maximum overlays padding
 */
@NotNull
protected Insets getOverlaysPadding ( @NotNull final WebOverlay container )
{
    Insets maxMargin = new Insets ( 0, 0, 0, 0 );
    for ( final Overlay overlay : container.getOverlays () )
    {
        maxMargin = SwingUtils.maxNonNull ( maxMargin, overlay.margin () );
    }
    return maxMargin;
}
 
Example #24
Source File: AbstractContent.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
@NotNull
@Override
public Dimension getPreferredSize ( @NotNull final C c, @NotNull final D d, @NotNull final Dimension available )
{
    // Actual padding
    final Insets padding = getPadding ( c, d );

    // Actial rotation
    final Rotation rotation = getActualRotation ( c, d );

    // Calculating proper available width
    // We have to take padding and rotation into account here
    final Dimension shrunk = SwingUtils.shrink ( available, padding );
    final Dimension transposed = rotation.transpose ( shrunk );

    // Calculating content preferred size
    final Dimension ps;
    final Dimension hardcoded = getSize ( c, d );
    if ( hardcoded != null )
    {
        // Make sure to apply rotation to the preferred size
        ps = rotation.transpose ( hardcoded );
    }
    else
    {
        // Calculate dynamic preferred size
        ps = getContentPreferredSize ( c, d, transposed );
    }

    // Adding content padding
    final Dimension stretched = SwingUtils.stretch ( ps, padding );
    return rotation.transpose ( stretched );
}
 
Example #25
Source File: AbstractTextFieldPainter.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Uninstalls custom field settings.
 */
protected void uninstallCustomLayout ()
{
    // Uninstalling custom layout from the field
    component.setLayout ( null );

    // Restoring enabled state handling
    SwingUtils.removeHandlesEnableStateMark ( component );
}
 
Example #26
Source File: AbstractTextContent.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns preferred text size.
 *
 * @param c         painted component
 * @param d         painted decoration state
 * @param available theoretically available space for this content
 * @return preferred text size
 */
@NotNull
protected Dimension getPreferredTextSize ( @NotNull final C c, @NotNull final D d, @NotNull final Dimension available )
{
    final String text = getText ( c, d );
    final FontMetrics fm = getFontMetrics ( c, d );
    final int w = SwingUtils.stringWidth ( fm, text );
    final int h = fm.getHeight ();
    return new Dimension ( w, h );
}
 
Example #27
Source File: DecorationUtils.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Informs about {@link Component} decoration border changes.
 *
 * @param component {@link Component} decoration border changed for
 */
public static void fireBorderChanged ( @Nullable final Component component )
{
    if ( component instanceof JComponent )
    {
        SwingUtils.firePropertyChanged ( component, AbstractDecorationPainter.DECORATION_BORDER_PROPERTY, null, null );
    }
}
 
Example #28
Source File: PainterSupport.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets {@link JComponent} margin.
 * {@code null} can be provided to set an empty [0,0,0,0] margin.
 *
 * @param component {@link JComponent} to set margin for
 * @param margin    new margin
 */
public static void setMargin ( @NotNull final JComponent component, @Nullable final Insets margin )
{
    final Insets oldMargin = margins.get ( component );
    if ( oldMargin == null || oldMargin instanceof UIResource || !( margin instanceof UIResource ) )
    {
        // Updating margin cache
        margins.set ( component, margin );

        // Notifying everyone about component margin changes
        SwingUtils.firePropertyChanged ( component, WebLookAndFeel.LAF_MARGIN_PROPERTY, oldMargin, margin );
    }
}
 
Example #29
Source File: PainterSupport.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets {@link Painter} for the specified {@link JComponent}.
 * Provided {@link Painter} can be {@code null} in which case current {@link Painter} will simply be uninstalled.
 *
 * @param component   {@link JComponent}
 * @param componentUI {@link ComponentUI}
 * @param painter     {@link Painter} to install
 */
public static void setPainter ( @NotNull final JComponent component, @NotNull final ComponentUI componentUI,
                                @Nullable final Painter painter )
{
    final ComponentDescriptor descriptor = StyleManager.getDescriptor ( component );

    // Creating adaptive painter if required
    final SpecificPainter newPainter = getApplicablePainter (
            painter,
            descriptor.getPainterInterface (),
            descriptor.getPainterAdapterClass ()
    );

    // Uninstalling old painter
    final Painter oldPainter = installedPainters.get ( component );
    if ( oldPainter != null )
    {
        oldPainter.uninstall ( component, componentUI );
        installedPainters.clear ( component );
    }

    // Installing new painter
    if ( newPainter != null )
    {
        // Installing painter
        newPainter.install ( component, componentUI );
        installedPainters.set ( component, newPainter );

        // Applying initial component settings
        final Boolean opaque = newPainter.isOpaque ();
        if ( opaque != null )
        {
            LookAndFeel.installProperty ( component, WebLookAndFeel.OPAQUE_PROPERTY, opaque ? Boolean.TRUE : Boolean.FALSE );
        }
    }

    // Firing painter change event
    SwingUtils.firePropertyChanged ( component, WebLookAndFeel.PAINTER_PROPERTY, oldPainter, newPainter );
}
 
Example #30
Source File: SlidingLayout.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
public void slideOut ()
{
    if ( animator != null && animator.isRunning () )
    {
        animator.stop ();
    }

    slideY = height;
    animator = new WebTimer ( "SlidingLayout.slideOutTimer", SwingUtils.frameRateDelay ( 36 ), new ActionListener ()
    {
        @Override
        public void actionPerformed ( final ActionEvent e )
        {
            if ( slideY > 0 )
            {
                slideY -= slideSpeed;
                container.revalidate ();
            }
            else
            {
                slideY = 0;
                animator.stop ();
            }
        }
    } );
    animator.start ();
}