急求一个纯JAVA代码编写的GUI设计
来源:百度知道 编辑:UC知道 时间:2024/06/28 04:59:26
我觉得给你指一条路比给你一个例子要好,授你以渔!你可以在eclipse中安装swt插件,它支持可视化的开发,是java图形界面设计的福音。
试试吧~~~
用netbeans 啊,有简单的不用你却要用复杂的..
/**
* @(#)B1.java
*
*
* @author iwt
* @version 1.00 2008/6/6
*/
import javax.swing.event.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;
public class B1 extends JFrame implements TreeSelectionListener{
JTree tree;
DefaultMutableTreeNode root,parent,child;
B1(){
root=new DefaultMutableTreeNode("总文件夹");
parent=new DefaultMutableTreeNode("文件夹");
child=new DefaultMutableTreeNode("文件1");
tree=new JTree(root);
root.add(parent);
parent.add(child);
tree.addTreeSelectionListener(this);
this.add(tree,BorderLayout.WEST);
this.setBounds(200,200,500,500);
this.setVisible(true);
}
public void valueChanged(TreeSelectionEvent e){
System.out.prin