展开全部
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/*
* CustomComboBoxDemo.java 你要有下列文件
* images/Bird.gif
* images/Cat.gif
* images/Dog.gif
* images/Rabbit.gif
* images/Pig.gif
*/
public class CustomComboBoxDemo extends JPanel {
ImageIcon[] images;
String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Pig"};
/*
* Despite its use of EmptyBorder, this panel makes a fine content
* pane because the empty border just increases the panel's size
* and is "painted" on top of the panel's normal background. In
* other words, the JPanel fills its entire background if it's
* opaque (which it is by default); adding a border doesn't change
* that.
*/
public CustomCo