01: /*
02: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
03: * for visualizing and manipulating spatial features with geometry and attributes.
04: *
05: * Copyright (C) 2003 Vivid Solutions
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * 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.vividsolutions.jump.workbench.ui;
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: public class TransparencyPanel extends JPanel {
44: JPanel opaquePanel = new JPanel();
45: JPanel transparentPanel = new JPanel();
46: GridBagLayout gridBagLayout3 = new GridBagLayout();
47: JSlider transparencySlider = new JSlider();
48:
49: public TransparencyPanel() {
50: transparencySlider.setMaximum(255);
51: transparencySlider.setPreferredSize(new Dimension(100, 24));
52: setLayout(gridBagLayout3);
53: add(opaquePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
54: GridBagConstraints.CENTER, GridBagConstraints.NONE,
55: new Insets(0, 0, 0, 0), 0, 0));
56: add(transparencySlider, new GridBagConstraints(2, 0, 1, 1, 0.0,
57: 0.0, GridBagConstraints.CENTER,
58: GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
59: add(transparentPanel, new GridBagConstraints(3, 0, 1, 1, 0.0,
60: 0.0, GridBagConstraints.CENTER,
61: GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
62: opaquePanel.setBackground(Color.black);
63: opaquePanel.setMinimumSize(new Dimension(11, 11));
64: opaquePanel.setMaximumSize(new Dimension(11, 11));
65: opaquePanel.setPreferredSize(new Dimension(11, 11));
66: transparentPanel.setBackground(Color.white);
67: transparentPanel.setForeground(Color.white);
68: transparentPanel.setMaximumSize(new Dimension(11, 11));
69: transparentPanel.setMinimumSize(new Dimension(11, 11));
70: transparentPanel.setPreferredSize(new Dimension(11, 11));
71: }
72:
73: public void setColor(Color color) {
74: opaquePanel.setBackground(color);
75: }
76:
77: public JSlider getSlider() {
78: return transparencySlider;
79: }
80: }
|