Questions tagged [comboboxmodel]

48 questions
0
votes
0 answers

Understanding JComboBoxModel

I am getting what, to me, seems like odd behavior. I've created createComboBoxModel. I then create 2 new JComboBoxes and add the model to each as ComboBoxDefaultModel. Although the combo boxes are different instances, using the model seems to…
Wt Riker
  • 514
  • 12
  • 24
0
votes
3 answers

how use JComboBox with Class value

I have made this: private JComboBox vehicleType = new JComboBox(); DefaultComboBoxModel dcbm = new DefaultComboBoxModel( new Class[] {Truck.class, Trailer.class, RoadTractor.class, SemiTrailer.class, Van.class, Car.class}) { …
Gioce90
  • 554
  • 2
  • 10
  • 31
0
votes
0 answers

Using a List as ComboBoxModel

I have a LinkedList of objects which is often changed by another thread and I also have a JComboBox which should show all these objects synchronous to the state of the list. What is the best way to do this? I think I have to deal with a…
Sören Henning
  • 326
  • 4
  • 16
0
votes
1 answer

jcombobox - check whether model content changed

I have created a class extending JComboBox. the model is set like this: DefaultComboBoxModel readoutModel = new DefaultComboBoxModel(options.toArray(new String[options.size()])); setModel(readoutModel); The class implements a…
Antje Janosch
  • 1,154
  • 5
  • 19
  • 37
0
votes
1 answer

Get Id and data from database and add to JCombobox

I want to get name and id from database and add it to JCombobox. For this i used public void add_Category(JComboBox cmb) { try { String query = "SELECT * FROM categories"; ResultSet rs =…
DR Jerry
  • 51
  • 3
  • 11
0
votes
1 answer

Allow JComboBox to accept List or HashMap instead of String[]

When inputting a new Student object inside my JTables I would like to hold all the localities/cities inside my JComboBox. Each city is stored inside a HashMap which holds the name as key(as there are no duplicates) and it's postcode. Example:…
Juxhin
  • 5,068
  • 8
  • 29
  • 55
0
votes
1 answer

Updating JComboBox while app is running

Using list0.setModel(new DefaultComboBoxModel(toTable.data)); I can update the whole JComboBox (list0)... but I want to add a few lines to it (need to have few different positions to choose from on my list). When I'm using this command, it makes an…
user3019431
  • 11
  • 1
  • 1
  • 4
0
votes
1 answer

Auto refresh jcombobox

Hello I have the following setup. This are the 6 classes I have. Inside the BankApp I have an arraylist that stores all the person objects. The BankAccView and the PersonView both have a JComboBox so I can choose a "Person" object for example to…
Reshad
  • 2,570
  • 8
  • 45
  • 86
0
votes
2 answers

ComboBoxModel - removeItem method for fireIntervalRemoved throws exception

I've created a ComboBoxModel class which extends AbstractListModel. I can add item to the combobox, but when I try to remove, I get an exception Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: null source at line…
0
votes
1 answer

Any way to cause a refresh of selectedItemReminder in JComboBox

I have a JComboBox with a custom model which extends DefaultComboBoxModel. When I want to add an item to my combo box I add it to the model and repaint the JComboBox. However, this is leaving the internal field: selectedItemReminder unchanged.…
James Robinson
  • 1,222
  • 1
  • 15
  • 43
0
votes
1 answer

Java JFrame ComboBox situation

I have this problem in a Jframe. I use a JComboBox to display some choices for the user(from a datebase), he picks a choice and then after rerunning initComponents(), I want to exclude this choice and show only the rest.But for some reason no…
Phil_Charly
  • 137
  • 13
0
votes
1 answer

NotSerializableException when using DefaultComboBoxModel in another class

I'm working on a big school project and it's coming to an end. I want 2 JComboBoxes to be synchronized at the different classes(JPanels) in my program, and after not knowing much about how JComponents works I found out that it's not the JComboBox…
Amiga
  • 663
  • 8
  • 13
0
votes
0 answers

JComboBox's popup menu filled with blank values when the underlying model has too much elements

First, let me discuss the data model : I've compiled an HL7 definition in an tree-like object model, with 3 levels : Segment, Element and Subelement. The segment contains a List, and the Element contains a List. The relationship between those is…
madgangmixers
  • 150
  • 1
  • 16
0
votes
1 answer

Populating a JComboBox using Enum Class

I'm trying to populate JComboBox with enums declared in Colour.java. I can access the description of the enums using Colour.values() but is it possible to access the enum declaration itself? I'd like the JComboBox populated with Blue and Red. …
0
votes
1 answer

Editable Jcombobox not populating data from database

in my Java swing application, I want Jcombobox populate with some data from database as well as allow user to enter keyword they wish in order to search using combobox value. So i set the editable mode to true.But then i lost data coming from…
amal
  • 3,470
  • 10
  • 29
  • 43