gnu.java.awt.peer.swing

Class SwingFramePeer

Implemented Interfaces:
ComponentPeer, ContainerPeer, FramePeer, WindowPeer

public abstract class SwingFramePeer
extends SwingWindowPeer
implements FramePeer

An abstract base class for FramePeer implementations based on Swing. This class provides the ability to display and handle AWT MenuBars that are based on Swing. As a minimum, a subclass must implement all the remaining abstract methods as well as the following methods:

Field Summary

Fields inherited from class gnu.java.awt.peer.swing.SwingComponentPeer

awtComponent, paintArea, peerFont, swingComponent

Constructor Summary

SwingFramePeer(Frame frame)
Creates a new SwingFramePeer.

Method Summary

Insets
getInsets()
Calculates the insets of this frame peer.
Point
getMenuLocationOnScreen()
Returns the location of the menu on the screen.
protected void
handleMouseEvent(MouseEvent ev)
Overridden to provide the ability to handle menus.
protected void
handleMouseMotionEvent(MouseEvent ev)
Overridden to provide the ability to handle menus.
protected void
peerPaintComponent(Graphics g)
Triggers 'heavyweight' painting of the frame.
void
setBounds(int x, int y, int w, int h)
Sets the size and location of this frame.
void
setMenuBar(MenuBar mb)
Sets the menu bar to display in this frame.

Methods inherited from class gnu.java.awt.peer.swing.SwingWindowPeer

setAlwaysOnTop, setModalBlocked, updateFocusableWindowState, updateIconImages, updateMinimumSize

Methods inherited from class gnu.java.awt.peer.swing.SwingContainerPeer

addHeavyweightDescendent, beginLayout, beginValidate, cancelPendingPaint, endLayout, endValidate, getHeavyweightDescendents, getInsets, handleKeyEvent, handleMouseEvent, handleMouseMotionEvent, insets, isPaintPending, isRestackSupported, peerPaint, peerPaintChildren, removeHeavyweightDescendent, restack

Methods inherited from class gnu.java.awt.peer.swing.SwingComponentPeer

canDetermineObscurity, checkImage, coalescePaintEvent, createBuffers, createImage, createImage, createVolatileImage, destroyBuffers, disable, dispose, enable, flip, getBackBuffer, getBounds, getColorModel, getComponent, getFontMetrics, getGraphics, getGraphicsConfiguration, getLocationOnScreen, getMinimumSize, getPreferredSize, getToolkit, handleEvent, handleFocusEvent, handleKeyEvent, handleMouseEvent, handleMouseMotionEvent, handlesWheelScrolling, hide, init, isFocusTraversable, isFocusable, isObscured, isReparentSupported, layout, minimumSize, paint, peerPaint, peerPaintComponent, preferredSize, prepareImage, print, repaint, reparent, requestFocus, requestFocus, requestFocus, reshape, setBackground, setBounds, setBounds, setCursor, setEnabled, setEventMask, setFont, setForeground, setVisible, show, updateCursorImmediately

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

SwingFramePeer

public SwingFramePeer(Frame frame)
Creates a new SwingFramePeer.
Parameters:
frame - the frame

Method Details

getInsets

public Insets getInsets()
Calculates the insets of this frame peer. This fetches the insets from the superclass and adds the insets of the menubar if one is present.
Specified by:
getInsets in interface ContainerPeer
Overrides:
getInsets in interface SwingContainerPeer
Returns:
the insets of the frame

getMenuLocationOnScreen

public Point getMenuLocationOnScreen()
Returns the location of the menu on the screen. This is needed internally by the SwingMenuBarPeer in order to determine its screen location.
Returns:
the location of the menu on the screen

handleMouseEvent

protected void handleMouseEvent(MouseEvent ev)
Overridden to provide the ability to handle menus.
Overrides:
handleMouseEvent in interface SwingContainerPeer
Parameters:
ev - the mouse event

handleMouseMotionEvent

protected void handleMouseMotionEvent(MouseEvent ev)
Overridden to provide the ability to handle menus.
Overrides:
handleMouseMotionEvent in interface SwingContainerPeer
Parameters:
ev - the mouse event

peerPaintComponent

protected void peerPaintComponent(Graphics g)
Triggers 'heavyweight' painting of the frame. This will paint a menu bar if present as well as the child components of this frame.
Overrides:
peerPaintComponent in interface SwingComponentPeer
Parameters:
g - the graphics context to use for painting

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Sets the size and location of this frame. This resizes the menubar to fit within the frame.
Specified by:
setBounds in interface ComponentPeer
Overrides:
setBounds in interface SwingComponentPeer
Parameters:
x - the X coordinate of the screen location
y - the Y coordinate of the screen location
w - the width of the frame
h - the height of the frame

setMenuBar

public void setMenuBar(MenuBar mb)
Sets the menu bar to display in this frame.
Specified by:
setMenuBar in interface FramePeer
Parameters:
mb - the menu bar to set

SwingFramePeer.java -- An abstract Swing based peer for AWT frames Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.