|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JLabel com.jidesoft.swing.ClickThroughLabel
public class ClickThroughLabel
ClickThroughLabel is a special JLabel that will retarget all mouse events to specified target component.
For example, you need to paint some text on a JComponent. Usually you can call Java2D paint text method and paint the text. However the other way to do it is to add JLabel to JComponent and JLabel will not only paint the text but also an optional icon which is better. However if you had mouse listener added to JComponent, the mouse listener will not receive any mouse events when mouse clicks on the JLabel. By using this ClickThroughLabel, mouse event will be passed to underlying JComponent. Please note, we didn't pass all mouse events. In most cases, MOUSE_EXITED and MOUSE_ENTERED doesn't make sense to pass through. However there are cases, for example when the JLabel is at the border of JComponent, you may expect MOUSE_ENTERED event on JComponent but it will not happen. So please be aware of those cases so that you don't depend on it for important decision in your code.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JLabel |
---|
JLabel.AccessibleJLabel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JLabel |
---|
labelFor |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.SwingConstants |
---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ClickThroughLabel()
|
|
ClickThroughLabel(Icon image)
|
|
ClickThroughLabel(Icon image,
int horizontalAlignment)
|
|
ClickThroughLabel(String text)
|
|
ClickThroughLabel(String text,
Icon icon,
int horizontalAlignment)
|
|
ClickThroughLabel(String text,
int horizontalAlignment)
|
Method Summary | |
---|---|
Component |
getTarget()
|
protected void |
installListeners()
|
void |
mouseClicked(MouseEvent e)
|
void |
mouseDragged(MouseEvent e)
|
void |
mouseEntered(MouseEvent e)
|
void |
mouseExited(MouseEvent e)
|
void |
mouseMoved(MouseEvent e)
|
void |
mousePressed(MouseEvent e)
|
void |
mouseReleased(MouseEvent e)
|
void |
setTarget(Component target)
|
protected void |
uninstallListeners()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClickThroughLabel()
public ClickThroughLabel(Icon image)
public ClickThroughLabel(Icon image, int horizontalAlignment)
public ClickThroughLabel(String text)
public ClickThroughLabel(String text, int horizontalAlignment)
public ClickThroughLabel(String text, Icon icon, int horizontalAlignment)
Method Detail |
---|
public Component getTarget()
public void setTarget(Component target)
protected void installListeners()
protected void uninstallListeners()
public void mouseClicked(MouseEvent e)
mouseClicked
in interface MouseListener
public void mousePressed(MouseEvent e)
mousePressed
in interface MouseListener
public void mouseReleased(MouseEvent e)
mouseReleased
in interface MouseListener
public void mouseEntered(MouseEvent e)
mouseEntered
in interface MouseListener
public void mouseExited(MouseEvent e)
mouseExited
in interface MouseListener
public void mouseDragged(MouseEvent e)
mouseDragged
in interface MouseMotionListener
public void mouseMoved(MouseEvent e)
mouseMoved
in interface MouseMotionListener
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |