wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes combobox problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "combobox problem" Watch "combobox problem" New topic
Author

combobox problem

terry oliver
Greenhorn

Joined: Jan 04, 2008
Posts: 22
I am using the combobox to display some array items my problem is it does not automatically display the first array items i have to display items 2 and then return to 1 for the display.

private void secData_actionPerformed(ActionEvent e)
{
String o = (String)secData.getSelectedItem();
Integer choice = Integer.parseInt(o);

for (int x = 0; x < secTurnsTemp.size(); x++) {

if (choice.intValue() == x+1)
{
secTurns1.setText(((Double)secTurnsTemp.get(x)).toString());
wireSize1.setText(((Double)secGaTemp.get(x)).toString());
secOhm1.setText(String.format("%6.3f",((secOhmsTemp.get(x)))));
cmPerAmp1.setText(((Double)secCmTemp.get(x)).toString());
}
else if (choice.intValue() > secTurnsTemp.size())
{
secTurns1.setText("");
wireSize1.setText("");
cmPerAmp1.setText("");
secOhm1.setText("");
}
}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: combobox problem