artofillusion.ui
Class DefaultToolButton
java.lang.Object
artofillusion.ui.ToolButton
artofillusion.ui.DefaultToolButton
public class DefaultToolButton
- extends ToolButton
This ToolButton is the classic button with one icon for standard representation
and another one for selected state.
- Author:
- Francois Guillet
Constructor Summary |
DefaultToolButton(java.lang.Object owner,
javax.swing.ImageIcon image)
create a DefaultToolButton for the specified owner, and the icon
specified by the image, by applying the correct style to the
image to generate theme-consistent normal and selected
icons. |
DefaultToolButton(java.lang.Object owner,
javax.swing.ImageIcon icon,
javax.swing.ImageIcon selectedIcon)
create a new DefaultToolButton using the specified icons for
normal and selected icons. |
Method Summary |
java.awt.Image |
applyStyle(ThemeManager.ButtonStyle style,
java.lang.String type,
java.lang.Object owner,
javax.swing.ImageIcon image)
apply a style for the specified type and owner, to the specified
icon url. |
void |
paint(java.awt.Graphics2D g)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultToolButton
public DefaultToolButton(java.lang.Object owner,
javax.swing.ImageIcon image)
- create a DefaultToolButton for the specified owner, and the icon
specified by the image, by applying the correct style to the
image to generate theme-consistent normal and selected
icons.
This ctor is the preferred ctor, as it ensures the greatest consistency
of all icons with the theme.
- Parameters:
owner
- the owning object for this buttonimage
- the image to use with the style to generate the normal and
selected icons for this button.
DefaultToolButton
public DefaultToolButton(java.lang.Object owner,
javax.swing.ImageIcon icon,
javax.swing.ImageIcon selectedIcon)
- create a new DefaultToolButton using the specified icons for
normal and selected icons.
No style is applied - the icons are used as-is.
This is the least-preferred ctor, since it applies no consistency
at all, and relies on the icon creator to have made the icons
consistent. This normally works well for icons that are part of the
theme, but usually works very poorly for icons associated with plugins.
- Parameters:
icon
- the icon to use for normal button displayselectedIcon
- the icon to use for selected display.
paint
public void paint(java.awt.Graphics2D g)
- Specified by:
paint
in class ToolButton
applyStyle
public java.awt.Image applyStyle(ThemeManager.ButtonStyle style,
java.lang.String type,
java.lang.Object owner,
javax.swing.ImageIcon image)
throws java.lang.Exception
- apply a style for the specified type and owner, to the specified
icon url.
If the style defined no
type.icon
attribute, then
a definition is generated using the type.background and
type.overlay
attributes. If no style definition can
be foudn or generated, the icon from image is returned.
- Parameters:
style
- the ButtonStyle to applytype
- the type of icon to create. Current values are
normal and selected.
In theory highlighted can also be specified, but
currently no code recognises this type.owner
- the owner of this style.image
- the image to use with the style to generate the final
icon.
- Returns:
- the generated icon.
- Throws:
java.lang.Exception
Copyright © 1999-2011 by Peter Eastman.