Results 1 to 4 of 4
Thread: Click out event
- 02-17-2011, 04:09 PM #1
Member
- Join Date
- Feb 2011
- Posts
- 3
- Rep Power
- 0
Click out event
Hi!
I'm creating a GUI with Swing + Substance, and I want to add a JTextField that, when clicking on it, is enabled and set for edition, and, when clicking anywhere else, is disabled again. It's something like text fields for Gmail contacts. My problem is I can't find the way to get that "clicking out" event. May anyone lend me a hand? Thanks a lot!
- 02-17-2011, 04:20 PM #2
Try a focus listener. Google is your friend.
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-17-2011, 04:22 PM #3
Member
- Join Date
- Feb 2011
- Posts
- 3
- Rep Power
- 0
- 02-17-2011, 04:43 PM #4
Member
- Join Date
- Feb 2011
- Posts
- 3
- Rep Power
- 0
I've solved my problem, so I'll post how!
The JTextField just needs to handle focusLost event, and do there want we want. In addition, I included an event handler for mouseClicked on the window containing the text field (no matter it is inside of a panel that is inside of another panel, etc. xD). Inside of my mouseClicked handler, I requested to obtain the focus with requestFocus(). Now focusLost handler is called even when you click in some part of the window not containing any component ;)
Thanks to KevinWorkman for the clue on focus listener!
Similar Threads
-
Double click event
By Dipke in forum New To JavaReplies: 3Last Post: 10-22-2010, 11:39 AM -
click event
By raman_v in forum Java ServletReplies: 2Last Post: 01-08-2010, 12:05 PM -
Swing - catching click button event
By Java Tip in forum Java TipReplies: 0Last Post: 03-11-2008, 11:03 PM -
AWT - catching click button event
By Java Tip in forum Java TipReplies: 0Last Post: 03-11-2008, 11:02 PM -
How to perform some event to button click
By eva in forum AWT / SwingReplies: 2Last Post: 01-16-2008, 12:27 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks