-
Listener for textbox when user click
Hi,
I have a TextField box with some default text inside. How can I make it like those HTML forms which when user click the textbox, the default text will be switch become empty string?
TIA
-
JTextField has its own ActionEvent s and handlers. As a JComponent it also has KeyEvent(s) and MouseEvent(s). From one or more of these events you can fashion the behavior you say you want.
-
Any example? I tried ActionEvent evt and e.getSource() method and it doesn't seems to recgonised..
-
The "action events" listened for by an action listener would be a button press or other such action on a component. Since you are looking to respond to a user's mouse click, why not listen for a mouse event?
you're looking to listen for a mousePressed event
http://java.sun.com/docs/books/tutor...elistener.html
Last edited by nspils; 07-23-2007 at 11:31 AM.
Similar Threads
-
By Urbaud in forum VB Classic
Replies: 6
Last Post: 07-08-2006, 10:48 PM
-
By Randy in forum VB Classic
Replies: 5
Last Post: 03-30-2001, 09:13 PM
-
By MrRolf in forum VB Classic
Replies: 3
Last Post: 03-19-2001, 06:53 PM
-
By John Whitney in forum VB Classic
Replies: 2
Last Post: 02-01-2001, 11:15 PM
-
By Lim Wing Hoe in forum Java
Replies: 2
Last Post: 12-01-2000, 11:19 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks