Statistics
| Revision:

root / trunk / libraries / libUIComponent / src-test-ui / org / gvsig / gui / beans / table / TestTableColorTable.java @ 12898

History | View | Annotate | Download (2.45 KB)

1 12368 bsanchez
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.gui.beans.table;
20
21
import java.awt.Color;
22
import java.awt.event.ActionEvent;
23
import java.awt.event.ActionListener;
24
25
import javax.swing.JFrame;
26
27
import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
28
/**
29
 * Test del TableContainer
30
 *
31
 * @version 27/05/2007
32
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
33
 */
34
public class TestTableColorTable implements ActionListener {
35
        private int            w     = 460;
36
        private int            h     = 200;
37
        private JFrame         frame = new JFrame();
38
        private TableContainer table = null;
39
40
        public TestTableColorTable() throws NotInitializeException {
41
                String[] columnNames = { "selec", "clase", "RGB", "Valor", "Max", "Alpha" };
42 12553 bsanchez
                int[] columnWidths = { 54, 1104, 94, 114, 114, 60 };
43 12368 bsanchez
                table = new TableContainer(columnNames, columnWidths);
44
                table.setModel("TableColorModel");
45
                table.initialize();
46
47 12554 nacho
                Object[] row = { Color.GREEN, "", "0,255,0", new Double(2), new Double(2), "255" };
48
                Object[] row1 = { Color.BLUE, "", "0,0,255", new Double(1), new Double(2), "255" };
49
                Object[] row2 = { Color.RED , "", "255,0,0", new Double(0), new Double(1), "255" };
50 12368 bsanchez
                table.addRow(row);
51
52
                table.addRow(row1);
53
                table.addRow(row2);
54
55
                frame.getContentPane().add(table);
56
                frame.setSize(w, h);
57
                frame.setVisible(true);
58
                frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
59
        }
60
61
        public static void main(String[] args) {
62
                try {
63
                        new TestTableColorTable();
64
                } catch(NotInitializeException ex){
65
                        System.out.println("Tabla no inicializada");
66
                }
67
        }
68
69
        public void actionPerformed(ActionEvent e) {
70
                System.out.println("Evento de bot?n!!");
71
        }
72
}