Help with jCombox in NetBeans Module
Olalekan Samuel <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
Hi there,
I am trying to develop a NetBeans Plugin module that allows for
selection. I used the netbeans module suite project. In this module a
design a class that declare and initialize all the variable and data
that I want to use with string variables. In another which is a swing I
called one of the classes in the first combobox and it was working fine.
The problem is that I want to fill the second combobox with different
data from the previous class if each of the items in the first combobox
is selected. I used switch ....case but, the combobox is only filled
with the same data even when different items are selected. I have done
possible things and I have tried to look at any modules tutorial that
implement netbeans but I did not get any one and I could not get the
result. please can anybody help. It is urgent. This is the code for the
first class
public class EmuAPI {
private String[] device = new String[]{"Pagers", "PDA", "Phones"};
private String[] deviceType = {"Alcatel", "BenQ - Siemens", "LG",
"Motorola", "Nokia",};
private String[] deviceModALcatel = {"OT - C551","OT - C555", "OT -
C750", "OT - S850","OT - S853" };
private String[] deviceModBenQ = {"BenQ-Siemens C81", "BenQ-Siemens
CL71", "BenQ-Siemens CL75", "BenQ-Siemens Q-fi EF51", "BenQ-Siemens S68" };
private String[] deviceModLG = {"LG KG800 Chocolate", "LG P7200", "LG
U300", "LG U400", "LG U8330"};
//private String[] deviceModMitsubishi = {};
private String[] deviceModMotorola = {"Motorola A780", "Motorola
E1070", "Motorola RAZR V3i", "Motorola ROKR E2", "Motorola V980"};
private String[] deviceModeNokia = {"Nokia 6020", "Nokia 6060", "Nokia
N73", "Nokia N93", "Nokia N9300i"};
/** Creates a new instance of EmulatorAPI */
public EmuAPI() {
}
public String[] getDevice()
{
return device;
}
public String[] getDeviceType()
{
return deviceType;
}
public String[] getdeviceModALcatel()
{
return deviceModALcatel;
}
public String[] getdeviceModBenQ()
{
return deviceModBenQ;
}
public String[] getdeviceModLG()
{
return deviceModLG;
}
public String[] getdeviceModMotorola()
{
return deviceModMotorola;
}
public String[] getdeviceModeNokia()
{
return deviceModeNokia;
}
}
The is the code that I am using for the first jCombobox and its is
working fine
public class EmuSelect extends TopComponent implements ActionListener {
EmuAPI Emulating = new EmuAPI();
String[] test = Emulating.getDevice();
String[] test1 = Emulating.getDeviceType();
String[] test2 = Emulating.getdeviceModALcatel();
String[] testing = Emulating.getdeviceModLG();
public void fillComboBox1() {
jComboBox1.addItem(test[0]);
jComboBox1.addItem(test[1]);
jComboBox1.addItem(test[2]);
jComboBox1.invalidate(); }
This is the code I am using to fill the second jComboBox2 that is giving
me problem
public void fillComboBox2(){
iIndex = jComboBox1.getSelectedIndex();
switch (iIndex)
{
case 0:
jComboBox2.addItem(test1[0]);
jComboBox2.addItem(test1[1]);
jComboBox2.addItem(test1[2]);
jComboBox2.addItem(test1[3]);
jComboBox2.addItem(test1[4]);
jComboBox2.invalidate();
break;
case 1:
jComboBox2.addItem(testing[0]);
jComboBox2.addItem(testing[1]);
jComboBox2.addItem(testing[2]);
jComboBox2.addItem(testing[3]);
jComboBox2.addItem(testing[4]);
jComboBox2.invalidate();
break;
case 2:
jComboBox2.addItem(test2[0]);
jComboBox2.addItem(test2[1]);
jComboBox2.addItem(test2[2]);
jComboBox2.addItem(test2[3]);
jComboBox2.addItem(test2[4]);
jComboBox2.invalidate();
break;
default:
}
}
Please I will be so much obliged if anyone can help me out. I have
limited time to complete this work
--
Ogunleye Olalekan Samuel
Room 300 CVC Laboratory
Department of Computer Science
University of Cape Town
South Africa
+27(0)216502670 ------- Work
+27(0)792111220 ------- Mobile
+27(0)216899465 ------- Fax
Website: http://people.cs.uct.ac.za/~olaoye/