root / trunk / libraries / libUIComponent / src-test-ui / controls / dnd / JDnDTableTest.java @ 13199
History | View | Annotate | Download (2.93 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 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 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: JDnDTableTest.java 13199 2007-08-21 09:58:04Z bsanchez $
|
45 |
* $Log$
|
46 |
* Revision 1.2 2007-08-21 09:58:04 bsanchez
|
47 |
* - Quitados imports innecesarios
|
48 |
* - Quitado codigo no usado
|
49 |
* - Cambio de deprecated show por setVisible(true)
|
50 |
*
|
51 |
* Revision 1.1 2007/08/20 08:34:46 evercher
|
52 |
* He fusionado LibUI con LibUIComponents
|
53 |
*
|
54 |
* Revision 1.1 2006/09/27 13:34:57 jaume
|
55 |
* *** empty log message ***
|
56 |
*
|
57 |
*
|
58 |
*/
|
59 |
package controls.dnd; |
60 |
|
61 |
import java.awt.Dimension; |
62 |
|
63 |
import javax.swing.JFrame; |
64 |
import javax.swing.JPanel; |
65 |
import javax.swing.WindowConstants; |
66 |
|
67 |
import org.gvsig.gui.beans.controls.dnd.JDnDList; |
68 |
import org.gvsig.gui.beans.controls.dnd.JDnDListModel; |
69 |
import org.gvsig.gui.beans.controls.dnd.JDnDTable; |
70 |
import org.gvsig.gui.beans.controls.dnd.JDnDTableModel; |
71 |
|
72 |
/**
|
73 |
* El model que ha de suportar les funcions d'una JDnDTable.
|
74 |
* Encara est? en proves.
|
75 |
* @author jaume
|
76 |
*
|
77 |
*/
|
78 |
public class JDnDTableTest { |
79 |
static String[] colNames = new String[] {"1234", "abcd", "qwerty"}; |
80 |
static String[][] values = new String[][] {new String[] {"a1", "a2", "a3"}, |
81 |
new String[] {"b1", "b2", "b3"}, |
82 |
new String[] {"c1", "c2", "c3"}}; |
83 |
|
84 |
public static void main(String args[]) { |
85 |
JFrame f = new JFrame(); |
86 |
JPanel content = new JPanel(); |
87 |
content.setPreferredSize(new Dimension(500,400)); |
88 |
|
89 |
JDnDTableModel model = new JDnDTableModel(values, colNames);
|
90 |
JDnDListModel listModel = new JDnDListModel();
|
91 |
listModel.addElement("a");
|
92 |
listModel.addElement("b");
|
93 |
listModel.addElement("c");
|
94 |
|
95 |
JDnDTable tbl = new JDnDTable();
|
96 |
|
97 |
tbl.setModel(model); |
98 |
tbl.setSize(new Dimension(450, 350)); |
99 |
JDnDList list = new JDnDList();
|
100 |
list.setModel(listModel); |
101 |
content.add(tbl); |
102 |
content.add(list); |
103 |
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
104 |
f.setContentPane(content); |
105 |
f.pack(); |
106 |
f.setVisible(true);
|
107 |
} |
108 |
} |