Article View: borland.public.jbuilder.java.swing
Article #9115Re: Jtextfield problem
From: Paul Furbacher [TeamB]
Date: Fri, 26 May 2000 00:00
Date: Fri, 26 May 2000 00:00
56 lines
3390 bytes
3390 bytes
Sven Goetgeluck wrote:
>
> Code [snipped]
>Where do i put the actionmistener of the spinner in the
Nemericeditfield do
> it listens to reaction of the spinner?
In your NumericEditControl, activate the Designer and click on
the spinner object. Go to the "Events" tab of the Property Inspector.
Triple-click on the "actionPerformed" event. When JBuilder takes
you to the editor, write your code which handles the action command
coming from the spinner.
> how to add a listener to the frame so i can update other components in the
> frame , is this possible without the enter key????
Once again, __implement__ the Adjustable interface. In the code
you showed, you had only implemented a few of the methods. ***Use
the "Implement interface" wizard.*** For most of the "set" methods
in the interface, you can leave them empty for now.
Then from the actionPerformed event handling you added above, you
fire the adjustment event after either decrementing or incrementing.
For the fireAdjustmentValueChanged(), addAdjustmentListener() and
remove...() methods, STEAL them verbatim from JScrollbar. Just
type in "JScrollBar sb = null;" anywhere in the editor, compile,
and then select "JScrollBar" and "Browse Symbol". That will drill
down into the JScrollBar class, and from there you can steal the
necessary code. You don't have to change a word in these three
methods. Steal the JavaDoc comments and change them to reflect
your component, and maybe add a reminder in there that you stole
this code. No big deal, but helps you remember where it came
from.
The following goes in the Frame, not in the Control. Your Frame is
the listener, so it implements the AdjustmentListener interface or
has a delegate implement it.
> public void adjustmentValueChanged(AdjustmentEvent e) {
> //TODO: implement this java.awt.event.AdjustmentListener method;
> }
Oh, while you're at it, take out the "border1" related code. It's
dead -- nothing uses "border1".
By the way ... do you have a good reference book on Swing? It
might be time to hunt around for one at your local technical
bookstore. It's probably a good time to read up on events,
implementing interfaces, etc. "Java In a Nutshell" (3rd edition
by now) is one of my best friends. There are other books, though,
and you should find one which you feel comfortable with.
Paul Furbacher (TeamB)
Technical Details
Message-ID:
<392E038F.9915280A@home.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<3921af12@dnews> <39230C94.3B09A3A0@home.com> <39242302@dnews> <MPG.138e6cabc7cff616989936@forums.borland.com> <39250aa2@dnews> <MPG.139148a8c31034b098993c@forums.borland.com> <392A7C85.7D72C823@officeline.be> <MPG.139505deb9177169989947@forums.borland.com> <392BEFE0.6249F1E8@officeline.be> <392C4CAD.2C8B800C@home.com> <392c5d2d@dnews> <MPG.1396a443467bdd02989954@forums.borland.com> <392D3672.C45A6D1F@home.com> <392d8347@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e3d8a7969574fa02 X-Google-Attributes: gid111d45,public From: "Paul Furbacher [TeamB]" <pnf@home.com> Subject: Re: Jtextfield problem Date: 2000/05/26 Message-ID: <392E038F.9915280A@home.com> X-Deja-AN: 627449440 Content-Transfer-Encoding: 7bit References: <3921af12@dnews> <39230C94.3B09A3A0@home.com> <39242302@dnews> <MPG.138e6cabc7cff616989936@forums.borland.com> <39250aa2@dnews> <MPG.139148a8c31034b098993c@forums.borland.com> <392A7C85.7D72C823@officeline.be> <MPG.139505deb9177169989947@forums.borland.com> <392BEFE0.6249F1E8@officeline.be> <392C4CAD.2C8B800C@home.com> <392c5d2d@dnews> <MPG.1396a443467bdd02989954@forums.borland.com> <392D3672.C45A6D1F@home.com> <392d8347@dnews> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii Organization: Reverse Alchemy, Inc. Mime-Version: 1.0 Reply-To: pnf@home.com Newsgroups: borland.public.jbuilder.java.swing