Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2007

Tip: Looking for answers? Try searching our database.

InputVerifier issue in Java 6.

Thread view: 
jose.sandoval@gmail.com - 14 Dec 2007 07:07 GMT
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?
RedGrittyBrick - 14 Dec 2007 10:05 GMT
> I'm developing a Swing application and I'm using a bunch of input
> fields to get user information (JTextFields).
[quoted text clipped - 29 lines]
>
> Any thoughts?

button.setVerifyInputWhenFocusTarget(false);
jose.sandoval@gmail.com - 14 Dec 2007 16:17 GMT
On Dec 14, 5:05 am, RedGrittyBrick <RedGrittyBr...@SpamWeary.foo>
wrote:
> jose.sando...@gmail.com wrote:
> > I'm developing a Swing application and I'm using a bunch of input
[quoted text clipped - 32 lines]
>
> button.setVerifyInputWhenFocusTarget(false);

If could give your reply more than 5 stars, I'd give you double.

Thanks.
Lew - 15 Dec 2007 00:19 GMT
RedGrittyBrick suggested:
>> button.setVerifyInputWhenFocusTarget(false);

> If could give your reply more than 5 stars, I'd give you double.

There are no stars here, where "here" is Usenet direct, without Google Groups
in between.  Many of the participants have no ability to see or set "stars".

Signature

Lew

Andrew Thompson - 15 Dec 2007 10:45 GMT
>RedGrittyBrick suggested:
>>> button.setVerifyInputWhenFocusTarget(false);
[quoted text clipped - 3 lines]
>There are no stars here, where "here" is Usenet direct, without Google Groups
>in between.  Many of the participants have no ability to see or set "stars".

(..Nor care about 'star' ratings.)  

The kindest words to the ears of most people who
try to help out, is "that solved the problem".

Feel free to throw in a 'thank you' or ':-)' if you feel
so inclined, but the words (double) quoted above,
mean more than platitudes or ratings.

Signature

Andrew Thompson
http://www.physci.org/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.