001: package net.sourceforge.squirrel_sql.client.gui;
002:
003: /*
004: * Copyright (C) 2001-2004 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: import java.awt.event.KeyEvent;
022:
023: import javax.swing.JInternalFrame;
024:
025: /**
026: * Base functionality for Squirrels internal frames.
027: *
028: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
029: */
030: public class BaseInternalFrame extends JInternalFrame {
031: /**
032: * Creates a non-resizable, non-closable, non-maximizable,
033: * non-iconifiable JInternalFrame with no title.
034: */
035: public BaseInternalFrame() {
036: super ();
037: }
038:
039: /**
040: * Creates a non-resizable, non-closable, non-maximizable,
041: * non-iconifiable JInternalFrame with the specified title.
042: *
043: * @param title Title for internal frame.
044: */
045: public BaseInternalFrame(String title) {
046: super (title);
047: }
048:
049: /**
050: * Creates a non-closable, non-maximizable, non-iconifiable
051: * JInternalFrame with the specified title and with
052: * resizability specified.
053: *
054: * @param title Title for internal frame.
055: * @param resizable <TT>true</TT> if frame can be resized.
056: */
057: public BaseInternalFrame(String title, boolean resizable) {
058: super (title, resizable);
059: }
060:
061: /**
062: * Creates a non-maximizable, non-iconifiable JInternalFrame
063: * with the specified title and with resizability and closability
064: * specified.
065: *
066: * @param title Title for internal frame.
067: * @param resizable <TT>true</TT> if frame can be resized.
068: * @param closeable <TT>true</TT> if frame can be closed.
069: */
070: public BaseInternalFrame(String title, boolean resizable,
071: boolean closable) {
072: super (title, resizable, closable);
073: }
074:
075: /**
076: * Creates a non-iconifiable JInternalFrame with the specified title
077: * and with resizability, closability, and maximizability specified.
078: *
079: * @param title Title for internal frame.
080: * @param resizable <TT>true</TT> if frame can be resized.
081: * @param closeable <TT>true</TT> if frame can be closed.
082: * @param maximizable <TT>true</TT> if frame can be maximized.
083: */
084: public BaseInternalFrame(String title, boolean resizable,
085: boolean closable, boolean maximizable) {
086: super (title, resizable, closable, maximizable);
087: }
088:
089: /**
090: * Creates a JInternalFrame with the specified title and with
091: * resizability, closability, maximizability and
092: * iconifability specified.
093: *
094: * @param title Title for internal frame.
095: * @param resizable <TT>true</TT> if frame can be resized.
096: * @param closeable <TT>true</TT> if frame can be closed.
097: * @param maximizable <TT>true</TT> if frame can be maximized.
098: * @param iconifiable <TT>true</TT> if frame can be iconified.
099: */
100: public BaseInternalFrame(String title, boolean resizable,
101: boolean closable, boolean maximizable, boolean iconifiable) {
102: super (title, resizable, closable, maximizable, iconifiable);
103: }
104:
105: /**
106: *
107: * Modifed version of code from Slavas View class in jEdit.
108: */
109: public void processKeyEvent(KeyEvent evt) {
110: // Superclass method is protected.
111: super .processKeyEvent(evt);
112: /*
113: * if (isClosed())
114: return;
115:
116: // JTextComponents don't consume events...
117: if (getFocusOwner() instanceof JTextComponent) {
118: // fix for the bug where key events in JTextComponents
119: // inside views are also handled by the input handler
120: if (evt.getID() == KeyEvent.KEY_PRESSED) {
121: switch (evt.getKeyCode()) {
122: case KeyEvent.VK_BACK_SPACE :
123: case KeyEvent.VK_TAB :
124: case KeyEvent.VK_ENTER :
125: return;
126: }
127: }
128:
129: Keymap keymap = ((JTextComponent) getFocusOwner()).getKeymap();
130: if (keymap.getAction(KeyStroke.getKeyStrokeForEvent(evt)) != null)
131: return;
132: }
133:
134: if (evt.isConsumed())
135: return;
136:
137: if (!evt.isConsumed())
138: super.processKeyEvent(evt);
139: */
140: }
141:
142: }
|