edu.washington.biostr.sig.brainj3d.shwing.swing
Class ActionIcon
java.lang.Object
edu.washington.biostr.sig.brainj3d.icons.LazyIcon
edu.washington.biostr.sig.brainj3d.shwing.swing.ActionIcon
- All Implemented Interfaces:
- MouseListener, MouseMotionListener, Serializable, EventListener, Icon
public class ActionIcon
- extends LazyIcon
- implements Icon, MouseListener, MouseMotionListener
This adds a clickable icon to a component. Because of how it is
set up, it is only appropriate to use for a single component.
It only fires events when a mouse event happens on a non transparent
pixel. Transparent pixel clicks are entirely ignored.
To create something with multiple ActionIcons, use a CompositeIcon.
In the case of a composite icon, any event that occurs on non-transparent
pixels that correspond to 2 events will generate an event on both
ActionIcon's.
- Version:
- 1.0
- Author:
- not attributable
- See Also:
- Serialized Form
| Fields inherited from class edu.washington.biostr.sig.brainj3d.icons.LazyIcon |
img |
ActionIcon
public ActionIcon(String location)
ActionIcon
public ActionIcon(String command,
String location)
ActionIcon
public ActionIcon(String command,
String location,
Icon selected)
- Optionally we can display a different icon when selected
- Parameters:
command - location - selected -
setHover
public void setHover(boolean hover)
- Set hover if you want to show the selected icon when we hover.
- Parameters:
hover -
paintIcon
public void paintIcon(Component parent,
Graphics g,
int x,
int y)
- Specified by:
paintIcon in interface Icon- Overrides:
paintIcon in class LazyIcon
fireActionEvent
protected void fireActionEvent(ActionEvent evt)
addActionListener
public void addActionListener(ActionListener list)
removeActionListener
public void removeActionListener(ActionListener list)
checkIntersection
public static boolean checkIntersection(Point2D p,
BufferedImage img,
int x,
int y,
int right,
int down)
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClicked in interface MouseListener
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressed in interface MouseListener
setSelected
public void setSelected(boolean selected)
- Tell this to display the selected icon
- Parameters:
selected -
mouseReleased
public void mouseReleased(MouseEvent e)
- Specified by:
mouseReleased in interface MouseListener
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEntered in interface MouseListener
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExited in interface MouseListener
disable
public void disable()
mouseDragged
public void mouseDragged(MouseEvent e)
- Specified by:
mouseDragged in interface MouseMotionListener
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMoved in interface MouseMotionListener
equals
public boolean equals(Object obj)
- 2 action icons are equal if their most recent components
are equal and their LazyIcon's are equal. If the addedToComp
is null, then the ActionIcon cannot be equal to anything but itself.
- Overrides:
equals in class LazyIcon
Copyright © 2006 University of Washington. All Rights Reserved.