Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Label in Combobox  RSS feed

 
Rani Vish
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I want to add a JLabel in JComboBox as a first element ,is it possible ?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you mean that you want to have a Label *shown* in the combobox, you should take a look at its setRenderer method. Notice that the DefaultListCellRenderer class *is* a JLabel.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!