jcombobox Questions

5

Solved

I would like to populate a java.swing JComboBox with values from an Enum. e.g. public enum Mood { HAPPY, SAD, AWESOME; } and have these three values populate a readonly JComboBox. Thanks!
Hypertrophy asked 22/9, 2009 at 9:32

4

Solved

I have a JComboBox and would like to have a separator in the list of elements. How do I do this in Java? A sample scenario where this would come in handy is when making a combobox for font-family-...
Afterwards asked 26/9, 2008 at 11:12

7

I am working on a very simple GUI in Java. In this GUI I want to display: A label with some text on the top of the page A JComboBox under the mentioned label A JButton under the mentioned JCombo...
Harley asked 19/3, 2014 at 12:47

6

I have created a jComboBox but it takes the full width of the frame. how to set the width fixed. yes borderlayout for the frame and box layout for the panel. i am adding the code here: import ja...
Sayre asked 7/1, 2011 at 18:37

5

Solved

I am trying to set an icon to a JLabel from a folder of images whenever an item is selected from a JComboBox. The name of items in the JComboBox and name of the images in the folder are same. So wh...
Discussant asked 3/3, 2013 at 4:1

3

Solved

I have a program with multiple comboboxes, each with their own action listener. Selecting an item from any of the comboboxes will change the items in one or more of the other comboboxes. The proble...
Sharpen asked 2/5, 2012 at 4:22

4

Solved

The background color of the selected item in an uneditable JComboBox is a sort of blue: Is there any way to make this a different color, such as white, for example?
Lunik asked 10/12, 2010 at 20:14

8

Solved

I'm trying to get an event to fire whenever a choice is made from a JComboBox. The problem I'm having is that there is no obvious addSelectionListener() method. I've tried to use actionPerformed(...
Christinachristine asked 12/9, 2008 at 13:24

3

I am programming an editable combobox in a JFrame Form, but i want to change te background color. How the program works: If i click the button "press", then the combobox his background needs to be...
Impetrate asked 21/4, 2012 at 10:46

10

Solved

I want to set the selected index in a JComboBox by the value not the index. How to do that? Example public class ComboItem { private String value; private String label; public ComboItem(Strin...
Balaton asked 30/11, 2011 at 14:20

6

Solved

I use a combo box on panel and as I know we can add items with the text only comboBox.addItem('item text'); But some times I need to use some value of the item and item text like in html select...
Contrapuntal asked 26/7, 2013 at 17:56

9

Solved

I need your suggestions and guidence on following task. I have a frame which has two JComboBoxes supposed they are named combo1 and combo2, a JTable and other components. At initial stage when fr...
Scampi asked 10/3, 2011 at 10:49

5

Solved

I'd like to create a readonly combobox. The user should not be able to select another item from the popup list. That means that the popup list should not open or should be empty. I see the followi...
Assegai asked 6/5, 2014 at 16:32

3

Solved

How to retrieve Text that is typed in JComboBox. This text need not be an existing item.
Kurtz asked 16/8, 2010 at 19:21

3

Solved

I'm trying to get the following program to compile from "Introduction to Java Programming 9th edition, by Liang. I'm getting an error with the following example in regards to the JComboBox: import...
Figuration asked 4/8, 2013 at 23:2

6

I have editable JCombobox and I added keylistener for combobox editor component. When user press 'Enter key' and if there is no text on the editable combobox I need to display message box using JOp...
Zach asked 27/12, 2012 at 14:32

1

In this question (Adding items to a JComboBox) it is described how an Item can be added to a JComboBox. This would allow to store an Object in a JComboBox, and overriding the toString() metho...
Ken asked 10/11, 2019 at 14:13

3

Solved

Edit Downvoter, how is this a bad question? I have provided runnable example code of the issue. If it works for you please let me know or point out what is unclear. Hello, in the code below which...
Crinkle asked 1/6, 2011 at 17:42

5

Is it possible to set a value and a label to a JComboBox so I can show a label but get a value that is different? For example in JavaScript I can do: document.getElementById("myselect").options[0...
Delrosario asked 14/4, 2011 at 10:2

9

I need to remove all items from the combo box int itemCount = combo.getItemCount(); for(int i = 0; i < itemCount; i++){ combo.removeItemAt(0); } This code will remove all items except the las...
Menashem asked 3/9, 2012 at 13:59

8

Solved

I need to populate a JComboBox with an ArrayList. Is there any way to do this?
Averyaveryl asked 18/8, 2009 at 3:55

4

I have been searching this site and google for a solution to my problem, and I can't find anything. I think it's supposed to just work; however, it doesn't. The arrow icon for my JComboBox doesn't ...
Hardpan asked 30/5, 2012 at 20:50

6

I have generated a GUI from netbeans in which I have placed a combobox too. By default, the items in combobox are item1, item2, item3, item4. But I want my own items. Netbeans doesn't allow editi...
Bandy asked 9/10, 2009 at 6:21

2

I get the exception: Exception in thread "AWT-EventQueue-0" java.util.MissingResourceException: Couldn't find 3-letter country code for CS at java.util.Locale.getISO3Country(Locale.java:1521) at...
Silvie asked 28/11, 2012 at 19:16

3

Solved

Below statement in if condition is not working, please provide me some solution that how to set selected item for JComboBox which are populated by ENUM. public enum EbayContryEnum { AT (3), A...
Copyreader asked 18/12, 2013 at 6:33

© 2022 - 2024 — McMap. All rights reserved.