Re: This is what I want the JComboBox to do for me
"Witold Szczerba" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
Hello again! Few things before I get started: 1) do not change teh subject in that way, because you broke the thread into two separated pices. 2) do NOT name variables or fields with names with first capital letter! That is againts convention (names of classes are the only allowed to have capital letters first). For example: String[] Devices = ... should be replaced by String[] devices = ... In this way you can easily distinguish between classes from instances of that classes from fields from.... etc.... The code you presented is missing too many things (I mean it is only a fragment), but maybe there should be something like getJComboBox1(), and you could use this method where I said befor - in 'code generation' property of CODE tab in properties window. Of course you would have to get instance of that object containing getJComboBox1() method first... 2006/8/23, Olalekan Samuel <[email protected]>: > private String[] Device = new String[]{"Pagers", "PDA", "Phones"}; > > public String[] getDevice() > { > return Device; > } > and this is the code that I used to collect the data into the JComboBox > > EmuAPI Emulating = new EmuAPI(); // I declare the instance of that class > String[] test = Emulating.getDevice(); > > public void fillComboBox1() { > jComboBox1.addItem(test[0]); > jComboBox1.addItem(test[1]); > jComboBox1.addItem(test[2]); > jComboBox1.invalidate(); > } >