01: /*
02: * Copyright (C) 2004 NNL Technology AB
03: * Visit www.infonode.net for information about InfoNode(R)
04: * products and how to contact NNL Technology AB.
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * 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., 59 Temple Place - Suite 330, Boston,
19: * MA 02111-1307, USA.
20: */
21:
22: // $Id: HeavyWeightDragRectangle.java,v 1.4 2005/12/04 13:46:04 jesper Exp $
23: package net.infonode.docking.internal;
24:
25: import javax.swing.*;
26: import java.awt.*;
27:
28: /**
29: * @author johan
30: */
31: public class HeavyWeightDragRectangle extends JPanel {
32: private int width = 4;
33:
34: private Canvas northCanvas = new Canvas() {
35: public Dimension getPreferredSize() {
36: return new Dimension(width, width);
37: }
38: };
39: private Canvas southCanvas = new Canvas() {
40: public Dimension getPreferredSize() {
41: return new Dimension(width, width);
42: }
43: };
44: private Canvas eastCanvas = new Canvas() {
45: public Dimension getPreferredSize() {
46: return new Dimension(width, width);
47: }
48: };
49: private Canvas westCanvas = new Canvas() {
50: public Dimension getPreferredSize() {
51: return new Dimension(width, width);
52: }
53: };
54:
55: public HeavyWeightDragRectangle() {
56: super (new BorderLayout());
57: setOpaque(false);
58:
59: add(northCanvas, BorderLayout.NORTH);
60: add(southCanvas, BorderLayout.SOUTH);
61: add(westCanvas, BorderLayout.WEST);
62: add(eastCanvas, BorderLayout.EAST);
63:
64: setColor(Color.BLACK);
65: }
66:
67: public void setBounds(int x, int y, int width, int height) {
68: super .setBounds(x, y, width, height);
69: revalidate();
70: }
71:
72: public void setBorderWidth(int width) {
73: this .width = width;
74:
75: revalidate();
76: }
77:
78: public void setColor(Color c) {
79: northCanvas.setBackground(c);
80: southCanvas.setBackground(c);
81: eastCanvas.setBackground(c);
82: westCanvas.setBackground(c);
83: }
84: }
|