|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
java.awt.event.MouseAdapter
oracle.jdeveloper.tree.TreeMouseAdapter
public class TreeMouseAdapter
This class sifts through the mousePressed()
and mouseReleased()
events that are generated by a JTree. It is necessary to listen to these events instead of mouseClicked()
because the mouseClicked()
event is very particular. In order for a mouseClicked()
event to be fired, the mouse must be pressed and released at the same POINT on the screen. If the mouse moves between the pressing and releasing of the button even by one pixel, the mouseClicked()
event does not fire.
So what is done here is that the row that the mouse is pressed on is compared to the row where the mouse is released. If the rows are the same, then this is counted as a "click", and the appropriate action is taken. If the rows are different, then the user moved the mouse off of the original object during the click, and this probably means that the user does not want to click on the tree node after all.
However, in some circumstances, it is actually ok to count the mouse pressed-released pair as a click even if the mouse is released somewhere outside of the object where the mouse was pressed. This is acceptable if the time between the mousePressed()
and mouseReleased()
events is adequately short enough. Some usability labs call this the "bounce time" of the mouse click. So even if the mouse is moved out of the original object, if the duration of the click is less than the bounce time, it is counted as a click and the appropriate action is taken.
Constructor Summary | |
---|---|
TreeMouseAdapter(javax.swing.JTree tree) Constructor. |
Method Summary | |
---|---|
void |
mousePressed(java.awt.event.MouseEvent e) Overrides MouseAdapter definition. |
void |
mouseReleased(java.awt.event.MouseEvent e) Overrides MouseAdapter definition. |
Methods inherited from class java.awt.event.MouseAdapter |
---|
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseWheelMoved |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeMouseAdapter(javax.swing.JTree tree)
Method Detail |
---|
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed()
event occurred and what the corresponding row in the JTree is.mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class java.awt.event.MouseAdapter
public void mouseReleased(java.awt.event.MouseEvent e)
mousePressed()
and mouseReleased()
is less than the BOUNCE_TIME
, then accept this mouse action as a click and take the appropriate action.mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class java.awt.event.MouseAdapter
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.9.0) E52944-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |