org.bounce
Class QPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.bounce.QPanel
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
public class QPanel
- extends JPanel
Extend the JPanel class, this panel allows for a
background image that can be centered, tiled, anchored in a corner
or stretched. The panel also allows for a diagonal gradient filled
background, for a very subtle 3D effect.
- Version:
- $Revision: 1.7 $, $Date: 2008/01/28 21:28:37 $
- Author:
- Edwin Dankert
- See Also:
- Serialized Form
Field Summary |
static int |
BOTTOM_LEFT
Place the background image bottom left |
static int |
BOTTOM_RIGHT
Place the background image bottom right |
static int |
CENTERED
The center the background image |
static int |
STRETCHED
Stretch the background image |
static int |
TILED
Tile the background image |
static int |
TOP_LEFT
Place the background image top left |
static int |
TOP_RIGHT
Place the background image top right |
Constructor Summary |
QPanel()
Constructor, calls the super constructor. |
QPanel(boolean isDoubleBuffered)
Constructor, calls the super constructor. |
QPanel(LayoutManager layout)
Constructor, calls the super constructor. |
QPanel(LayoutManager layout,
boolean isDoubleBuffered)
Constructor, calls the super constructor. |
Method Summary |
ImageIcon |
getBackgroundImage()
Returns this panel's background image. |
int |
getBackgroundImageMode()
Returns the mode in which the background image is displayed. |
Color |
getGradientColor()
Returns the color used for the lower right corner of the gradient
3D effect. |
boolean |
isGradientBackground()
Returns whether the 'subtle' 3D gradient effect is enabled. |
void |
setBackgroundImage(ImageIcon image)
Sets the background image for this panel. |
void |
setBackgroundImageMode(int mode)
Sets the way the background image is displayed, it can be
any of the following modes:
CENTERED, The middle of the image is anchored in the middle
of the panel, when the image is bigger than the panel, the
image will be clipped. |
void |
setGradientBackground(boolean enable)
Enables the filling of the background gradually to achieve a
'subtle' 3D effect. |
void |
setGradientColor(Color color)
Sets the color used for the lower right corner of the gradient
3D effect. |
void |
updateUI()
Sets the look and feel to the Bounce Panel UI look and feel. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle |
CENTERED
public static final int CENTERED
- The center the background image
- See Also:
- Constant Field Values
TOP_LEFT
public static final int TOP_LEFT
- Place the background image top left
- See Also:
- Constant Field Values
TOP_RIGHT
public static final int TOP_RIGHT
- Place the background image top right
- See Also:
- Constant Field Values
BOTTOM_LEFT
public static final int BOTTOM_LEFT
- Place the background image bottom left
- See Also:
- Constant Field Values
BOTTOM_RIGHT
public static final int BOTTOM_RIGHT
- Place the background image bottom right
- See Also:
- Constant Field Values
TILED
public static final int TILED
- Tile the background image
- See Also:
- Constant Field Values
STRETCHED
public static final int STRETCHED
- Stretch the background image
- See Also:
- Constant Field Values
QPanel
public QPanel()
- Constructor, calls the super constructor.
QPanel
public QPanel(boolean isDoubleBuffered)
- Constructor, calls the super constructor.
- Parameters:
isDoubleBuffered
- is double buffered.
QPanel
public QPanel(LayoutManager layout)
- Constructor, calls the super constructor.
- Parameters:
layout
- the layout manager.
QPanel
public QPanel(LayoutManager layout,
boolean isDoubleBuffered)
- Constructor, calls the super constructor.
- Parameters:
layout
- the layout manager.isDoubleBuffered
- is double buffered.
updateUI
public void updateUI()
- Sets the look and feel to the Bounce Panel UI look and feel.
Override this method if you want to install a different UI.
- Overrides:
updateUI
in class JPanel
setGradientBackground
public void setGradientBackground(boolean enable)
- Enables the filling of the background gradually to achieve a
'subtle' 3D effect. It starts in the top left hand corner with the
background color and ends in the bottom right hand corner with the
gradient color or if this color is null with a darker version of
the background color.
- Parameters:
enable
- the gradient filling of the background when true.
isGradientBackground
public boolean isGradientBackground()
- Returns whether the 'subtle' 3D gradient effect is enabled.
- Returns:
- true when the gradient filling of the background is enabled.
getGradientColor
public Color getGradientColor()
- Returns the color used for the lower right corner of the gradient
3D effect. When the color is null, a darker version of the
background color is used instead.
- Returns:
- the color for the lower right corner.
setGradientColor
public void setGradientColor(Color color)
- Sets the color used for the lower right corner of the gradient
3D effect. When the color is null, a darker version of the
background color is used instead.
- Parameters:
color
- the color for the lower right corner.
setBackgroundImage
public void setBackgroundImage(ImageIcon image)
- Sets the background image for this panel.
- Parameters:
image
- the background image.
getBackgroundImage
public ImageIcon getBackgroundImage()
- Returns this panel's background image.
- Returns:
- the background image.
setBackgroundImageMode
public void setBackgroundImageMode(int mode)
- Sets the way the background image is displayed, it can be
any of the following modes:
CENTERED, The middle of the image is anchored in the middle
of the panel, when the image is bigger than the panel, the
image will be clipped.
TOP_LEFT, The top left of the image is anchored in the top
left part of the panel, when the image is bigger than the
panel, the image will be clipped.
TOP_RIGHT, The top right of the image is anchored in the top
right part of the panel, when the image is bigger than the
panel, the image will be clipped.
BOTTOM_RIGHT, The bottom right of the image is anchored in the
bottom right part of the panel, when the image is bigger than
the panel, the image will be clipped.
BOTTOM_LEFT, The bottom left of the image is anchored in the
bottom left part of the panel, when the image is bigger than
the panel, the image will be clipped.
STRETCHED, The image is resized to fit the panel.
TILED, The image is drawn repeatedly until the whole panel is
filled (like tiles), starting at the top left corner, images on
the right and bottom edges of the panel are likely to be clipped.
- Parameters:
mode
- the background image display mode.
getBackgroundImageMode
public int getBackgroundImageMode()
- Returns the mode in which the background image is displayed.
- Returns:
- the background image mode.
Copyright © 2002-2011 Edwin Dankert. All Rights Reserved.