svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / test / java / org / gvsig / gui / beans / colorslideredition / TestColorSliderEdition.java @ 40561
History | View | Annotate | Download (3.8 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.colorslideredition; |
25 |
|
26 |
import java.awt.Color; |
27 |
import java.awt.Dimension; |
28 |
import java.awt.GridBagConstraints; |
29 |
import java.awt.event.ActionEvent; |
30 |
import java.awt.event.ActionListener; |
31 |
|
32 |
import javax.swing.JCheckBox; |
33 |
import javax.swing.JPanel; |
34 |
import javax.swing.border.EmptyBorder; |
35 |
|
36 |
import org.gvsig.gui.beans.TestUI; |
37 |
/**
|
38 |
*
|
39 |
* @version 02/11/2007
|
40 |
* @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
|
41 |
*/
|
42 |
public class TestColorSliderEdition implements ActionListener { |
43 |
private TestUI jFrame = new TestUI("TestColorSliderEdition"); |
44 |
private ColorSliderEdition colorSliderEdition = null; |
45 |
JCheckBox jCBInterpolated = null; |
46 |
JCheckBox jCBEnabled = null; |
47 |
|
48 |
public TestColorSliderEdition() {
|
49 |
jCBInterpolated = new JCheckBox("Interpolated"); |
50 |
jCBInterpolated.setSelected(true);
|
51 |
jCBInterpolated.addActionListener(this);
|
52 |
jCBEnabled = new JCheckBox("Enabled"); |
53 |
jCBEnabled.addActionListener(this);
|
54 |
jCBEnabled.setSelected(true);
|
55 |
|
56 |
jFrame.setSize(new Dimension(498, 127)); |
57 |
colorSliderEdition = new ColorSliderEdition();
|
58 |
colorSliderEdition.setPreferredSize(new Dimension(0, 44)); |
59 |
colorSliderEdition.setMinimumSize(new Dimension(0, 44)); |
60 |
|
61 |
colorSliderEdition.addItem(new ItemColorSlider(0, Color.black), false); |
62 |
colorSliderEdition.addItem(new ItemColorSlider(25, Color.red), false); |
63 |
colorSliderEdition.addItem(new ItemColorSlider(50, Color.yellow), false); |
64 |
colorSliderEdition.addItem(new ItemColorSlider(75, Color.blue), true); |
65 |
colorSliderEdition.addItem(new ItemColorSlider(100, new Color(255, 255, 255, 0)), true); |
66 |
|
67 |
JPanel jPanel = new JPanel(); |
68 |
jFrame.setContentPane(jPanel); |
69 |
|
70 |
jPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); |
71 |
jPanel.setLayout(new java.awt.GridBagLayout());
|
72 |
|
73 |
GridBagConstraints gridBagConstraints = new GridBagConstraints(); |
74 |
gridBagConstraints.gridx = 0;
|
75 |
gridBagConstraints.gridy = 0;
|
76 |
gridBagConstraints.weightx = 1;
|
77 |
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
|
78 |
gridBagConstraints.insets = new java.awt.Insets(5, 5, 2, 5); |
79 |
jPanel.add(colorSliderEdition, gridBagConstraints); |
80 |
|
81 |
gridBagConstraints = new GridBagConstraints(); |
82 |
gridBagConstraints.gridx = 0;
|
83 |
gridBagConstraints.gridy = 1;
|
84 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 2, 5); |
85 |
jPanel.add(jCBInterpolated, gridBagConstraints); |
86 |
|
87 |
gridBagConstraints = new GridBagConstraints(); |
88 |
gridBagConstraints.gridx = 0;
|
89 |
gridBagConstraints.gridy = 2;
|
90 |
gridBagConstraints.insets = new java.awt.Insets(2, 5, 5, 5); |
91 |
jPanel.add(jCBEnabled, gridBagConstraints); |
92 |
|
93 |
jFrame.setVisible(true);
|
94 |
} |
95 |
|
96 |
public static void main(String[] args) { |
97 |
new TestColorSliderEdition();
|
98 |
} |
99 |
|
100 |
public void actionPerformed(ActionEvent e) { |
101 |
if (e.getSource() == jCBInterpolated) {
|
102 |
colorSliderEdition.setInterpolated(jCBInterpolated.isSelected()); |
103 |
return;
|
104 |
} |
105 |
if (e.getSource() == jCBEnabled) {
|
106 |
colorSliderEdition.setEnabled(jCBEnabled.isSelected()); |
107 |
return;
|
108 |
} |
109 |
} |
110 |
} |