Frames | No Frames |
1: /* SwingToolkit.java -- A base toolkit for Swing peers 2: Copyright (C) 2006 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 6: GNU Classpath is free software; you can redistribute it and/or modify 7: it under the terms of the GNU General Public License as published by 8: the Free Software Foundation; either version 2, or (at your option) 9: any later version. 10: 11: GNU Classpath is distributed in the hope that it will be useful, but 12: WITHOUT ANY WARRANTY; without even the implied warranty of 13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14: General Public License for more details. 15: 16: You should have received a copy of the GNU General Public License 17: along with GNU Classpath; see the file COPYING. If not, write to the 18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 21: Linking this library statically or dynamically with other modules is 22: making a combined work based on this library. Thus, the terms and 23: conditions of the GNU General Public License cover the whole 24: combination. 25: 26: As a special exception, the copyright holders of this library give you 27: permission to link this library with independent modules to produce an 28: executable, regardless of the license terms of these independent 29: modules, and to copy and distribute the resulting executable under 30: terms of your choice, provided that you also meet, for each linked 31: independent module, the terms and conditions of the license of that 32: module. An independent module is a module which is not derived from 33: or based on this library. If you modify this library, you may extend 34: this exception to your version of the library, but you are not 35: obligated to do so. If you do not wish to do so, delete this 36: exception statement from your version. */ 37: 38: 39: package gnu.java.awt.peer.swing; 40: 41: import java.awt.Button; 42: import java.awt.Canvas; 43: import java.awt.Dialog; 44: import java.awt.Label; 45: import java.awt.Menu; 46: import java.awt.MenuBar; 47: import java.awt.MenuItem; 48: import java.awt.Panel; 49: import java.awt.TextField; 50: import java.awt.peer.ButtonPeer; 51: import java.awt.peer.CanvasPeer; 52: import java.awt.peer.LabelPeer; 53: import java.awt.peer.MenuBarPeer; 54: import java.awt.peer.MenuItemPeer; 55: import java.awt.peer.MenuPeer; 56: import java.awt.peer.PanelPeer; 57: import java.awt.peer.TextFieldPeer; 58: 59: import gnu.java.awt.ClasspathToolkit; 60: 61: /** 62: * A base implementation for {@link java.awt.Toolkit} that provides the 63: * Swing based widgets. Concrete implementations still must provide the 64: * remaining abstract methods. 65: * 66: * @author Roman Kennke (kennke@aicas.com) 67: */ 68: public abstract class SwingToolkit extends ClasspathToolkit 69: { 70: 71: /** 72: * Creates a SwingButtonPeer. 73: * 74: * @param button the AWT button 75: * 76: * @return the Swing button peer 77: */ 78: protected ButtonPeer createButton(Button button) 79: { 80: return new SwingButtonPeer(button); 81: } 82: 83: /** 84: * Creates a SwingCanvasPeer. 85: * 86: * @param canvas the AWT canvas 87: * 88: * @return the Swing canvas peer 89: */ 90: protected CanvasPeer createCanvas(Canvas canvas) 91: { 92: return new SwingCanvasPeer(canvas); 93: } 94: 95: /** 96: * Creates a SwingLabelPeer. 97: * 98: * @param label the AWT label 99: * 100: * @return the Swing label peer 101: */ 102: protected LabelPeer createLabel(Label label) 103: { 104: return new SwingLabelPeer(label); 105: } 106: 107: /** 108: * Creates a SwingMenuPeer. 109: * 110: * @param menu the AWT menu 111: * 112: * @return the Swing menu peer 113: */ 114: protected MenuPeer createMenu(Menu menu) 115: { 116: return new SwingMenuPeer(menu); 117: } 118: 119: /** 120: * Creates a SwingMenuBarPeer. 121: * 122: * @param menuBar the AWT menubar 123: * 124: * @return the Swing menu bar peer 125: */ 126: protected MenuBarPeer createMenuBar(MenuBar menuBar) 127: { 128: return new SwingMenuBarPeer(menuBar); 129: } 130: 131: /** 132: * Creates a SwingMenuItemPeer. 133: * 134: * @param menuItem the AWT menu item 135: * 136: * @return the Swing menu item peer 137: */ 138: protected MenuItemPeer createMenuItem(MenuItem menuItem) 139: { 140: return new SwingMenuItemPeer(menuItem); 141: } 142: 143: /** 144: * Creates a SwingPanelPeer. 145: * 146: * @param panel the AWT panel 147: * 148: * @return the Swing panel peer 149: */ 150: protected PanelPeer createPanel(Panel panel) 151: { 152: return new SwingPanelPeer(panel); 153: } 154: 155: /** 156: * Creates a SwingTextFieldPeer. 157: * 158: * @param textField the AWT text field 159: * 160: * @return the Swing text field peer 161: */ 162: protected TextFieldPeer createTextField(TextField textField) 163: { 164: return new SwingTextFieldPeer(textField); 165: } 166: 167: @Override 168: public boolean isModalExclusionTypeSupported 169: (Dialog.ModalExclusionType modalExclusionType) 170: { 171: return false; 172: } 173: 174: @Override 175: public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) 176: { 177: return false; 178: } 179: 180: 181: }