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

## uchicago.src.sim.gui
Class DrawableItem

    java.lang.Object
      uchicago.src.sim.gui.DrawableItem

All Implemented Interfaces:
  NonGridDrawable

Direct Known Subclasses:
  OvalItem, RectItem, RoundRectItem

    public abstract class DrawableItem

extends java.lang.Object
implements NonGridDrawable

Abstract class for objects inhabiting non-discrete spaces and that wish to be drawn by a Display. This is particularly useful for nodes. Provides methods for setting the color, label, border size and label, and font of the item. All size variables are in screen coordinates.

Version:
  $Revision: 1.9 $ $Date: 2004/11/03 19:50:59 $
Author:
  Nick Collier
See Also:
  `OvalNode`, `RectNode`

Field Summary
`protected boolean` | `allowResizing`
`protected java.awt.Color` | `borderColor`
`protected int` | `borderWidth`
`protected java.awt.Color` | `color`
`protected java.awt.Font` | `font`
`protected int` | `height`
`protected boolean` | `hollow`
`protected java.lang.String` | `label`
`protected java.awt.Color` | `labelColor`
`protected boolean` | `recalc`
`protected java.awt.BasicStroke` | `stroke`
`protected int` | `width`

Constructor Summary
`DrawableItem()`

Method Summary
`void` | `allowResizing(boolean val)` Should this DrawableItem be resized to so that entire label is visible.
`void` | `calcSize(SimGraphics g)` Calculates and sets the size of this DrawableItem insuring that the entire label can be seen, if allowResizing is true.
`java.awt.Color` | `getBorderColor()` Returns the current border color.
`int` | `getBorderWidth()` Returns the current border width.
`java.awt.Color` | `getColor()` Returns the current color.
`java.awt.Font` | `getFont()` Returns the current label font.
`int` | `getHeight()` Gets the height of this DrawableItem.
`java.awt.Color` | `getLabelColor()` Returns the current label color.
`int` | `getWidth()` Gets the width of this DrawableItem.
`boolean` | `isHollow()`
`void` | `setBorderColor(java.awt.Color c)` Sets the border color for this DrawableItem.
`void` | `setBorderWidth(int width)` Sets the border width for this DrawableItem.
`void` | `setColor(java.awt.Color c)` Sets the color for this DrawableItem.
`void` | `setFont(java.awt.Font font)` Sets the font for the label
`void` | `setHeight(int h)` Sets the height of this DrawableItem in screen coordinates.
`void` | `setHollow(boolean hollow)`
`void` | `setLabel(java.lang.String l)` Sets the label.
`void` | `setLabelColor(java.awt.Color c)` Sets the label color.
`void` | `setSize(java.awt.Dimension size)` Sets the size of this DrawableItem in screen coordinates.
`void` | `setSize(int w, int h)` Sets the size of this DrawableItem in screen coordinates.
`void` | `setWidth(int w)` Sets the width of this DrawableItem in screen coordinates.

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

Methods inherited from interface uchicago.src.sim.gui.NonGridDrawable
`contains, draw, getX, getY`

Field Detail

### label

    protected java.lang.String label

### font

    protected java.awt.Font font

### labelColor

    protected java.awt.Color labelColor

### color

    protected java.awt.Color color

### borderColor

    protected java.awt.Color borderColor

### borderWidth

    protected int borderWidth

### width

    protected int width

### height

    protected int height

### recalc

    protected boolean recalc

### allowResizing

    protected boolean allowResizing

### hollow

    protected boolean hollow

### stroke

    protected java.awt.BasicStroke stroke

Constructor Detail

### DrawableItem

    public DrawableItem()

Method Detail

### allowResizing

    public void allowResizing(boolean val)

  Should this DrawableItem be resized to so that entire label is visible.

  Parameters:
    `val` - true if this should allow resizing for label fit, otherwise false

### setLabel

    public void setLabel(java.lang.String l)

  Sets the label.

  Parameters:
    `l` - the new label

### setLabelColor

    public void setLabelColor(java.awt.Color c)

  Sets the label color.

  Parameters:
    `c` - the new label color

### getLabelColor

    public java.awt.Color getLabelColor()

  Returns the current label color.

### setFont

    public void setFont(java.awt.Font font)

  Sets the font for the label

  Parameters:
    `font` - the new label font

### getFont

    public java.awt.Font getFont()

  Returns the current label font.

### setColor

    public void setColor(java.awt.Color c)

  Sets the color for this DrawableItem.

  Parameters:
    `c` - the new color

### getColor

    public java.awt.Color getColor()

  Returns the current color.

### setBorderColor

    public void setBorderColor(java.awt.Color c)

  Sets the border color for this DrawableItem.

  Parameters:
    `c` - the new border color

### getBorderColor

    public java.awt.Color getBorderColor()

  Returns the current border color.

### setBorderWidth

    public void setBorderWidth(int width)

  Sets the border width for this DrawableItem.

  Parameters:
    `width` - the new border width

### getBorderWidth

    public int getBorderWidth()

  Returns the current border width.

### setWidth

    public void setWidth(int w)

  Sets the width of this DrawableItem in screen coordinates. The new width won't be respected if allowsResizing is true (i.e. the width is calculated to allow the entire label to be seen.

  Parameters:
    `w` - the new width

### setHeight

    public void setHeight(int h)

  Sets the height of this DrawableItem in screen coordinates. The new height won't be respected if allowsResizing is true (i.e. the height is calculated to allow the entire label to be seen.

  Parameters:
    `h` - the new height

### setSize

    public void setSize(int w,
                        int h)

  Sets the size of this DrawableItem in screen coordinates. The new width and height won't be respected if allowsResizing is true (i.e. the width is calculated to allow the entire label to be seen.

  Parameters:
    `w` - the new width
    `h` - the new height

### setSize

    public void setSize(java.awt.Dimension size)

  Sets the size of this DrawableItem in screen coordinates. The new width and height won't be respected if allowsResizing is true (i.e. the width is calculated to allow the entire label to be seen.

  Parameters:
    `size` - the new size

### getWidth

    public int getWidth()

  Gets the width of this DrawableItem.

  Specified by:
    `getWidth` in interface `NonGridDrawable`

### getHeight

    public int getHeight()

  Gets the height of this DrawableItem.

  Specified by:
    `getHeight` in interface `NonGridDrawable`

### isHollow

    public boolean isHollow()

### setHollow

    public void setHollow(boolean hollow)

### calcSize

    public void calcSize(SimGraphics g)

  Calculates and sets the size of this DrawableItem insuring that the entire label can be seen, if allowResizing is true.

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