• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

JComboBox setEditor()  RSS feed

 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I would like to set the editor in a non-editable JComboBox.
<code>
JComboBox box = new JComboBox();
box.setEditor(BasicComboBoxEditor {
/**
* @param item
*/
public void setItem(Object item) {
System.out.println("set item");
super.setItem(item);
editor.selectAll();
}
});
</code>
When I use the above code the editor is not used. Any thoughts?
Thank you.
Yoo-Jin.
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you don't have to set the Editor explicitly, just use
comboBox.setEditable(true);
setting the Editor makes only sense if you want to use an Editor _other_ than a JTextField which is the default. even then you have to always make the combo box editable in the first place.
cheers
 
Yoo-Jin Lee
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chantal,
Actually, the reason I want to set the editor is because of Bug Id 4648654:REGRESSION: Editable JComboBox focus misbehaves under Windows look and feel. I should have stated this in my first message. This seems to also apply to a non-editable JComboBox with a JActiveX component in the same container.
Basically, the JComboBox freezes the whole application if you click on it in a certain order.
The workaround was to set the editor with the code in my first message.
This bug is fixed in builds greater than 1.4.0-b92. However, they latest is in rfc so we cannot include it in our product.

Yoo-Jin.
[ August 22, 2002: Message edited by: Yoo-Jin Lee ]
 
Popeye has his spinach. I have this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!