刚刚用JComboBox实现了一个三级联动菜单
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- public class ComboBoxDemo extends JFrame {
- private DefaultComboBoxModel model = new DefaultComboBoxModel();
- private DefaultComboBoxModel model1 = new DefaultComboBoxModel();
- private DefaultComboBoxModel model2 = new DefaultComboBoxModel();
- private JComboBox firstComboBox;
- private JComboBox secondComboBox;
- private JComboBox thirdComboBox;
- private String[] first = { "001", "002", "003" };
- private String[] second_first = { "00101", "00102", "00103" };
- private String[] second_second = { "00201", "00202", "00203" };
- private String[] second_third = { "00301", "00302", "00303" };
- private String[] third_first_first = { "0010101", "0010102", "0010103" };
- private String[] third_second_first = { "0010201", "0010202", "0010203" };
- private String[] third_third_first = { "0010301", "0010302", "0010303" };
- private String[] third_second_second = { "0020101", "0020102", "0020103" };
- private String[] third_first_second = { "0020201", "0020202", "0020203" };
- private String[] third_third_second = { "0020301", "0020302", "0020303" };
- private String[] third_first_third = { "0030101", "0030102", "0030103" };</