ilog.views.util.swing
Class IlvArrow

java.lang.Object
  extended by ilog.views.util.swing.IlvArrow
All Implemented Interfaces:
Icon, SwingConstants

public class IlvArrow
extends Object
implements Icon, SwingConstants

IlvArrow implements an icon that is a triangular arrow pointing in one of the four cardinal directions.

Since:
JViews 5.5

Field Summary
 
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
 
Constructor Summary
IlvArrow(int direction)
          Creates a new arrow in the specified direction.
IlvArrow(int direction, Color foreground, Color background)
          Creates a new arrow in the specified direction.
IlvArrow(int direction, Color foreground, Color background, int size)
          Creates a new arrow in the specified direction.
IlvArrow(int direction, Color foreground, Color background, int width, int height)
          Creates a new arrow in the specified direction.
IlvArrow(int direction, int size)
          Creates a new arrow in the specified direction.
IlvArrow(int direction, int width, int height)
          Creates a new arrow in the specified direction.
 
Method Summary
 int getIconHeight()
          Returns the icon's height.
 int getIconWidth()
          Returns the icon's width.
 Insets getInsets()
          Returns the icon insets.
 boolean isTransparent()
          Returns whether the icon is transparent.
 void paintIcon(Component c, Graphics g, int x, int y)
          Draws the arrow icon at the specified location.
protected  void paintTriangle(Graphics g, Color c, int x, int y, int width, int height)
          Draws the triangular arrow using the specified color.
 void setInsets(Insets insets)
          Sets the icon insets.
 void setTransparent(boolean transparent)
          Sets whether the icon is transparent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvArrow

public IlvArrow(int direction)
Creates a new arrow in the specified direction. The arrow will have the default size of 10 pixels square. The arrow will be drawn using the foreground and background properties of the component it is rendered on.

Parameters:
direction - The arrow direction, which must be one of the following SwingConstants: NORTH, EAST, SOUTH, or WEST.

IlvArrow

public IlvArrow(int direction,
                Color foreground,
                Color background)
Creates a new arrow in the specified direction. The arrow will have the default size of 10 pixels square.

Parameters:
direction - The arrow direction, which must be one of the following SwingConstants: NORTH, EAST, SOUTH, or WEST.
foreground - The foreground color of the arrow.
background - The background color of the arrow.

IlvArrow

public IlvArrow(int direction,
                int size)
Creates a new arrow in the specified direction. The arrow will be drawn using the foreground and background properties of the component it is rendered on.

Parameters:
direction - The arrow direction, which must be one of the following SwingConstants: NORTH, EAST, SOUTH, or WEST.
size - The arrow width and height.

IlvArrow

public IlvArrow(int direction,
                Color foreground,
                Color background,
                int size)
Creates a new arrow in the specified direction.

Parameters:
direction - The arrow direction, which must be one of the following SwingConstants: NORTH, EAST, SOUTH, or WEST.
foreground - The foreground color of the arrow.
background - The background color of the arrow.
size - The arrow width and height.

IlvArrow

public IlvArrow(int direction,
                int width,
                int height)
Creates a new arrow in the specified direction. The arrow will be drawn using the foreground and background properties of the component it is rendered on.

Parameters:
direction - The arrow direction, which must be one of the following SwingConstants: NORTH, EAST, SOUTH, or WEST.
width - The arrow width.
height - The arrow height.

IlvArrow

public IlvArrow(int direction,
                Color foreground,
                Color background,
                int width,
                int height)
Creates a new arrow in the specified direction.

Parameters:
direction - The arrow direction, which must be one of the following SwingConstants: NORTH, EAST, SOUTH, or WEST.
foreground - The foreground color of the arrow.
background - The background color of the arrow.
width - The arrow width.
height - The arrow height.
Method Detail

paintIcon

public void paintIcon(Component c,
                      Graphics g,
                      int x,
                      int y)
Draws the arrow icon at the specified location. If the arrow colors were not explicitly specified, the arrow will be drawn using the foreground and background colors of the specified component.

Specified by:
paintIcon in interface Icon
Parameters:
c - The component that the icon is being rendered on.
g - The graphics context.
x - The x position to draw the icon.
y - The y position to draw the icon.

paintTriangle

protected void paintTriangle(Graphics g,
                             Color c,
                             int x,
                             int y,
                             int width,
                             int height)
Draws the triangular arrow using the specified color.


getIconWidth

public final int getIconWidth()
Returns the icon's width.

Specified by:
getIconWidth in interface Icon
Returns:
The fixed width of the icon.

getIconHeight

public final int getIconHeight()
Returns the icon's height.

Specified by:
getIconHeight in interface Icon
Returns:
The fixed height of the icon.

isTransparent

public final boolean isTransparent()
Returns whether the icon is transparent.


setTransparent

public final void setTransparent(boolean transparent)
Sets whether the icon is transparent.


getInsets

public final Insets getInsets()
Returns the icon insets.


setInsets

public final void setInsets(Insets insets)
Sets the icon insets.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.