svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / table / TestTableButtonModelTable.java @ 40561
History | View | Annotate | Download (2.51 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
package org.gvsig.gui.beans.table; |
25 |
|
26 |
import java.awt.Color; |
27 |
import java.awt.event.ActionEvent; |
28 |
import java.awt.event.ActionListener; |
29 |
|
30 |
import org.gvsig.gui.beans.TestUI; |
31 |
import org.gvsig.gui.beans.table.exceptions.NotInitializeException; |
32 |
|
33 |
public class TestTableButtonModelTable implements ActionListener { |
34 |
private int w = 460; |
35 |
private int h = 200; |
36 |
private TestUI frame = new TestUI("TestTableButtonModelTable"); |
37 |
private TableContainer table = null; |
38 |
|
39 |
public TestTableButtonModelTable() throws NotInitializeException { |
40 |
String[] columnNames = { "Bot?n", "columna2", "columna3", "columna 4", "col5" }; |
41 |
int[] columnWidths = { 54, 114, 94, 114, 60 }; |
42 |
table = new TableContainer(columnNames, columnWidths);
|
43 |
table.setModel("TableButtonModel");
|
44 |
table.initialize(); |
45 |
|
46 |
Object[] row = { Color.GREEN, "texto 0", "texto 0", "texto 0", "125" }; |
47 |
Object[] row1 = { Color.BLUE, "texto 1", "texto 1", "texto 1", "255" }; |
48 |
Object[] row2 = { Color.RED, "texto 2", "texto 2", "texto 2", "80" }; |
49 |
table.addRow(row); |
50 |
|
51 |
/*JButton b7 = new JButton();
|
52 |
b7.setBackground(Color.RED);
|
53 |
b7.addActionListener(this);
|
54 |
((TableButtonModel)table.getModel()).setValueAt(b7, 0, 0);*/
|
55 |
table.addRow(row1); |
56 |
table.addRow(row2); |
57 |
|
58 |
frame.getContentPane().add(table); |
59 |
frame.setSize(w, h); |
60 |
frame.setVisible(true);
|
61 |
} |
62 |
|
63 |
public static void main(String[] args) { |
64 |
try {
|
65 |
new TestTableButtonModelTable();
|
66 |
} catch(NotInitializeException ex){
|
67 |
System.out.println("Tabla no inicializada"); |
68 |
} |
69 |
} |
70 |
|
71 |
public void actionPerformed(ActionEvent e) { |
72 |
System.out.println("Evento de bot?n!!"); |
73 |
} |
74 |
} |