请问高手们,如何在select在下拉框中,以树型结构显示代替列表显示,谢谢

解决方案 »

  1.   

    你说的是什么??是不是下拉列表框呀??import javax.swing.ComboBoxModel;
    import javax.swing.DefaultComboBoxModel;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;public class Try extends JFrame {
    public Try() {
    super("");
    this.setBounds(100, 100, 200, 200);
    this.setLayout(null);
    String[]s={"1","2","3"};
    ComboBoxModel cmb=new DefaultComboBoxModel(s);
    JComboBox box=new JComboBox(cmb);
    box.setBounds(10,20,100,30);

    this.add(box); this.setVisible(true);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
    public static void main(String[]args){
    new Try();
    }}