Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getSelectedIndex

 
nitish dhar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Calendar cal = new GregorianCalendar();
int date=cal.get(Calendar.DATE);


i passed date into the

jComboBox.getSelectedIndex(date)

so that it shows the current date only in the combo box as the first item

but the command seems to have an error ....???
 
Campbell Ritchie
Sheriff
Pie
Posts: 50243
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the API documentation for JComboBox#getSelectedIndex. You are using incorrect arguments.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Days of the month / year are 1 based, whereas the JComboBox index is 0 based.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic