Statistics
| Revision:

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

History | View | Annotate | Download (2.46 KB)

1
/* 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
public class TestTableButtonModelTable implements ActionListener {
30
        private int            w     = 460;
31
        private int            h     = 200;
32
        private JFrame         frame = new JFrame();
33
        private TableContainer table = null;
34

    
35
        public TestTableButtonModelTable() throws NotInitializeException {
36
                String[] columnNames = { "Bot?n", "columna2", "columna3", "columna 4", "col5" };
37
                int[] columnWidths = { 54, 114, 94, 114, 60 };
38
                table = new TableContainer(columnNames, columnWidths);
39
                table.setModel("TableButtonModel");
40
                table.initialize();
41

    
42
                Object[] row = { Color.GREEN, "texto 0", "texto 0", "texto 0", "125" };
43
                Object[] row1 = { Color.BLUE, "texto 1", "texto 1", "texto 1", "255" };
44
                Object[] row2 = { Color.RED, "texto 2", "texto 2", "texto 2", "80" };
45
                table.addRow(row);
46

    
47
                /*JButton b7 = new JButton();
48
                b7.setBackground(Color.RED);
49
                b7.addActionListener(this);
50
                ((TableButtonModel)table.getModel()).setValueAt(b7, 0, 0);*/
51
                table.addRow(row1);
52
                table.addRow(row2);
53

    
54
                frame.getContentPane().add(table);
55
                frame.setSize(w, h);
56
                frame.setVisible(true);
57
                frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
58
        }
59

    
60
        public static void main(String[] args) {
61
                try {
62
                        new TestTableButtonModelTable();
63
                } catch(NotInitializeException ex){
64
                        System.out.println("Tabla no inicializada");
65
                }
66
        }
67

    
68
        public void actionPerformed(ActionEvent e) {
69
                System.out.println("Evento de bot?n!!");
70
        }
71
}