2

how can i receive the combobox arrow icon in windows plaf like that:

enter image description here

and add it to another JLabel as Icon

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
choymns
  • 17
  • 1
  • 2

1 Answers1

3
  1. AFAIK you can to use new MetalComboBoxIcon() directly, required only import javax.swing.plaf.metal.MetalComboBoxIcon; you (never tried) have to search for equivalent in another L&Fs, no idea if you talking (windows plaf like that:) about SystemL&F (Windows) or WindowsClassicLookAndFeel

  2. better ways are_

    • get Icon from JComboBox(loop in JComboBoxes JComponent there is XxxComboBoxButton) e.g. MetalComboBoxButton, this button contains Icon

    • look into BasicComboBoxUI or WindowsComboBoxUI (there is only about paintIcon), copy those code and create own class for Icon by override paintIcon

    • create own Icon

    • I'b be use own Icon or MetalComboBoxIcon then result isn't L&F sensitive,

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319