6

At example libre office has button with drop down menu, but it isn't combobox:

Button Snapshot

Does Swing have analog or something similar?

mystdeim
  • 4,802
  • 11
  • 49
  • 77

2 Answers2

2

There's no SplitButton implementation provided by Java. I provided a link to another question on this site in my comment on potential implementations and would add that Jidesoft has also an implementation of a SplitButton in their open source JIDE Common Layer, check the licenses first.

Community
  • 1
  • 1
Jonathan Drapeau
  • 2,610
  • 2
  • 26
  • 32
1

Not directly, but you can easily achieve it by wrapping an ImageIcon into a Button. (arrow_down.png is the downwards pointing, black arrow)

button = new JButton();  
button.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/icons/arrow_down.png")));  
button.setBorderPainted(false);  
button.setFocusPainted(false);  
button.setContentAreaFilled(false);  
poitroae
  • 21,129
  • 10
  • 63
  • 81