![]() |
||
![]() |
![]() Alden Hosting provides professional, efficient, and reliable business-class Web hosting services to small- and medium-sized businesses. |
|
|
JAVA, JSP, SERVLETS, TOMCAT, SERVLETS MANAGER, |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Method | Purpose |
|---|---|
| mouseClicked(MouseEvent) | Called just after the user clicks the listened-to component. |
| mouseEntered(MouseEvent) | Called just after the cursor enters the bounds of the listened-to component. |
| mouseExited(MouseEvent) | Called just after the cursor exits the bounds of the listened-to component. |
| mousePressed(MouseEvent) | Called just after the user presses a mouse button while the cursor is over the listened-to component. |
| mouseReleased(MouseEvent) | Called just after the user releases a mouse button after a mouse press over the listened-to component. |
The
MouseAdapter class (the AWT adapter class) is abstract. All its methods have an empty body. So a developer can define methods for events specific to the application. You can also use the
MouseInputAdapter class, which has all the methods available from MouseListener
and MouseMotionListener.
| Method | Purpose |
|---|---|
| int getClickCount() | Returns the number of quick, consecutive clicks the user has made (including this event). For example, returns 2 for a double click. |
|
int getX() int getY() Point getPoint() |
Return the (x,y) position at which the event occurred, relative to the component that fired the event. |
|
int getXOnScreen() int getYOnScreen() int getLocationOnScreen() |
Return the absolute (x,y) position of the event. These coordinates are relative to the virtual coordinate system for the multi-screen environment. Otherwise, these coordinates are relative to the coordinate system associated with the Component's Graphics Configuration. |
| int getButton() | Returns which mouse button, if any, has a changed state. One of
the following constants is returned: NOBUTTON,
BUTTON1, BUTTON2, or BUTTON3.
Introduced in release 1.4.
|
| boolean isPopupTrigger() | Returns true if the mouse event should cause a popup menu
to appear. Because popup triggers are platform dependent,
if your program uses popup menus,
you should call isPopupTrigger
for all mouse-pressed and mouse-released events
fired by components over which the popup can appear.
See Bringing Up a Popup Menu
for more information about popup menus.
|
| String getMouseModifiersText(int) | Returns a String describing the modifier keys
and mouse buttons that were active during the event, such
as "Shift", or "Ctrl+Shift". These strings can be localized
using the awt.properties file. Introduced in release 1.4.
|
The MouseEvent class inherits many useful
methods from
InputEvent and a couple handy methods from the
ComponentEvent and
AWTEvent classes.
| Method | Purpose | |
|---|---|---|
|
int getID() (in java.awt.AWTEvent)
|
Returns the event type, which defines the particular action.
For example, the MouseEvent id reflects the state of the mouse buttons for every mouse event.
The following states could be specified by the MouseEvent id: MouseEvent.MOUSE_PRESSED, MouseEvent.MOUSE_RELEASED, and MouseEvent.MOUSE_CLICKED.
| |
|
Component getComponent() (in ComponentEvent)
|
Returns the component that fired the event.
You can use this method instead of the getSource method.
|
|
| int getWhen() | Returns the timestamp of when this event occurred. The higher the timestamp, the more recently the event occurred. | |
|
boolean isAltDown() boolean isControlDown() boolean isMetaDown() boolean isShiftDown() |
Return the state of individual modifier keys at the time the event was fired. | |
| int getModifiers() | Returns the state of all the modifier keys and
mouse buttons when the event was fired.
You can use this method to determine which
mouse button was pressed (or released) when a
mouse event was fired.
The InputEvent class defines these constants
for use with the getModifiers method:
ALT_MASK,
BUTTON1_MASK,
BUTTON2_MASK,
BUTTON3_MASK,
CTRL_MASK,
META_MASK, and
SHIFT_MASK.
For example, the following expression is true
if the right button was pressed:
(mouseEvent.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK |
|
| int getModifiersEx() | Returns the extended modifier mask for this event.
Extended modifiers represent the state of the mouse button and all modal keys,
such as ALT, CTRL, META, just after
the event occurred. You can check the status of the modifiers
using one of the following predefined bitmasks:
SHIFT_DOWN_MASK, CTRL_DOWN_MASK,
META_DOWN_MASK, ALT_DOWN_MASK,
BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK,
BUTTON3_DOWN_MASK, or ALT_GRAPH_DOWN_MASK.
For example, to check that button 1 is down,
but that buttons 2 and 3 are up, you would use the following code snippet:
Introduced in release 1.4.
|
|
| int getModifiersExText(int) | Returns a string describing the extended modifier keys and mouse buttons, such as "Shift", "Button1", or "Ctrl+Shift". These strings can be localized by changing the awt.properties file. Introduced in release 1.4. |
The
MouseInfo class provides methods to obtain information about the mouse pointer location
at any time while an application runs.
| Method | Purpose |
|---|---|
| getPointerInfo() |
Returns a PointerInfo instance that represents the current location of the mouse pointer.
|
| getNumberOfButtons() |
Returns the number of buttons on the mouse or -1 , if a system does not support a mouse.
|
The following table lists the examples that use mouse listeners.
Example Where Described Notes MouseEventDemoThis section Reports all mouse events that occur within a blank panel to demonstrate the circumstances under which mouse events are fired. CoordinatesDemoDraws a small dot where the user clicks the mouse. Also reports the x, y location of the cursor and of the most recent mouse click. SelectionDemoLets the user drag a rectangle to select a portion of an image. Uses a subclass of MouseInputAdapterto listen to both mouse events and mouse-motion events.GlassPaneDemoHow to Use Root Panes Uses a subclass of MouseInputAdapterto listen to mouse events and mouse-motion events on the root pane's glass pane. Re-dispatches the events to underlying components.TableSortDemoHow to Use Tables Listens to mouse events on a table header. Sorts data in the selected column. PopupMenuDemoHow to Use Menus Displays a popup menu in response to mouse clicks. TrackFocusDemoHow to Use the Focus Subsystem The custom component, Picture, implements a mouse listener that requests the focus when a user clicks on the component.
Alden Hosting offers private JVM (Java Virtual Machine), Java Server Pages (JSP), Servlets, and Servlets Manager with our Web Hosting Plans WEB 4 PLAN and WEB 5 PLAN , WEB 6 PLAN .
At Alden Hosting we eat and breathe Java! We are the industry leader in providing affordable, quality and efficient Java web hosting in the shared hosting marketplace. All our sites run on our Java hosing platform configured for optimum performance using Java 1.6, Tomcat 6.0.X, MySQL 5.0.x, Apache 2.2.xx and web application frameworks such as Struts, Hibernate, Cocoon, Ant, etc.
We offer only one type of Java hosting - Private Tomcat. Hosting accounts on the Private Tomcat environment get their very own Tomcat server. You can start and re-start your entire Tomcat server yourself.
![]() |
|
http://alden-servlet-Hosting.com
JSP at alden-servlet-Hosting.com
Servlets at alden-servlet-Hosting.com
Servlet at alden-servlet-Hosting.com
Tomcat at alden-servlet-Hosting.com
MySQL at alden-servlet-Hosting.com
Java at alden-servlet-Hosting.com
sFTP at alden-servlet-Hosting.com
http://alden-tomcat-Hosting.com
JSP at alden-tomcat-Hosting.com
Servlets at alden-tomcat-Hosting.com
Servlet at alden-tomcat-Hosting.com
Tomcat at alden-tomcat-Hosting.com
MySQL at alden-tomcat-Hosting.com
Java at alden-tomcat-Hosting.com
sFTP at alden-tomcat-Hosting.com
http://alden-sftp-Hosting.com
JSP at alden-sftp-Hosting.com
Servlets at alden-sftp-Hosting.com
Servlet at alden-sftp-Hosting.com
Tomcat at alden-sftp-Hosting.com
MySQL at alden-sftp-Hosting.com
Java at alden-sftp-Hosting.com
sFTP at alden-sftp-Hosting.com
http://alden-jsp-Hosting.com
JSP at alden-jsp-Hosting.com
Servlets at alden-jsp-Hosting.com
Servlet at alden-jsp-Hosting.com
Tomcat at alden-jsp-Hosting.com
MySQL at alden-jsp-Hosting.com
Java at alden-jsp-Hosting.com
sFTP at alden-jsp-Hosting.com
http://alden-java-Hosting.com
JSp at alden-java-Hosting.com
Servlets at alden-java-Hosting.com
Servlet at alden-java-Hosting.com
Tomcat at alden-java-Hosting.com
MySQL at alden-java-Hosting.com
Java at alden-java-Hosting.com
sFTP at alden-java-Hosting.com
JSP
Servlets
Tomcat
mysql
Java
JSP
Servlets
Tomcat
mysql
Java
JSP
Servlets
Tomcat
mysql
Java
JSP
Servlets
Tomcat
mysql
Java
JSP at JSP.aldenWEBhosting.com
Servlets at servlets.aldenWEBhosting.com
Tomcat at Tomcat.aldenWEBhosting.com
mysql at mysql.aldenWEBhosting.com
Java at Java.aldenWEBhosting.com
Web Hosts Portal
Web Links
Web Links
Web Hosting
JSP Solutions Web Links
JSP Solutions Web Hosting
Servlets Solutions Web Links
Servlets Solutions Web Hosting
Web Links
Web Links
.
.
.
.
.
.
.
.
.
.
jsp hosting
servlets hosting
web hosting
web sites designed
cheap web hosting
web site hosting
myspace web hosting