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

Tip: Looking for answers? Try searching our database.

What to override inJComboBox

Thread view: 
bobjan - 29 Aug 2005 14:03 GMT
I need a class that extends JComboBox, but with slightly different
behaviour. I want to intercept mouse click on an item in the list, do
some processing, and sometimes prevent the item to be treated as
selected.
I think it could be done by overriding some JComboBox method  but don't
know which one(s). I have tried with custom renderers, editors,
listmodels, but no success.
Can anyone give me a clue ?
Monique Y. Mudama - 29 Aug 2005 15:16 GMT
> I need a class that extends JComboBox, but with slightly different
> behaviour. I want to intercept mouse click on an item in the list,
[quoted text clipped - 3 lines]
> renderers, editors, listmodels, but no success.  Can anyone give me
> a clue ?

What about just the MouseListener stuff?

Signature

monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

Thomas Fritsch - 29 Aug 2005 15:22 GMT
>>I need a class that extends JComboBox, but with slightly different
>>behaviour. I want to intercept mouse click on an item in the list,
[quoted text clipped - 5 lines]
>
> What about just the MouseListener stuff?

And what about JComboBox.addItemListener? ItemListener has an
itemStateChanged method, which is invoked when an item has been
selected/deselected.

Signature

"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')

bobjan - 29 Aug 2005 16:09 GMT
Yes, I tried with my own Listener, and it cought the click. But I
couldn't deactivate(remove) other Listeners so the Popup disappeared,
and I want to make it visible, until my processing allows it to hide.
To change the question, how can I prevent the popup component to hide ?
Default behavior reacts to the very first click on an item in the list,
the item is selected and the popup hides. I want  to make the popup
visible after the item is selected, and hide it only if I want it to.
Naturally, I want it to hide automatically if the focus is moved
elsewhere.


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.