Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2877

InputVerifier issue in Ja

From "jose.sandoval" <jose.sandoval@THRWHITE.remove-dii-this>
Subject InputVerifier issue in Ja
Message-ID <4bb7c739-2ebe-4a8e-9f53-dfbe4515ea93@b40g2000prf.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:41 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
I'm developing a Swing application and I'm using a bunch of input
fields to get user information (JTextFields).

I want fields to be of a certain format, and so I'm using
InputVerifier to validate the fields. I found this solution quite
useful and so I have extended it:

http://www.javalobby.org/java/forums/t20551.html.

Now, the problem I have is with that fields' validation is being
triggered regardless of where a button is clicked in my application. I
get why the InputVerifier works that way, as it has no context of what
the action means, so it just does it thing. But I don't want that.

This is what my app looks like: I have my application divided into two
panels. On the left panel, I have my controls (buttons and menus); on
the right panel, I have my fields to gather information. I need the
user to have focus on these fields. So, when I click on the left
panels controls (buttons), I DON'T WANT the fields to be validated.
However, the button click gets propagated all the way to
InputVerifier .

A solution I can think to this problem is to block the event to
propagate and just handle the click at the button's event handler, but
I can't seem to figure it out.

I catch the event at the button's event handler, all right; however,
the InputVerifier ALWAYS knows that the button was clicked--that is,
if it has focus. But I want this fields to have focus, but if I click
somewhere else, I don't want to validate them: I want the validation
to be ignored.

Any thoughts?

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar | Unroll thread


Thread

InputVerifier issue in Ja "jose.sandoval" <jose.sandoval@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000
  Re: InputVerifier issue i "RedGrittyBrick" <redgrittybrick@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000
    Re: InputVerifier issue i "jose.sandoval" <jose.sandoval@THRWHITE.remove-dii-this> - 2011-04-27 15:41 +0000

csiph-web