svn-gvsig-desktop / tags / PilotoRaster_Build_5 / libraries / libUIComponent_praster / src-test / org / gvsig / gui / beans / table / TestTable.java @ 11401
History | View | Annotate | Download (1.98 KB)
1 |
package org.gvsig.gui.beans.table; |
---|---|
2 |
|
3 |
import java.awt.event.ComponentEvent; |
4 |
import java.awt.event.ComponentListener; |
5 |
|
6 |
import javax.swing.JFrame; |
7 |
import javax.swing.UIManager; |
8 |
|
9 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
10 |
|
11 |
public class TestTable extends JFrame implements ComponentListener{ |
12 |
private int w = 400, h = 200; |
13 |
|
14 |
private TableContainer table = null; |
15 |
|
16 |
public TestTable() throws NotInitializeException{ |
17 |
String[] columnNames = {"columna 1", "columna 2", "columna 3", "columna 4"}; |
18 |
int[] columnWidths = {70, 90, 110, 130}; |
19 |
table = new TableContainer(w - 12, h - 45, columnNames, columnWidths); |
20 |
table.initialize(); |
21 |
table.setControlVisible(true);
|
22 |
table.setEditable(true);
|
23 |
|
24 |
String[] row = {"uno 0", "dos 0", "tres 0", "cuatro 0"}; |
25 |
String[] row1 = {"uno 1", "dos 1", "tres 1", "cuatro 1"}; |
26 |
String[] row2 = {"uno 2", "dos 2", "tres 2", "cuatro 2"}; |
27 |
table.addRow(row); |
28 |
table.addRow(row1); |
29 |
table.addRow(row2); |
30 |
table.delRow(1);
|
31 |
|
32 |
addComponentListener(this);
|
33 |
|
34 |
getContentPane().add(table); |
35 |
setSize(w, h); |
36 |
setVisible(true);
|
37 |
} |
38 |
|
39 |
public static void main(String[] args) { |
40 |
try {
|
41 |
//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
|
42 |
UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); |
43 |
//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
|
44 |
} catch( Exception e ) { |
45 |
System.err.println( "No se puede cambiar al LookAndFeel"); |
46 |
} |
47 |
try{
|
48 |
TestTable tabla = new TestTable();
|
49 |
}catch(NotInitializeException ex){
|
50 |
System.out.println("Tabla no inicializada"); |
51 |
} |
52 |
} |
53 |
|
54 |
public void componentHidden(ComponentEvent e) { |
55 |
// TODO Auto-generated method stub
|
56 |
|
57 |
} |
58 |
|
59 |
public void componentMoved(ComponentEvent e) { |
60 |
// TODO Auto-generated method stub
|
61 |
|
62 |
} |
63 |
|
64 |
public void componentResized(ComponentEvent e) { |
65 |
table.setComponentSize(getWidth() - 12, getHeight() - 45); |
66 |
} |
67 |
|
68 |
public void componentShown(ComponentEvent e) { |
69 |
// TODO Auto-generated method stub
|
70 |
|
71 |
} |
72 |
} |