artofillusion.ui
Class ToolButton

java.lang.Object
  extended by artofillusion.ui.ToolButton
Direct Known Subclasses:
DefaultToolButton

public abstract class ToolButton
extends java.lang.Object

A ToolButton provides the user interface for an EditingTool in a ToolPalette. This is an abstract class. Subclasses implement paint() to determine the appearance of the button. DefaultToolButton is the standard implementation which is used by default, but themes may define their own subclasses to customize the appearance and behavior of buttons.

A ToolButton is not a widget. Most often it is used inside a ToolPalette, which handles events, layout, and so on for the ToolButtons it contains. If you want to display a ToolButton as an independent widget, you can do that with the ToolButtonWidget class.

Author:
Francois Guillet

Field Summary
static int HIGHLIGHTED_STATE
           
static int NORMAL_STATE
           
static int SELECTED_STATE
           
 
Constructor Summary
ToolButton(java.lang.Object owner)
          Constructor for the ToolButton class.
 
Method Summary
 int getHeight()
          Returns the button height
 java.awt.Point getPosition()
          Returns the button position
 java.awt.Dimension getSize()
          returns the button size
 int getState()
          Returns the button state.
 int getWidth()
          Returns the button width
 boolean isHighlighted()
           
 boolean isSelected()
           
abstract  void paint(java.awt.Graphics2D g)
           
 void setHighlighted(boolean highlighted)
          Sets the button as highlighted.
 void setPosition(int x, int y)
           
 void setSelected(boolean selected)
          Sets the button as selected.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_STATE

public static final int NORMAL_STATE
See Also:
Constant Field Values

SELECTED_STATE

public static final int SELECTED_STATE
See Also:
Constant Field Values

HIGHLIGHTED_STATE

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

ToolButton

public ToolButton(java.lang.Object owner)
Constructor for the ToolButton class.

Parameters:
owner - The owner of the button. This allows for specific button behavior depending on the class of the owner.
Method Detail

getHeight

public int getHeight()
Returns the button height


getWidth

public int getWidth()
Returns the button width


getSize

public java.awt.Dimension getSize()
returns the button size


getState

public int getState()
Returns the button state. The button can be in normal state, highlighted state or selected state.


setSelected

public void setSelected(boolean selected)
Sets the button as selected. If the button is currently highlighted, selecting it supersedes the highlighted state.


setHighlighted

public void setHighlighted(boolean highlighted)
Sets the button as highlighted. Selection precedes over highlighting, so if the button is currently selected, highlighting is ignored.


isSelected

public boolean isSelected()

isHighlighted

public boolean isHighlighted()

paint

public abstract void paint(java.awt.Graphics2D g)

setPosition

public void setPosition(int x,
                        int y)

getPosition

public java.awt.Point getPosition()
Returns the button position



Copyright © 1999-2011 by Peter Eastman.