Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / gui / Panels / TransparencyPanel.java @ 312

History | View | Annotate | Download (2.99 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
package com.iver.cit.gvsig.gui.Panels;
33

    
34
import java.awt.Color;
35
import java.awt.Dimension;
36
import java.awt.GridBagConstraints;
37
import java.awt.GridBagLayout;
38
import java.awt.Insets;
39

    
40
import javax.swing.JPanel;
41
import javax.swing.JSlider;
42

    
43

    
44
public class TransparencyPanel extends JPanel {
45
    JPanel opaquePanel = new JPanel();
46
    JPanel transparentPanel = new JPanel();
47
    GridBagLayout gridBagLayout3 = new GridBagLayout();
48
    JSlider transparencySlider = new JSlider();
49

    
50
    public TransparencyPanel() {
51
        transparencySlider.setMaximum(255);
52
        transparencySlider.setPreferredSize(new Dimension(100, 24));
53
        setLayout(gridBagLayout3);
54
        add(opaquePanel,
55
            new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
56
                GridBagConstraints.CENTER, GridBagConstraints.NONE,
57
                new Insets(0, 0, 0, 0), 0, 0));
58
        add(transparencySlider,
59
            new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
60
                GridBagConstraints.CENTER, GridBagConstraints.NONE,
61
                new Insets(0, 0, 0, 0), 0, 0));
62
        add(transparentPanel,
63
            new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0,
64
                GridBagConstraints.CENTER, GridBagConstraints.NONE,
65
                new Insets(0, 0, 0, 0), 0, 0));
66
        opaquePanel.setBackground(Color.black);
67
        opaquePanel.setMinimumSize(new Dimension(11, 11));
68
        opaquePanel.setMaximumSize(new Dimension(11, 11));
69
        opaquePanel.setPreferredSize(new Dimension(11, 11));
70
        transparentPanel.setBackground(Color.white);
71
        transparentPanel.setForeground(Color.white);
72
        transparentPanel.setMaximumSize(new Dimension(11, 11));
73
        transparentPanel.setMinimumSize(new Dimension(11, 11));
74
        transparentPanel.setPreferredSize(new Dimension(11, 11));
75
    }
76

    
77
    public void setColor(Color color) {
78
        opaquePanel.setBackground(color);
79
    }
80

    
81
    public JSlider getSlider() {
82
        return transparencySlider;
83
    }
84
}