artofillusion.ui
Class ToolPalette

java.lang.Object
  extended by CustomWidget
      extended by artofillusion.ui.ToolPalette

public class ToolPalette
extends CustomWidget

A ToolPalette is drawn as a grid of images, one for each EditingTool that is added to the palette. It allows a single tool to be selected at any time.


Constructor Summary
ToolPalette(int w, int h)
          Create a new ToolPalette.
 
Method Summary
 void addTool(EditingTool t)
          Add a new tool.
 void addTool(int position, EditingTool t)
          Add a new tool.
 EditingTool getDefaultTool()
          Get the default tool.
 java.awt.Dimension getMinimumSize()
           
 int getNumTools()
          Get the number of tools in palette.
 java.awt.Dimension getPreferredSize()
           
 EditingTool getSelectedTool()
          Return the currently selected tool.
 int getSelection()
          Return the number of the currently selected tool.
 EditingTool getTool(int index)
          Get a tool by index.
 void keyPressed(KeyPressedEvent ev)
          Allow the user to change tools with the keyboard.
 void selectTool(EditingTool which)
          Change the currently selected tool.
 void setDefaultTool(EditingTool t)
          Set the default tool.
 void toggleDefaultTool()
          Calling this method will toggle between the default tool and the last tool which was explicitly selected.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolPalette

public ToolPalette(int w,
                   int h)
Create a new ToolPalette. w and h give the width and height of the tool palette, measured in icons.

Method Detail

addTool

public void addTool(EditingTool t)
Add a new tool.


addTool

public void addTool(int position,
                    EditingTool t)
Add a new tool.


getNumTools

public int getNumTools()
Get the number of tools in palette.


getTool

public EditingTool getTool(int index)
Get a tool by index.


getDefaultTool

public EditingTool getDefaultTool()
Get the default tool.


setDefaultTool

public void setDefaultTool(EditingTool t)
Set the default tool.


getSelection

public int getSelection()
Return the number of the currently selected tool.


getSelectedTool

public EditingTool getSelectedTool()
Return the currently selected tool.


getPreferredSize

public java.awt.Dimension getPreferredSize()

getMinimumSize

public java.awt.Dimension getMinimumSize()

selectTool

public void selectTool(EditingTool which)
Change the currently selected tool.


keyPressed

public void keyPressed(KeyPressedEvent ev)
Allow the user to change tools with the keyboard.


toggleDefaultTool

public void toggleDefaultTool()
Calling this method will toggle between the default tool and the last tool which was explicitly selected.



Copyright © 1999-2011 by Peter Eastman.