How do I "combine" JButton with JComboBox?
How do I "combine开发者_如何转开发" JButton with JComboBox and place it on a JToolbar, as shown in this image:
You'll want to use a custom renderer I suspect, and have it display clickable buttons (with the appropriate actions attached, etc).
Just create regular combo box and put image as an item. I did it once. Unfortunately I do not have a source code here but as far as I remember it was not a problem. You have to implement your custom 1ListCellRenderer. Its method
getListCellRendererComponent()` should return for example Label with your image.
精彩评论