Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / comboscale / TestComboScale.java @ 40561

History | View | Annotate | Download (2.25 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.comboscale;
25

    
26
import java.awt.BorderLayout;
27
import java.awt.Dimension;
28
import java.awt.event.ActionListener;
29

    
30
import javax.swing.JButton;
31
import javax.swing.JPanel;
32

    
33
import org.gvsig.gui.beans.TestUI;
34
import org.gvsig.gui.beans.controls.comboscale.ComboScale;
35

    
36
public class TestComboScale {
37
        private ComboScale cs;
38

    
39
        public TestComboScale() {
40
                TestUI frame = new TestUI("TestComboScale");
41
                cs = new ComboScale();
42
                long[] scale = new long[5];
43
                scale[0] = 100;
44
                scale[1] = 500;
45
                scale[2] = 1000;
46
                scale[3] = 5000;
47
                scale[4] = 10000;
48
                cs.setItems(scale);
49
                cs.setScale(400);
50
                JButton btn = new JButton("Reset");
51
                btn.setPreferredSize(new Dimension(100, 50));
52
                btn.addActionListener(new ActionListener() {
53
                        public void actionPerformed(java.awt.event.ActionEvent e) {
54
                                cs.setScale(500);
55
                        }
56
                });
57

    
58
                JPanel panel = new JPanel();
59
                frame.setContentPane(panel);
60
                panel.setLayout(new BorderLayout());
61
                panel.add(cs, BorderLayout.CENTER);
62
                panel.add(btn, BorderLayout.EAST);
63

    
64
                frame.setSize(280, 80);
65
                frame.setVisible(true);
66

    
67
                cs.addActionListener(new java.awt.event.ActionListener() {
68
                        public void actionPerformed(java.awt.event.ActionEvent e) {
69
                                System.out.println("ActionListener: " + e.getActionCommand());
70
                        }
71
                });
72
        }
73

    
74
        public static void main(String[] args) {
75
                new TestComboScale();
76
        }
77
}