select + tree的问题

227guolao 2009-05-14 09:26:47
请问高手们,如何在select在下拉框中,以树型结构显示代替列表显示,谢谢
...全文
80 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
GeekZFZ 2009-05-14
  • 打赏
  • 举报
回复
你说的是什么??是不是下拉列表框呀??

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();
}

}

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧