Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.plaf.common
Class ShadowPopupBorder

    java.lang.Object
      com.jgoodies.plaf.common.ShadowPopupBorder

All Implemented Interfaces:
  Border

public final class ShadowPopupBorder
extends Object
implements Border

A border with a nice looking drop shadow, intended to be used as the outer border of popup menus. Can snapshot and paint the screen background if used with heavy-weight popup windows.

Version:
  $Revision: 1.2 $
Author:
  Stefan Matthias Aust, Karsten Lentzsch
See Also:
  `ShadowPopupMenuUtils`, `Robot`

Constructor Summary
`ShadowPopupBorder()`

Method Summary
`static void` | `clearSnapshot()` The next time the border is drawn no background snaphot is used.
`Insets` | `getBorderInsets(Component c)` Returns the insets of the border.
`static ShadowPopupBorder` | `getInstance()` Returns the singleton instance used to draw all borders.
`boolean` | `isBorderOpaque()` Returns whether or not the border is opaque.
`static void` | `makeSnapshot(JWindow window)` Snapshots the background.
`void` | `paintBorder(Component c, Graphics g, int x, int y, int width, int height)` Paints the border for the specified component with the specified position and size.
`static void` | `setActive(boolean b)` Activates or deactivates the drop shadow feature.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ShadowPopupBorder

    public ShadowPopupBorder()

Method Detail

### getInstance

    public static ShadowPopupBorder getInstance()

  Returns the singleton instance used to draw all borders.

### setActive

    public static void setActive(boolean b)

  Activates or deactivates the drop shadow feature.

  Parameters:
    `b` - true to activate, false to deactivate drop shadows

### clearSnapshot

    public static void clearSnapshot()

  The next time the border is drawn no background snaphot is used.

### makeSnapshot

    public static void makeSnapshot(JWindow window)

  Snapshots the background. The next time the border is drawn, this background will be used.

  Uses a robot on the default screen device to capture the screen region under the drop shadow. Does not use the window's device, because that may be an outdated device (due to popup reuse) and the robot's origin seems to be adjusted with the default screen device.

  Unfortunately under certain circumstances we don't get the background but a previous menu, still on the screen. Use light weight menus to work around this limitation.

### isBorderOpaque

    public boolean isBorderOpaque()

  Returns whether or not the border is opaque. The drop shadow is obviously not opaque.

  Specified by:
    `isBorderOpaque` in interface `Border`

### paintBorder

    public void paintBorder(Component c,
                            Graphics g,
                            int x,
                            int y,
                            int width,
                            int height)

  Paints the border for the specified component with the specified position and size. Does nothing if the drop shadow is inactive.

  Specified by:
    `paintBorder` in interface `Border`

### getBorderInsets

    public Insets getBorderInsets(Component c)

  Returns the insets of the border. If the drop shadow feature is inactive, empty insets are used.

  Specified by:
    `getBorderInsets` in interface `Border`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2004 JGoodies Karsten Lentzsch. All Rights Reserved.