svn-gvsig-desktop / trunk / extensions / extRasterTools-SE / src-test-ui / org / gvsig / raster / beans / canvas / GCanvasTest.java @ 19164
History | View | Annotate | Download (2.25 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 |
package org.gvsig.raster.beans.canvas; |
20 |
|
21 |
import java.awt.Color; |
22 |
import java.awt.Dimension; |
23 |
|
24 |
import javax.swing.JFrame; |
25 |
|
26 |
import org.gvsig.raster.beans.canvas.layers.Border; |
27 |
import org.gvsig.raster.beans.canvas.layers.GraphicHistogram; |
28 |
import org.gvsig.raster.beans.canvas.layers.StraightLine; |
29 |
|
30 |
/**
|
31 |
*
|
32 |
*
|
33 |
* 14-oct-2007
|
34 |
* @author Nacho Brodin (nachobrodin@gmail.com)
|
35 |
*/
|
36 |
public class GCanvasTest { |
37 |
private JFrame jFrame = null; |
38 |
private GCanvas component = null; |
39 |
private DrawableElement line = null; |
40 |
|
41 |
public GCanvasTest() {
|
42 |
initialize(); |
43 |
} |
44 |
|
45 |
private void initialize() { |
46 |
jFrame = new JFrame(); |
47 |
double[] histR = new double[]{0, 0, 3, 4, 5, 8, 7, 18, 45, 36, 21, 36, 12, 23, 23, 40, 17, 10, 5, 1, 0, 0, 0}; |
48 |
GraphicHistogram gHistR = new GraphicHistogram(histR, Color.RED); |
49 |
gHistR.setType(GraphicHistogram.TYPE_FILL); |
50 |
|
51 |
line = new StraightLine(Color.YELLOW); |
52 |
//line = new ExponentialLine(Color.YELLOW);
|
53 |
//line = new LogaritmicLine(Color.YELLOW);
|
54 |
DrawableElement border = new Border(Color.WHITE); |
55 |
|
56 |
component = new GCanvas(Color.BLACK); |
57 |
component.setDrawableElement(border); |
58 |
component.setDrawableElement(gHistR); |
59 |
component.setDrawableElement(line); |
60 |
|
61 |
jFrame.setSize(new Dimension(200, 223)); |
62 |
jFrame.setContentPane(component); |
63 |
|
64 |
jFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
65 |
jFrame.setVisible(true);
|
66 |
} |
67 |
|
68 |
public static void main(String[] args) { |
69 |
new GCanvasTest();
|
70 |
} |
71 |
|
72 |
} |