artofillusion.ui
Class ToolPalette

java.lang.Object
  extended by buoy.event.EventSource
      extended by buoy.widget.Widget
          extended by buoy.widget.CustomWidget
              extended by artofillusion.ui.ToolPalette

public class ToolPalette
extends buoy.widget.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(buoy.event.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 buoy.widget.CustomWidget
isOpaque, setMaximumSize, setMinimumSize, setOpaque, setPreferredSize
 
Methods inherited from class buoy.widget.Widget
addEventLink, dispatchEvent, getBackground, getBounds, getComponent, getCursor, getFont, getMaximumSize, getName, getParent, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
 
Methods inherited from class buoy.event.EventSource
addEventLink, addEventLink, removeEventLink
 
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()
Overrides:
getPreferredSize in class buoy.widget.Widget

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class buoy.widget.Widget

selectTool

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


keyPressed

public void keyPressed(buoy.event.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-2008 by Peter Eastman.