简体   繁体   中英

Can a JPanel be placed in a JComboBox?

So.. I want to use a JPanel to display images and needed instance variables of a certain object. is it possible for each JPanel I make for each individual Object to be displayed as is in a JComboBox? That is, a click on the combo box drops down a number of JPanels, each representing an object. Thanks

It is possible. What you are looking for is called a renderer. It exists for various Swing components. Take a look at this short introduction under the section "Providing a Custom Renderer".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM