VComboBox.java doesn't pass value - old bug 250d

Whenever bugs are encountered they are quashed and reported. Here you can see their quashings up close.

Moderators: sureshquest, arulmani, trifon

VComboBox.java doesn't pass value - old bug 250d

Postby red1 » Wed Jul 28, 2004 11:53 am

THIS BUG HAPPENS IN GENERATE PURCHASE ORDERS FOR PROJECT (ORDER) old version 250d.

FILENAME: VComboBox.java
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)
return null;
//
if (p instanceof KeyNamePair)
{
if (p.getID() == null)
return null;
return new Integer(p.getID());
}
return p.getID();
} // getValue
red1
Site Admin
 
Posts: 2759
Joined: Tue Jul 06, 2004 3:01 pm
Location: Kuala Lumpur, Malaysia

Return to BUGS Galore!

Who is online

Users browsing this forum: No registered users and 2 guests

cron