Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

org.bounce
Class QPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.bounce.QPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class QPanel
extends javax.swing.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

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
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
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
QPanel()
          Constructor, calls the super constructor.
QPanel(boolean isDoubleBuffered)
          Constructor, calls the super constructor.
QPanel(java.awt.LayoutManager layout)
          Constructor, calls the super constructor.
QPanel(java.awt.LayoutManager layout, boolean isDoubleBuffered)
          Constructor, calls the super constructor.
 
Method Summary
 javax.swing.ImageIcon getBackgroundImage()
          Returns this panel's background image.
 int getBackgroundImageMode()
          Returns the mode in which the background image is displayed.
 java.awt.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(javax.swing.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(java.awt.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.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, transferFocusBackward, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

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(java.awt.LayoutManager layout)
Constructor, calls the super constructor.

Parameters:
layout - the layout manager.

QPanel

public QPanel(java.awt.LayoutManager layout,
              boolean isDoubleBuffered)
Constructor, calls the super constructor.

Parameters:
layout - the layout manager.
isDoubleBuffered - is double buffered.
Method Detail

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 javax.swing.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 java.awt.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(java.awt.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(javax.swing.ImageIcon image)
Sets the background image for this panel.

Parameters:
image - the background image.

getBackgroundImage

public javax.swing.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.

Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

Copyright 2002-2002-2009 Edwin Dankert. All Rights Reserved.