red1.org Forum Index red1.org
Nihili est - in vita priore ego imperator romanus fui
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    red1.org Forum Index -> BUGS Galore!
View previous topic :: View next topic  
Author Message
red1
Site Admin


Joined: 06 Jul 2004
Posts: 1756
Location: Kuala Lumpur, Malaysia

PostPosted: Wed Jul 28, 2004 11:53 am    Post subject: VComboBox.java doesn't pass value - old bug 250d Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    red1.org Forum Index -> BUGS Galore! All times are GMT + 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group