uk.co.ist.mwt
Class ShadowedComponent

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--uk.co.ist.mwt.ShadowedComponent
Direct Known Subclasses:
BoxedButton, Scale, Separator

public class ShadowedComponent
extends javax.swing.JComponent

A ShadowedComponent is a component which has shadows somewhere in its visual display

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
protected  ShadowDrawer shadowDrawer
          A ShadowDrawer object to whom all of the real work is delegated
 
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
 
Constructor Summary
ShadowedComponent()
           
 
Method Summary
 void draw3DRect(java.awt.Component c, java.awt.Rectangle r, boolean in)
          A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw.
 void draw3DRect(java.awt.Graphics g, java.awt.Component c, java.awt.Rectangle r, boolean in)
          A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw.
 void draw3DRect(java.awt.Graphics g, java.awt.Rectangle r, boolean in)
          A routine to draw a 3D rectangle in this component using the object's shadow colours and thickness; pass in the bounding box of the whole object.
 void draw3DRect(java.awt.Rectangle r, boolean in)
          A routine to draw a 3D rectangle in this component using the object's shadow colours and thickness; pass in the bounding box of the whole object.
 void drawShadow(java.awt.Component c, int x, int y, int length, boolean vertical, boolean reflect, boolean top)
          Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
 void drawShadow(java.awt.Graphics g, java.awt.Component c, int x, int y, int length, boolean vertical, boolean reflect, boolean top)
          Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
 java.awt.Color getBottomShadowColor()
          Gets the color for 'bottom shadows' - those which suggest an area in shadow
 int getShadowThickness()
          Gets the thickness this component is using for shadows right now
 java.awt.Color getTopShadowColor()
          Gets the color for 'top shadows' - ie.
 void setBottomShadowColor(java.awt.Color c)
          Sets the color for 'bottom shadows' - those which suggest an area in shadow
 void setShadowThickness(int shadowThickness)
          Sets the thickness this component is using for shadows right now
 void setTopShadowColor(java.awt.Color c)
          Sets the color for 'top shadows' - ie.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

shadowDrawer

protected ShadowDrawer shadowDrawer
A ShadowDrawer object to whom all of the real work is delegated
Constructor Detail

ShadowedComponent

public ShadowedComponent()
Method Detail

getTopShadowColor

public java.awt.Color getTopShadowColor()
Gets the color for 'top shadows' - ie. those which suggest sides which are getting more than their fair share of light.

setTopShadowColor

public void setTopShadowColor(java.awt.Color c)
Sets the color for 'top shadows' - ie. those which suggest sides which are getting more than their fair share of light.

getBottomShadowColor

public java.awt.Color getBottomShadowColor()
Gets the color for 'bottom shadows' - those which suggest an area in shadow

setBottomShadowColor

public void setBottomShadowColor(java.awt.Color c)
Sets the color for 'bottom shadows' - those which suggest an area in shadow

getShadowThickness

public int getShadowThickness()
Gets the thickness this component is using for shadows right now

setShadowThickness

public void setShadowThickness(int shadowThickness)
Sets the thickness this component is using for shadows right now

draw3DRect

public void draw3DRect(java.awt.Component c,
                       java.awt.Rectangle r,
                       boolean in)
A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw. /in/ determines whether the rectangle is sunken in or extrudes outwards.

draw3DRect

public void draw3DRect(java.awt.Rectangle r,
                       boolean in)
A routine to draw a 3D rectangle in this component using the object's shadow colours and thickness; pass in the bounding box of the whole object. /in/ determines whether the rectangle is sunken in or extrudes outwards.

draw3DRect

public void draw3DRect(java.awt.Graphics g,
                       java.awt.Rectangle r,
                       boolean in)
A routine to draw a 3D rectangle in this component using the object's shadow colours and thickness; pass in the bounding box of the whole object. /in/ determines whether the rectangle is sunken in or extrudes outwards.

draw3DRect

public void draw3DRect(java.awt.Graphics g,
                       java.awt.Component c,
                       java.awt.Rectangle r,
                       boolean in)
A routine to draw a 3D rectangle using the object's shadow colours and thickness; pass in the bounding box of the whole object, and the component on which to draw. /in/ determines whether the rectangle is sunken in or extrudes outwards.

drawShadow

public void drawShadow(java.awt.Graphics g,
                       java.awt.Component c,
                       int x,
                       int y,
                       int length,
                       boolean vertical,
                       boolean reflect,
                       boolean top)
Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
  /~~~~~~~~~~~\
  ~~~~~~~~~~~~~
 
where the slashes are meant to be at 45 degrees, and the height is the shadow thickness. The /length/ parameter determines the longest side's length. The above would be drawn with /vertical/ equal to false and /reflect/ = false. Setting /vertical/ to true would rotate it 90 degrees clockwise. The effect of replfect=true is to reflect the shape in its longest axis. If /top/, the top shadow colour is used; otherwise the bottom shadow is.

drawShadow

public void drawShadow(java.awt.Component c,
                       int x,
                       int y,
                       int length,
                       boolean vertical,
                       boolean reflect,
                       boolean top)
Draws a trapezium, with top right at the point passed in, with a corner cut out of the length and depth of the shadow thickness; eg.
  /~~~~~~~~~~~\
  ~~~~~~~~~~~~~
 
where the slashes are meant to be at 45 degrees, and the height is the shadow thickness. The /length/ parameter determines the longest side's length. The above would be drawn with /vertical/ equal to false and /reflect/ = false. Setting /vertical/ to true would rotate it 90 degrees clockwise. The effect of replfect=true is to reflect the shape in its longest axis. If /top/, the top shadow colour is used; otherwise the bottom shadow is.