|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
diva.gui.toolbox.JPseudoFrame
public abstract class JPseudoFrame
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 occurring 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....)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
private javax.swing.JButton |
_closeButton
Three buttons |
private javax.swing.JComponent |
_component
The current content pane, if there is one |
private javax.swing.JDesktopPane |
_desktopPane
The desktop pane we are going to swap in and out. |
private java.awt.Dimension |
_dim
The dimension is fixed |
private java.awt.Component |
_glue
Some glue |
private javax.swing.JButton |
_iconifyButton
Three buttons |
private javax.swing.JInternalFrame |
_internalFrame
The internal frame that the current content pane belongs to. |
private javax.swing.event.EventListenerList |
_listeners
The event listeners |
private javax.swing.JMenuBar |
_menubar
The menubar to draw in |
private javax.swing.JButton |
_minimizeButton
Three buttons |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JPseudoFrame(javax.swing.JDesktopPane desktopPane,
javax.swing.JMenuBar menubar)
Construct a new PseudoFrame which will steal layout from the given desktop and draw itself in the given JMenuBar. |
Method Summary | |
---|---|
void |
addActionListener(java.awt.event.ActionListener l)
Add an action listener |
protected void |
fireInternalAction(java.lang.String name)
Fire an action event |
java.awt.Dimension |
getMaximumSize()
Return a fixed size |
java.awt.Dimension |
getMinimumSize()
Return a fixed size |
java.awt.Dimension |
getPreferredSize()
Return a fixed size |
void |
hideFrame()
Hide the pseudo-frame. |
boolean |
isClosed()
Test if the frame is closed. |
boolean |
isIconified()
Test if the frame is iconified. |
boolean |
isMaximum()
Test if the frame is maximized. |
void |
removeActionListener(java.awt.event.ActionListener l)
Remove an action listener |
protected abstract void |
removeComponent(javax.swing.JComponent component)
Remove the given component from its position in the display |
void |
setClosed(boolean flag)
Close the frame if the argument is true. |
protected abstract void |
setComponent(javax.swing.JComponent component)
Place the given component into the display |
void |
setIcon(boolean flag)
Iconify the frame if the argument is true. |
void |
setMaximum(boolean flag)
Minimize the frame if the argument is false. |
void |
showFrame(javax.swing.JInternalFrame frame)
Show the pseudo-frame with the contents of the given internal frame. |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private transient java.awt.Component _glue
private transient java.awt.Dimension _dim
private transient javax.swing.JButton _iconifyButton
private transient javax.swing.JButton _minimizeButton
private transient javax.swing.JButton _closeButton
private transient javax.swing.JMenuBar _menubar
private transient javax.swing.JComponent _component
private transient javax.swing.JDesktopPane _desktopPane
private transient javax.swing.JInternalFrame _internalFrame
private transient javax.swing.event.EventListenerList _listeners
Constructor Detail |
---|
public JPseudoFrame(javax.swing.JDesktopPane desktopPane, javax.swing.JMenuBar menubar)
Method Detail |
---|
public void addActionListener(java.awt.event.ActionListener l)
protected void fireInternalAction(java.lang.String name)
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public java.awt.Dimension getMaximumSize()
getMaximumSize
in class javax.swing.JComponent
public void hideFrame()
protected abstract void removeComponent(javax.swing.JComponent component)
protected abstract void setComponent(javax.swing.JComponent component)
public void showFrame(javax.swing.JInternalFrame frame)
public boolean isClosed()
public boolean isIconified()
public boolean isMaximum()
public void removeActionListener(java.awt.event.ActionListener l)
public void setClosed(boolean flag) throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
DesktopContext
public void setIcon(boolean flag) throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
DesktopContext
public void setMaximum(boolean flag) throws java.beans.PropertyVetoException
java.beans.PropertyVetoException
DesktopContext
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |