Java program to display 2D Array in ComboBox
How do I select a column in the array? I can select the row just fine but for my ComboBox I need to select the column as the values for the combobox.
Thanks in advance.
Code :
String[][] partNumberString =
{
{"PR214", "MR43T", "RBL8", "14K22"},
{"PR223", "R43", "RJ6 ", "14K24"},
{"PR224", "R43N ", "RN4 ", "14K30"},
{"PR246", "R46N", "RN8 ", "14K32"}};
//All the GUI objects
JPanel mainPanel = new JPanel();
JComboBox plainWrapComboBox = new JComboBox(partNumberString[[B]??[/B]]);
Re: 2D Array and ComboBox
I'm not sure if you can do that :confused:
How about just doing this:
Code :
String[][] partNumberString =
{
{"PR214", "PR223", "PR224", "PR246"},
{"MR43T", "R43", "R43N", "R46N"},
{"RBL8", "RJ6", "RN4", "RN8"},
{"14K22", "14K24", "14K30", "14K32"}
};
Then you can select the row and get the same result your after.