com.miginfocom.util.gfx
Class ArrowPainter

java.lang.Object
  extended by com.miginfocom.util.gfx.ScaleableImage
      extended by com.miginfocom.util.gfx.IconPainter
          extended by com.miginfocom.util.gfx.ArrowPainter
All Implemented Interfaces:
java.awt.Transparency, javax.swing.Icon

public class ArrowPainter
extends IconPainter

Paints an arrow facing any 90 degree direction.

See Also:
GfxUtil.drawArrow(java.awt.Graphics2D, int, int, int, int, int, java.awt.Color, java.awt.Color)

Field Summary
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
ArrowPainter(int arrowSize, int direction, java.awt.Color arrowColor, java.awt.Color shadowColor)
          Creates a painter.
 
Method Summary
 void drawImage(java.awt.Graphics2D g, int x, int y, int width, int height)
          Paints the internal buffered image (is loaded yet) scaled into the rectangle.
 java.awt.Color getArrowColor()
           
 int getArrowSize()
           
 int getDirection()
           
 int getIconHeight()
           
 int getIconWidth()
           
 java.awt.Color getShadowColor()
           
 void setArrowColor(java.awt.Color arrowColor)
           
 void setArrowSize(int arrowSize)
           
 void setDirection(int direction)
           
 void setShadowColor(java.awt.Color shadowColor)
           
 
Methods inherited from class com.miginfocom.util.gfx.IconPainter
getTransparency, paintIcon
 
Methods inherited from class com.miginfocom.util.gfx.ScaleableImage
drawImage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrowPainter

public ArrowPainter(int arrowSize,
                    int direction,
                    java.awt.Color arrowColor,
                    java.awt.Color shadowColor)
Creates a painter.

Parameters:
arrowSize - The size of the widest part of the arrow, excluding shadow (which adds 1 if set)
direction - Where the arrow should point. E.g. SwingConstants.NORTH.
arrowColor - The normalt paint to paint the arrow.
shadowColor - Optional shadow for the arrow. May be null.
Method Detail

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface javax.swing.Icon
Overrides:
getIconHeight in class IconPainter

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface javax.swing.Icon
Overrides:
getIconWidth in class IconPainter

getArrowColor

public java.awt.Color getArrowColor()

setArrowColor

public void setArrowColor(java.awt.Color arrowColor)

getArrowSize

public int getArrowSize()

setArrowSize

public void setArrowSize(int arrowSize)

getDirection

public int getDirection()

setDirection

public void setDirection(int direction)

getShadowColor

public java.awt.Color getShadowColor()

setShadowColor

public void setShadowColor(java.awt.Color shadowColor)

drawImage

public void drawImage(java.awt.Graphics2D g,
                      int x,
                      int y,
                      int width,
                      int height)
Description copied from class: ScaleableImage
Paints the internal buffered image (is loaded yet) scaled into the rectangle. One cached image will be retained and used if the same width/height is used again. If the image hasn't been loaded yet nothing is drawn.

Specified by:
drawImage in class ScaleableImage
Parameters:
g - The Graphics object to draw in
x - Upper left corner.
y - Upper left corner.
width - The width. If -1 the image's width is used.
height - The height. If -1 the image's height is used.
See Also:
Icon.paintIcon(java.awt.Component, java.awt.Graphics, int, int)


Copyright © 2009 MiG InfoCom AB. All Rights Reserved.