Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1002 / applications / appgvSIG / src / com / iver / cit / gvsig / gui / panels / TransparencyPanel.java @ 12070

History | View | Annotate | Download (4.28 KB)

1
/*
2
 * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
3
 * for visualizing and manipulating spatial features with geometry and attributes.
4
 *
5
 * Copyright (C) 2003 Vivid Solutions
6
 *
7
 * This program is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU General Public License
9
 * as published by the Free Software Foundation; either version 2
10
 * of the License, or (at your option) any later version.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with this program; if not, write to the Free Software
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 *
21
 * For more information, contact:
22
 *
23
 * Vivid Solutions
24
 * Suite #1A
25
 * 2328 Government Street
26
 * Victoria BC  V8T 5G5
27
 * Canada
28
 *
29
 * (250)385-6040
30
 * www.vividsolutions.com
31
 */
32
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
33
 *
34
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
35
 *
36
 * This program is free software; you can redistribute it and/or
37
 * modify it under the terms of the GNU General Public License
38
 * as published by the Free Software Foundation; either version 2
39
 * of the License, or (at your option) any later version.
40
 *
41
 * This program is distributed in the hope that it will be useful,
42
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
44
 * GNU General Public License for more details.
45
 *
46
 * You should have received a copy of the GNU General Public License
47
 * along with this program; if not, write to the Free Software
48
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
49
 *
50
 * For more information, contact:
51
 *
52
 *  Generalitat Valenciana
53
 *   Conselleria d'Infraestructures i Transport
54
 *   Av. Blasco Ib??ez, 50
55
 *   46010 VALENCIA
56
 *   SPAIN
57
 *
58
 *      +34 963862235
59
 *   gvsig@gva.es
60
 *      www.gvsig.gva.es
61
 *
62
 *    or
63
 *
64
 *   IVER T.I. S.A
65
 *   Salamanca 50
66
 *   46005 Valencia
67
 *   Spain
68
 *
69
 *   +34 963163400
70
 *   dac@iver.es
71
 */
72
package com.iver.cit.gvsig.gui.panels;
73

    
74
import java.awt.Color;
75
import java.awt.Dimension;
76
import java.awt.GridBagConstraints;
77
import java.awt.GridBagLayout;
78
import java.awt.Insets;
79

    
80
import javax.swing.JPanel;
81
import javax.swing.JSlider;
82

    
83

    
84
public class TransparencyPanel extends JPanel {
85
    JPanel opaquePanel = new JPanel();
86
    JPanel transparentPanel = new JPanel();
87
    GridBagLayout gridBagLayout3 = new GridBagLayout();
88
    JSlider transparencySlider = new JSlider();
89

    
90
    public TransparencyPanel() {
91
            transparencySlider.setSize(100,30);
92
            transparencySlider.setPreferredSize(new Dimension(100,30));
93
        transparencySlider.setMaximum(255);
94
        transparencySlider.setPreferredSize(new Dimension(100, 24));
95
        setLayout(gridBagLayout3);
96
        add(opaquePanel,
97
            new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
98
                GridBagConstraints.CENTER, GridBagConstraints.NONE,
99
                new Insets(0, 0, 0, 0), 0, 0));
100
        add(transparencySlider,
101
            new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
102
                GridBagConstraints.CENTER, GridBagConstraints.NONE,
103
                new Insets(0, 0, 0, 0), 0, 0));
104
        add(transparentPanel,
105
            new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0,
106
                GridBagConstraints.CENTER, GridBagConstraints.NONE,
107
                new Insets(0, 0, 0, 0), 0, 0));
108
        opaquePanel.setBackground(Color.black);
109
        opaquePanel.setMinimumSize(new Dimension(11, 11));
110
        opaquePanel.setMaximumSize(new Dimension(11, 11));
111
        opaquePanel.setPreferredSize(new Dimension(11, 11));
112
        transparentPanel.setBackground(Color.white);
113
        transparentPanel.setForeground(Color.white);
114
        transparentPanel.setMaximumSize(new Dimension(11, 11));
115
        transparentPanel.setMinimumSize(new Dimension(11, 11));
116
        transparentPanel.setPreferredSize(new Dimension(11, 11));
117
    }
118

    
119
    public void setColor(Color color) {
120
        opaquePanel.setBackground(color);
121
    }
122

    
123
    public JSlider getSlider() {
124
        return transparencySlider;
125
    }
126
}