Joined: 06 Jul 2004
Location: Kuala Lumpur, Malaysia
|Posted: Wed Jul 28, 2004 11:53 am Post subject: VComboBox.java doesn't pass value - old bug 250d
|THIS BUG HAPPENS IN GENERATE PURCHASE ORDERS FOR PROJECT (ORDER) old version 250d.
BRIEF: Java Swing somewhat doesnt persist the value the user has clicked on. This is the workaround. Should be solved in later versions.
public Object getValue()
// Bug due to javax.swing.JComboBox.getSelectIndex -- solution by sureshquest & Red1
// if (getSelectedIndex() == -1) Removed because g-Index returns -1 accidently in certain cases
if (getSelectedItem()== null) //Used because g-Item returns correctly in all cases
return null; // all we wana do is return null when its really null
// more notes behind bug:
// how did we first found the bug? answer: refer to sourceforge bug thread: --
// why did g-Index returns erroneously "-1" when it shouldn't where something was selected?
// answer: JComboBox (a java class, out of our jurisdiction) has a method we suspect
// "public int getSelectedIndex()" which does not obtain a true value from
// Item. Thus if Item is "10000004" then Index must not return "-1" but it
// sometimes do. In fact it does that on the second call to the combo box.
// The End - "Ignorance is The Greatest Sin" solved by sureshquest
NamePair p = (NamePair)getSelectedItem();
if (p == null)
if (p instanceof KeyNamePair)
if (p.getID() == null)
return new Integer(p.getID());
} // getValue