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 @ 40596
History | View | Annotate | Download (2.95 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 |
|
25 |
package org.gvsig.app.gui.panels; |
26 |
|
27 |
import java.awt.Color; |
28 |
import java.awt.Dimension; |
29 |
import java.awt.GridBagConstraints; |
30 |
import java.awt.GridBagLayout; |
31 |
import java.awt.Insets; |
32 |
|
33 |
import javax.swing.JPanel; |
34 |
import javax.swing.JSlider; |
35 |
|
36 |
|
37 |
public class TransparencyPanel extends JPanel { |
38 |
JPanel opaquePanel = new JPanel(); |
39 |
JPanel transparentPanel = new JPanel(); |
40 |
GridBagLayout gridBagLayout3 = new GridBagLayout(); |
41 |
JSlider transparencySlider = new JSlider(); |
42 |
|
43 |
public TransparencyPanel() {
|
44 |
transparencySlider.setSize(100,30); |
45 |
transparencySlider.setPreferredSize(new Dimension(100,30)); |
46 |
transparencySlider.setMaximum(255);
|
47 |
transparencySlider.setPreferredSize(new Dimension(100, 24)); |
48 |
setLayout(gridBagLayout3); |
49 |
add(opaquePanel, |
50 |
new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, |
51 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
52 |
new Insets(0, 0, 0, 0), 0, 0)); |
53 |
add(transparencySlider, |
54 |
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, |
55 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
56 |
new Insets(0, 0, 0, 0), 0, 0)); |
57 |
add(transparentPanel, |
58 |
new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, |
59 |
GridBagConstraints.CENTER, GridBagConstraints.NONE, |
60 |
new Insets(0, 0, 0, 0), 0, 0)); |
61 |
opaquePanel.setBackground(Color.black);
|
62 |
opaquePanel.setMinimumSize(new Dimension(11, 11)); |
63 |
opaquePanel.setMaximumSize(new Dimension(11, 11)); |
64 |
opaquePanel.setPreferredSize(new Dimension(11, 11)); |
65 |
transparentPanel.setBackground(Color.white);
|
66 |
transparentPanel.setForeground(Color.white);
|
67 |
transparentPanel.setMaximumSize(new Dimension(11, 11)); |
68 |
transparentPanel.setMinimumSize(new Dimension(11, 11)); |
69 |
transparentPanel.setPreferredSize(new Dimension(11, 11)); |
70 |
} |
71 |
|
72 |
public void setColor(Color color) { |
73 |
opaquePanel.setBackground(color); |
74 |
} |
75 |
|
76 |
public JSlider getSlider() { |
77 |
return transparencySlider;
|
78 |
} |
79 |
} |