org.tigris.swidgets

Class PopupToolBoxButton


public class PopupToolBoxButton
extends JButton

An extension of JButton to which alternative actions can be added. The button to trigger these actions become available when a dropdown icon is pressed on this button.
Author:
Bob Tarling

Constructor Summary

PopupToolBoxButton(Action a, int rows, int cols)
Creates a new instance of PopupToolboxButton

Method Summary

JButton
add(Action a)
Add a new action to appear as a button on the popup toolbox
void
paint(Graphics g)
void
setAction(Action a)
Provide a new default action for this button
void
showSplitter(Color c, Graphics g, int x, int y, int height)
void
showSplitter(boolean show)

Constructor Details

PopupToolBoxButton

public PopupToolBoxButton(Action a,
                          int rows,
                          int cols)
Creates a new instance of PopupToolboxButton
Parameters:
a - The default action when pressing this button
rows - The number of rows of buttons to display in the popup toolbox
cols - The number of columns of buttons to display in the popup toolbox

Method Details

add

public JButton add(Action a)
Add a new action to appear as a button on the popup toolbox
Parameters:
a - The action to be added
Returns:
The button generated to trigger the action

paint

public void paint(Graphics g)
See Also:
java.awt.Component.paint(java.awt.Graphics)

setAction

public void setAction(Action a)
Provide a new default action for this button
Parameters:
a - The new default action

showSplitter

public void showSplitter(Color c,
                         Graphics g,
                         int x,
                         int y,
                         int height)
Parameters:
c - the color
g - the graphics
x - the x-coordinate of the vertical line that represents the splitter
y - the y-coordinate of the bottom of the splitter line
height - the height of the splitter line

showSplitter

public void showSplitter(boolean show)
Parameters:
show - to show or not to show