Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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 ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!