🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #10271

Re: JMenuItem accelerator problem

#10271
From: David Sykes
Date: Fri, 22 Oct 1999 00:00
54 lines
2503 bytes
I am having another problem in another JFrame, also to do with accelarators,
I think :-).

Here I have a menu item "Finish" on a visible menu. This item has "Alt-F"
defined as an accelerator. There is also a JButton on the form which causes
exactly the same code to be executed, but is called via a separate event
handler.

I have a QueryDataSet attached to Jdb*** controls on the frame, and the I
make a change to one of the fields. The "Finish" code saves the changes, and
puts the controls disables the controls so no more changes are possible.

Depending how I call the "Finish" code I get different behaviour:

1) If I press the JButton with the mouse, everything works as it should.

2) If I select the JMenuItem from the menu, everything works as it should.

3) If I push the accelerator key, it goes through all of the motions, calls
saveChanges() on the dataSet, disables the controls, then issues a beep from
the PC speaker. The contents of the field are restored to their original
value (despite saveChanges() being called), and _no_ Exception is thrown!!

Can anyway shed some light on this???

I am using JDK 1.2.1 (as shipped with JB3 EE), but with HotSpot.

Thanks in advance,
David Sykes
edv consulting


David Sykes <SykesD@bigfoot.com> wrote in message
news:7uo0bv$8fr20@forums.borland.com...
> Hello all,
>
> I am having a small problem with a JMenuItem accelerator.
>
> I have a JDialog, with a JMenuBar. JMenuBar contains one non-visible
JMenu.
> One of the JMenuItems has an "Alt-S" defined as the accelerator for it.
>
> On the JDialog box I have a JdbTextField, and a JComoBox. Pushing Alt-S
> causes the menu item action listener to be called......but, it also sends
> the keystroke to whichever control is active.
>
> How can I get it to not send the keystroke to the control!??!!
>
> Any help will be greatly appreciated, thanks in advance,
> David Sykes
> edv consulting
>
>
>
Technical Details
Message-ID: <7uo30r$8fs11@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7uo0bv$8fr20@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,a07363f3340a1dba
X-Google-Attributes: gid111d45,public
From: "David Sykes" <SykesD@bigfoot.com>
Subject: Re: JMenuItem accelerator problem
Date: 1999/10/22
Message-ID: <7uo30r$8fs11@forums.borland.com>
X-Deja-AN: 539027423
References: <7uo0bv$8fr20@forums.borland.com>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing