svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.app / org.gvsig.app.mainplugin / src / main / java / org / gvsig / app / gui / panels / TransparencyPanel.java @ 40558
History | View | Annotate | Download (4.14 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 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
25 |
*
|
26 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
27 |
*
|
28 |
* This program is free software; you can redistribute it and/or
|
29 |
* modify it under the terms of the GNU General Public License
|
30 |
* as published by the Free Software Foundation; either version 2
|
31 |
* of the License, or (at your option) any later version.
|
32 |
*
|
33 |
* This program is distributed in the hope that it will be useful,
|
34 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
35 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
36 |
* GNU General Public License for more details.
|
37 |
*
|
38 |
* You should have received a copy of the GNU General Public License
|
39 |
* along with this program; if not, write to the Free Software
|
40 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
41 |
*
|
42 |
* For more information, contact:
|
43 |
*
|
44 |
* Generalitat Valenciana
|
45 |
* Conselleria d'Infraestructures i Transport
|
46 |
* Av. Blasco Ib??ez, 50
|
47 |
* 46010 VALENCIA
|
48 |
* SPAIN
|
49 |
*
|
50 |
* +34 963862235
|
51 |
* gvsig@gva.es
|
52 |
* www.gvsig.gva.es
|
53 |
*
|
54 |
* or
|
55 |
*
|
56 |
* IVER T.I. S.A
|
57 |
* Salamanca 50
|
58 |
* 46005 Valencia
|
59 |
* Spain
|
60 |
*
|
61 |
* +34 963163400
|
62 |
* dac@iver.es
|
63 |
*/
|
64 |
package org.gvsig.app.gui.panels; |
65 |
|
66 |
import java.awt.Color; |
67 |
import java.awt.Dimension; |
68 |
import java.awt.GridBagConstraints; |
69 |
import java.awt.GridBagLayout; |
70 |
import java.awt.Insets; |
71 |
|
72 |
import javax.swing.JPanel; |
73 |
import javax.swing.JSlider; |
74 |
|
75 |
|
76 |
public class TransparencyPanel extends JPanel { |
77 |
JPanel opaquePanel = new JPanel(); |
78 |
JPanel transparentPanel = new JPanel(); |
79 |
GridBagLayout gridBagLayout3 = new GridBagLayout(); |
80 |
JSlider transparencySlider = new JSlider(); |
81 |
|
82 |
public TransparencyPanel() {
|
83 |
transparencySlider.setSize(100,30); |
84 |
transparencySlider.setPreferredSize(new Dimension(100,30)); |
85 |
transparencySlider.setMaximum(255);
|
86 |
transparencySlider.setPreferredSize(new Dimension(100, 24)); |
87 |
setLayout(gridBagLayout3); |
88 |
add(opaquePanel, |
89 |
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, |
90 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
91 |
new Insets(0, 0, 0, 0), 0, 0)); |
92 |
add(transparencySlider, |
93 |
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, |
94 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
95 |
new Insets(0, 0, 0, 0), 0, 0)); |
96 |
add(transparentPanel, |
97 |
new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, |
98 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
99 |
new Insets(0, 0, 0, 0), 0, 0)); |
100 |
opaquePanel.setBackground(Color.black);
|
101 |
opaquePanel.setMinimumSize(new Dimension(11, 11)); |
102 |
opaquePanel.setMaximumSize(new Dimension(11, 11)); |
103 |
opaquePanel.setPreferredSize(new Dimension(11, 11)); |
104 |
transparentPanel.setBackground(Color.white);
|
105 |
transparentPanel.setForeground(Color.white);
|
106 |
transparentPanel.setMaximumSize(new Dimension(11, 11)); |
107 |
transparentPanel.setMinimumSize(new Dimension(11, 11)); |
108 |
transparentPanel.setPreferredSize(new Dimension(11, 11)); |
109 |
} |
110 |
|
111 |
public void setColor(Color color) { |
112 |
opaquePanel.setBackground(color); |
113 |
} |
114 |
|
115 |
public JSlider getSlider() { |
116 |
return transparencySlider;
|
117 |
} |
118 |
} |