开发者

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:

How do I "combine" JButton with JComboBox?

?


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 methodgetListCellRendererComponent()` should return for example Label with your image.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜