JAVA JTree Demo
노드를 하나씩 만들어서 , 차례로 붙여주면 된다.
JTreeDemo.java
JTreeDemo.java
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.tree.*;
- protected JTree tree;
- public JTreeDemo(){
- super("JTree Demo");
- DefaultMutableTreeNode jcomponent=
- DefaultMutableTreeNode jpanel=
- DefaultMutableTreeNode jtextcomponent=
- DefaultMutableTreeNode jtree=
- jcomponent.add(jpanel);
- jcomponent.add(jtextcomponent);
- jcomponent.add(jtree);
- DefaultMutableTreeNode jtextarea=
- DefaultMutableTreeNode jtextfield=
- jtextcomponent.add(jtextarea);
- jtextcomponent.add(jtextfield);
- tree.addMouseListener(this);
- setSize(300,200);
- setVisible(true);
- }
- /* MouseListener Interface 구현을 위한 부분 */
- if(path ==null)
- return ;
- }
- }
- JTreeDemo td = new JTreeDemo();
- }
Interessante...
답글삭제Meu blog http://isjavado.wordpress.com/