root / trunk / libraries / libUIComponent_praster / src-test / org / gvsig / gui / beans / treelist / TestTreeList.java @ 8026
History | View | Annotate | Download (1.77 KB)
1 | 8026 | nacho | package org.gvsig.gui.beans.treelist; |
---|---|---|---|
2 | |||
3 | import java.awt.event.ComponentEvent; |
||
4 | import java.awt.event.ComponentListener; |
||
5 | |||
6 | import javax.swing.JFrame; |
||
7 | |||
8 | import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
||
9 | |||
10 | public class TestTreeList implements ComponentListener{ |
||
11 | private int w = 200, h = 380; |
||
12 | private JFrame frame = new JFrame(); |
||
13 | private TreeListContainer tlist;
|
||
14 | |||
15 | public TestTreeList() throws NotInitializeException{ |
||
16 | tlist = new TreeListContainer();
|
||
17 | |||
18 | tlist.addClass("uno", 0); |
||
19 | tlist.addClass("dos", 1); |
||
20 | tlist.addClass("tres", 2); |
||
21 | tlist.addClass("cuatro", 3); |
||
22 | tlist.addEntry("uno-uno","uno",""); |
||
23 | tlist.addEntry("uno-dos","uno",""); |
||
24 | tlist.addEntry("uno-tres","uno",""); |
||
25 | tlist.addEntry("tres-uno","tres",""); |
||
26 | tlist.addEntry("tres-dos","tres",""); |
||
27 | tlist.addEntry("cuatro-uno","cuatro",""); |
||
28 | tlist.addEntry("cuatro-dos","cuatro",""); |
||
29 | tlist.addEntry("cuatro-tres","cuatro",""); |
||
30 | tlist.addEntry("cuatro-cuatro","cuatro",""); |
||
31 | tlist.addEntry("cuatro-cinco","cuatro",""); |
||
32 | tlist.addEntry("cuatro-seis","cuatro",""); |
||
33 | |||
34 | tlist.getTree().expandRow(0);
|
||
35 | |||
36 | frame.getContentPane().add(tlist); |
||
37 | frame.setSize(w, h); |
||
38 | frame.addComponentListener(this);
|
||
39 | frame.setVisible(true);
|
||
40 | } |
||
41 | |||
42 | public static void main(String[] args) { |
||
43 | try{
|
||
44 | TestTreeList tl = new TestTreeList();
|
||
45 | }catch(NotInitializeException ex){
|
||
46 | System.out.println("Tabla no inicializado"); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | public void componentHidden(ComponentEvent e) { |
||
51 | // TODO Auto-generated method stub
|
||
52 | |||
53 | } |
||
54 | |||
55 | public void componentMoved(ComponentEvent e) { |
||
56 | // TODO Auto-generated method stub
|
||
57 | |||
58 | } |
||
59 | |||
60 | public void componentResized(ComponentEvent e) { |
||
61 | tlist.setComponentSize(frame.getWidth() - 10, frame.getHeight() - 20); |
||
62 | } |
||
63 | |||
64 | public void componentShown(ComponentEvent e) { |
||
65 | // TODO Auto-generated method stub
|
||
66 | |||
67 | } |
||
68 | |||
69 | } |