开发者

How do I "combine" JButton with JComboBox?

开发者 https://www.devze.com 2023-02-01 00:33 出处:网络
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 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

精彩评论

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