🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #312

I am finding managing focus and verifying fields on a form to be a major hassle.

#312
From: Paul Murray
Date: Fri, 11 May 2001 13:39
39 lines
3168 bytes
I am finding managing focus and verifying fields on a form to be a major
hassle.

We have a form - ok? A JPanel. It has a client code textfield (tC), and two
other textfields each with a button (tA and tB, and bA and Bb).

If the user types anything into tA, then tries to move the focus elsewhere,
then tA must be freified and must grab the focus back ... *UNLESS* they have
clicked bA, becuase bA pops up a picklist.

I could stick an inputverifier on tA and tB, but I'd have to tell bA and Bb
to ignore input verifiers. But that's no good, because they must not ignore
*each other's* verifiers, only their own.

There are a score of problems like this. Basically, we need to catch "they
are moving focus from component X to component Y - is this ok?", and there
seems to be no place to catch it. InputVerifier only half works, becuae it
wont tell you where the focus is going *to*. We have our own focus manager,
but that handles only keystrokes, not mouse clicks.

Plus, there's the BasicButtonUIListener bug with respect to input verifiers,
but that's another issue.

I don't want to slap FocusEventListeners on each component - although it's a
solution, I suppose. I could make one FocusEventListener for the form and
recursively apply it to all components that catch focus. Of course, you have
to use reflection to determine what components do that, because there is no
FocusEvenSource interface.

I have so many different *bits* to do the things that the users expect. I
have a AWTEventListener to catch double-clicks before JTextField consumes
them. I have a FocusManager to catch tab keys on certain components and
generate ActionPerformed events instead. And interfaces to go with them,
that the forms implement.

Isn't there something simpler?
--------------------------------------------------------------
http://www.users.bigpond.com/pmurray
ICQ: 26066755
Technical Details
Message-ID: <4p0L6.24665$482.119520@newsfeeds.bigpond.com>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!newsfeeds.bigpond.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10fd6d,778982b2a824289d,start
X-Google-Attributes: gid10fd6d,public
X-Google-Thread: 10d6db,778982b2a824289d,start
X-Google-Attributes: gid10d6db,public
X-Google-Thread: 113ae9,778982b2a824289d,start
X-Google-Attributes: gid113ae9,public
X-Google-ArrivalTime: 2001-05-11 18:46:45 PST
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!intgwpad.nntp.telstra.net!newsfeeds.bigpond.com!not-for-mail
From: "Paul Murray" <pmurray@nospam.bigpond.com>
Newsgroups: aus.computers.java,comp.lang.java.gui,comp.lang.java.help
Subject: I am finding managing focus and verifying fields on a form to be a major hassle. 
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.3018.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300
Message-ID: <4p0L6.24665$482.119520@newsfeeds.bigpond.com>
Date: Fri, 11 May 2001 23:39:25 +1000
NNTP-Posting-Host: 203.54.251.251
X-Trace: newsfeeds.bigpond.com 989631168 203.54.251.251 (Sat, 12 May 2001 11:32:48 EST)
NNTP-Posting-Date: Sat, 12 May 2001 11:32:48 EST
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)