diva.gui.toolbox
Class JPseudoFrame
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
diva.gui.toolbox.JPseudoFrame
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable
public abstract class JPseudoFrame
- extends JComponent
JPseudoFrame is not a Frame at all, but a widget that enables a
JInternalFrame to be maximized in the manner exhibited by Windows
applications. By default, if you use a JDesktopPane and maximize
one of the internal frames, the internal frame becomes the size of
the desktop pane, but it still has a full title bar. Not to put too
fine a point on it, this sucks, especially since Swing (as of
JDK1.2.1) completely screws up if the desktop pane happens to be
inside of a JSplitPane.
Instead, what you want is for the contents of the internal
frame to replace the desktop pane, and to have the window
iconify, minimize, and close buttons appear on the right-hand end
of the menu bar. (Look at Word, Visio etc on Windows.) So what
JPseudoFrame does is give you a means to do exactly that. The
actual setup is a little complicated because the pseudo-frame is
not part of the containment hierarchy, and the method setContent()
must be overridden to place a component in the correct place in the
hierarchy.
To be notified of events occuring in the frame, attach an
action listener. Pressing the buttons will cause action events to
be fired with the command strings "iconified", "minimized", or
"closed." By the time that these events are generated, the
pseudo-frame will already have removed itself from the menu
bar. (Although we could perhaps generate InternalFrameEvents, this
is not really necessary and so we decided against on on the grounds
of getting this done....)
- Version:
- $Revision: 1.11 $
- Author:
- John Reekie (johnr@eecs.berkeley.edu)
- See Also:
- Serialized Form
Constructor Summary |
JPseudoFrame(JDesktopPane desktopPane,
JMenuBar menubar)
Construct a new PseudoFrame which will steal layout from the
given desktop and draw itself in the given JMenuBar. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
JPseudoFrame
public JPseudoFrame(JDesktopPane desktopPane,
JMenuBar menubar)
- Construct a new PseudoFrame which will steal layout from the
given desktop and draw itself in the given JMenuBar.
addActionListener
public void addActionListener(ActionListener l)
- Add an action listener
fireInternalAction
protected void fireInternalAction(String name)
- Fire an action event
getMinimumSize
public Dimension getMinimumSize()
- Return a fixed size
- Overrides:
getMinimumSize
in class JComponent
getPreferredSize
public Dimension getPreferredSize()
- Return a fixed size
- Overrides:
getPreferredSize
in class JComponent
getMaximumSize
public Dimension getMaximumSize()
- Return a fixed size
- Overrides:
getMaximumSize
in class JComponent
hideFrame
public void hideFrame()
- Hide the pseudo-frame. This method removes the current content
pane from its container and puts it back into its internal
frame. Then it puts the desktop pane back to where its supposed
to go. If no component is already shown, do nothing.
removeComponent
protected abstract void removeComponent(JComponent component)
- Remove the given component from its position in the display
setComponent
protected abstract void setComponent(JComponent component)
- Place the given component into the display
showFrame
public void showFrame(JInternalFrame frame)
- Show the pseudo-frame with the contents of the given internal
frame. This method removes the content pane from the internal
frame, removes the desktop pane from its container and then
puts the content pane where the desktop pane was. If a
component is already shown, do nothing.
isClosed
public boolean isClosed()
- Test if the frame is closed. Inverse of isMaximum().
isIconified
public boolean isIconified()
- Test if the frame is iconified. Inverse of isMaximum().
isMaximum
public boolean isMaximum()
- Test if the frame is maximized. Return true if the frame has
a content pane displayed.
removeActionListener
public void removeActionListener(ActionListener l)
- Remove an action listener
setClosed
public void setClosed(boolean flag)
throws PropertyVetoException
- Close the frame if the argument is true.
In this base class, move the content
pane from the view and put it back into its internal
frame. Then close the internal frame. If the argument is false,
then do nothing.
Subclasses may override this method to do something different
to close the frame. This is often useful if further management is
necessary.
- Throws:
PropertyVetoException
- See Also:
DesktopContext
setIcon
public void setIcon(boolean flag)
throws PropertyVetoException
- Iconify the frame if the argument is true.
In this base class, remove the content
pane from the view and put it back into its internal
frame. Then iconify the internal frame. If the argument is
false, do nothing.
Subclasses may override this method to do something different
to iconify the frame. This is often useful if further management is
necessary.
- Throws:
PropertyVetoException
- See Also:
DesktopContext
setMaximum
public void setMaximum(boolean flag)
throws PropertyVetoException
- Minimize the frame if the argument is false.
In this base class, remove the
content pane from the view and put it back into its internal
frame. If the argument is true, do nothing.
Subclasses may override this method to do something different
to undo maximization of the frame.
This is often useful if further management is necessary.
- Throws:
PropertyVetoException
- See Also:
DesktopContext
Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.