01: /*
02: * GlassDock.java
03: *
04: * Created on January 6, 2007, 10:21 AM
05: *
06: * Copyright 2006-2007 Nigel Hughes
07: *
08: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
09: * in compliance with the License. You may obtain a copy of the License at http://www.apache.org/
10: * licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
13: * governing permissions and limitations under the License.
14: */
15: package com.blogofbug.swing.components;
16:
17: import java.awt.AWTEvent;
18: import java.awt.Color;
19: import java.awt.Component;
20: import java.awt.Container;
21: import java.awt.Cursor;
22: import java.awt.Graphics;
23: import java.awt.GridBagLayout;
24: import java.awt.Point;
25: import java.awt.Rectangle;
26: import java.awt.Toolkit;
27: import java.awt.event.AWTEventListener;
28: import java.awt.event.ComponentEvent;
29: import java.awt.event.ComponentListener;
30: import java.awt.event.MouseEvent;
31: import javax.swing.ImageIcon;
32: import javax.swing.JFrame;
33: import javax.swing.SwingUtilities;
34:
35: /**
36: * A dock that is designed to go into a Frame's layered pane so that elements like combobox menus can appear over the top
37: * @author nigel
38: */
39: public class LayeredDockPanel extends DockPanel implements
40: ComponentListener {
41: /**
42: * The layer (in the layered panel) that the dock should be drawn into
43: */
44: public static final Integer DOCK_LAYER = new Integer(250);
45: /**
46: * The frame the dock is in
47: */
48: private JFrame frame = null;
49:
50: /**
51: * Creates a new instance of GlassDock
52: * @param frame The frame the dock will be drawn into
53: */
54: public LayeredDockPanel(JFrame frame) {
55: super (48, 96);
56: this .frame = frame;
57: frame.addComponentListener(this );
58: }
59:
60: /**
61: * Called when the containing frame has been resized so the dock can resize
62: * @param componentEvent The event
63: */
64: public void componentResized(ComponentEvent componentEvent) {
65: GridBagLayout gbl = new GridBagLayout();
66: // setSize(frame.getContentPane().getSize());
67: setSize(getParent().getParent().getSize());
68: getParent().setSize(getParent().getParent().getSize());
69: setLocation(0, 0);
70: validate();
71: }
72:
73: /**
74: * Ignored
75: * @param componentEvent The event
76: */
77: public void componentMoved(ComponentEvent componentEvent) {
78: }
79:
80: /**
81: * Ignored
82: * @param componentEvent The event
83: */
84: public void componentShown(ComponentEvent componentEvent) {
85: }
86:
87: /**
88: * Ignored
89: * @param componentEvent The event
90: */
91: public void componentHidden(ComponentEvent componentEvent) {
92: }
93:
94: }
|