Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 14th, 2004, 02:16 AM
calabor calabor is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 calabor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Problems with JComboBox.setSelectedIndex(an Object)

Hi!
We have an application than run with an applet. In some parts we have JComboBoxes components. We use to update de selected component the method setSelectedIndex thta take an object like in parameter.

If we run the applet with the java plug-in 1.3 we have no problem to actualized the selected index in the comboBox components but when we run the applet with the java plug-in 1.4 this doesn't work and the index displayed by the combo box is allways which with index 0.

Someone know why this happen and the solution??? Any help will be appreciated. Thank you very much.

Reply With Quote
  #2  
Old June 25th, 2004, 11:18 AM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
calabor,

Are you sure you're using setSelectedIndex correctly? I've taken a look at the Java APIs and confirmed my suspicions:

public void setSelectedIndex(int anIndex)

The setSelectedIndex method doesn't support passing an Object, but rather an index value of type int. You may want to look at the public void setSelectedItem(Object anObject) method, which will likely fix your problem.

Source: http://java.sun.com/j2se/1.4.2/docs.../JComboBox.html

HTH...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > Problems with JComboBox.setSelectedIndex(an Object)


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT