Statistics
| Revision:

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

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

    
26
import java.awt.BorderLayout;
27

    
28
import org.gvsig.gui.beans.TestUI;
29
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
30
import org.gvsig.gui.beans.defaultbuttonspanel.DefaultButtonsPanel;
31
import org.gvsig.gui.beans.table.exceptions.NotInitializeException;
32
/**
33
 * Test para comprobar el funcionamiento de la grafica
34
 * 
35
 * @version 06/06/2008
36
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
37
 */
38
public class TestGraphic implements GraphicListener {
39
        private TestUI              frame               = new TestUI("TestGraphic");
40
        private DefaultButtonsPanel defaultButtonsPanel = null;
41
        private GraphicContainer    graphic             = null;
42

    
43
        public TestGraphic() throws NotInitializeException{
44
                graphic = new GraphicContainer(true);
45

    
46
                int nSeries = 3;
47

    
48
                String[] names = new String[nSeries];
49
                int[][] series = new int[nSeries][256];
50

    
51
                for(int iSerie = 0; iSerie < nSeries; iSerie++){
52
                        names[iSerie] = "Band " + iSerie;
53
                        for (int i = 0; i < 256; i++)
54
                                series[iSerie][i] = i * (iSerie + 1);
55
                }
56
                
57
                graphic.getPGraphic().setViewType(0);
58
                
59
                graphic.getPGraphic().setNewChart(series, names);
60

    
61
                graphic.addValueChangedListener(this);
62
                defaultButtonsPanel = new DefaultButtonsPanel(ButtonsPanel.BUTTONS_CLOSE);
63
                defaultButtonsPanel.setLayout(new BorderLayout(5, 5));
64
                defaultButtonsPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
65
                defaultButtonsPanel.add(graphic, BorderLayout.CENTER);
66
                frame.getContentPane().add(defaultButtonsPanel);
67
                frame.setSize(640, 480);
68
                frame.setVisible(true);
69
        }
70

    
71
        public static void main(String[] args) {
72
                try {
73
                        new TestGraphic();
74
                } catch (NotInitializeException ex){
75
                        System.out.println("Tabla no inicializada");
76
                }
77
        }
78

    
79
        public void actionValueChanged(GraphicEvent e) {
80
                System.out.println(graphic.getX1() + ":" + graphic.getX2());
81
        }
82
}