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 / May 2005

Tip: Looking for answers? Try searching our database.

JComboBox nuisance

Thread view: 
:-o - 11 May 2005 22:27 GMT
Thanks,

I create a JComboBox and setEditable(true) and set initial item to zero (which
looks like a textfield).
The problem?  1st time when keys are typed and <enter> key is pressed, it fires
itemlistener.

Only on the first time.

How do I turn off the <enter> from firing an itemlistener at startup?

jdk1.4
Arnaud Berger - 12 May 2005 07:54 GMT
Hi,

Maybe you could remove the corresponding KeyStroke from JComboBox's InputMap
.

Regards,

Arnaud

> Thanks,
>
[quoted text clipped - 8 lines]
>
> jdk1.4
:-o - 12 May 2005 20:50 GMT
I tried removing the keystroke from the inputmap and still consumes <enter> key

> Hi,
>
[quoted text clipped - 19 lines]
> >
> > jdk1.4
Fred L. Kleinschmidt - 12 May 2005 15:54 GMT
:-o wrote:
>
[quoted text clipped - 10 lines]
>
> jdk1.4

You say this happens only on the first time. What happens the next time
you modify the text then hit <enter>?

If you have registered an ItemListener on the JComboBox, it should be
invoked either twice every time you type the <enter> key after you
change the text: once to report that the original item was deselected,
and again to report that the new item has been selected.

If you turn somehow turn off <enter> from firing itemListeners, how will
your application know when you have finished entering a new value?

Signature

Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94  (206)544-5225
#! rnews 1487
Xref: xyzzy comp.lang.java.gui:128011
Newsgroups: comp.lang.java.gui
Path: xyzzy!nntp
From: "Fred L. Kleinschmidt" <fred.l.kleinschmidt@nospam_boeing.com>
Subject: Re: Animated GIF Freezes in the first cycle
X-Nntp-Posting-Host: xpc-ps-59.nw.nos.boeing.com
Content-Type: text/plain; charset=us-ascii
Message-ID: <42836EEF.328703C5@nospam_boeing.com>
Sender: nntp@news.boeing.com (Boeing NNTP News Access)
Content-Transfer-Encoding: 7bit
Organization: Boeing
X-Accept-Language: en
References: <a%Age.1637$OU1.1090@newsread3.news.pas.earthlink.net>
Mime-Version: 1.0
Date: Thu, 12 May 2005 14:57:51 GMT
X-Mailer: Mozilla 4.79 [en]C-CCK-MCD Boeing Kit  (Windows NT 5.0; U)

Bud Curtis wrote:

>
> I added an animated GIF to a JLabel's Icon, but the animation doesn't
[quoted text clipped - 14 lines]
> Bud Curtis
> Colorado Springs, CO

What's a JarItemRenderer?

Signature

Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94  (206)544-5225

Raekwon - 14 May 2005 17:38 GMT
remove the itemlistener from the code like this..
combobox.removeItemListener() and you can again implement it when ever you
want..


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.