Diamond Control Suite 3.0

diamondedge.swing
Class DsShape

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by diamondedge.swing.DsShape
All Implemented Interfaces:
DsConstants, ImageObserver, MenuContainer, Serializable, SwingConstants

public class DsShape
extends JComponent
implements DsConstants

A component that will display a basic shape in the bounds of the component. This component allows shapes to be added from an IDE and layed out with other components on the screen.

If the shape is set to opaque then the background color is used to paint the background of the shape. This is useful in combination with a fill style pattern.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int CIRCLE
           
static int OVAL
           
static int RECTANGLE
           
static int ROUNDED_RECTANGLE
           
static int ROUNDED_SQUARE
           
static int SQUARE
           
 
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 diamondedge.swing.DsConstants
ACCOUNTING, ALL, ASCENDING, ASCENDING_CASE, BORDER_BOTTOM, BORDER_LEFT, BORDER_NONE, BORDER_OUTLINE, BORDER_RIGHT, BORDER_TOP, CROSS_LINES, DASH, DASH_DOT, DASH_DOT_DOT, DEFAULT, DESCENDING, DESCENDING_CASE, DIAGONAL_CROSS_LINES, DOT, DOUBLE, DOUBLE_LINE, DOWNWARD_DIAGONAL_LINES, ETCHED, ETCHED_RAISED, FALSE, FIND_ALL, FIND_EQUALS, FIND_GT, FIND_GTE, FIND_LT, FIND_LTE, FIND_NE, FIND_PREFIX, FIND_REGEX, FIND_STRING, FIRST, FLAT, GRID_DASH, GRID_DASH_DOT, GRID_DASH_DOT_DOT, GRID_DOT, GRID_LINE, HIGHLIGHT_SELECTION_ALWAYS, HIGHLIGHT_SELECTION_NEVER, HIGHLIGHT_SELECTION_WITH_FOCUS, HORIZONTAL_LINES, LOWERED, LOWERED_LIGHT, NONE, RAISED, RAISED_LIGHT, SELECT_CELL, SELECT_NONE, SELECT_ROW, SINGLE, SINGLE_LINE, SOLID, STRETCH, TILE, TRANSPARENT, TRUE, UPWARD_DIAGONAL_LINES, VERTICAL_LINES
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DsShape()
          Creates a DsShape which will draw various different shapes on its parent surface
DsShape(int shape)
          Creates a DsShape which will draw the specified shape on its parent surface.
 
Method Summary
 Paint getBorderColor()
          Returns the color used to draw the border.
 int getBorderStyle()
          Returns the style used to draw the border.
 double getBorderWidth()
          Returns the width of the border drawn around the shape.
 Paint getFillColor()
          Returns the color or Paint object used to fill in the shape.
 int getFillStyle()
          Returns the style used to fill in the shape.
 int getShape()
          Returns a value indicating the type of shape to be drawn.
 void paint(Graphics g)
           
 void setBorderColor(Paint color)
          Sets the color used to draw the border.
 void setBorderStyle(int style)
          Sets the style used to draw the border.
 void setBorderWidth(double width)
          Sets the width of the border drawn around the shape.
 void setFillColor(Paint color)
          Sets the color or Paint object used to fill in the shape.
 void setFillStyle(int style)
          Sets the style used to draw inside the shape using the FillColor.
 void setShape(int shape)
          Sets a value indicating the type of shape to be drawn.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, updateUI
 
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

RECTANGLE

public static final int RECTANGLE
See Also:
Constant Field Values

SQUARE

public static final int SQUARE
See Also:
Constant Field Values

OVAL

public static final int OVAL
See Also:
Constant Field Values

CIRCLE

public static final int CIRCLE
See Also:
Constant Field Values

ROUNDED_RECTANGLE

public static final int ROUNDED_RECTANGLE
See Also:
Constant Field Values

ROUNDED_SQUARE

public static final int ROUNDED_SQUARE
See Also:
Constant Field Values
Constructor Detail

DsShape

public DsShape()
Creates a DsShape which will draw various different shapes on its parent surface


DsShape

public DsShape(int shape)
Creates a DsShape which will draw the specified shape on its parent surface.

Parameters:
shape - One of: RECTANGLE, SQUARE, OVAL, CIRCLE, ROUNDED_RECTANGLE, ROUNDED_SQUARE
Method Detail

paint

public void paint(Graphics g)
Overrides:
paint in class JComponent

getBorderColor

public Paint getBorderColor()
Returns the color used to draw the border.


setBorderColor

public void setBorderColor(Paint color)
Sets the color used to draw the border.


getBorderWidth

public double getBorderWidth()
Returns the width of the border drawn around the shape.


setBorderWidth

public void setBorderWidth(double width)
Sets the width of the border drawn around the shape. Set to 0 to turn it off.


getBorderStyle

public int getBorderStyle()
Returns the style used to draw the border.


setBorderStyle

public void setBorderStyle(int style)
Sets the style used to draw the border.

Parameters:
style - One of: TRANSPARENT, SOLID, DASH, DOT, DASH_DOT, DASH_DOT_DOT

getFillColor

public Paint getFillColor()
Returns the color or Paint object used to fill in the shape.


setFillColor

public void setFillColor(Paint color)
Sets the color or Paint object used to fill in the shape.

See Also:
setFillStyle(int)

getFillStyle

public int getFillStyle()
Returns the style used to fill in the shape.


setFillStyle

public void setFillStyle(int style)
Sets the style used to draw inside the shape using the FillColor.

Parameters:
style - One of: TRANSPARENT, SOLID, VERTICAL_LINE, HORIZONTAL_LINE, CROSS_LINES, DOWNWARD_DIAGONAL_LINE, UPWARD_DIAGONAL_LINE, DIAGONAL_CROSS_LINES

getShape

public int getShape()
Returns a value indicating the type of shape to be drawn.


setShape

public void setShape(int shape)
Sets a value indicating the type of shape to be drawn.

Parameters:
shape - One of: RECTANGLE, SQUARE, OVAL, CIRCLE, ROUNDED_RECTANGLE, ROUNDED_SQUARE

Diamond Control Suite 3.0

Diamond Edge and Diamond Control Suite are trademarks or registered trademarks of Diamond Edge, Inc. Copyright 1999-2005 Diamond Edge, Inc. All Rights Reserved.