public abstract class JPseudoFrame
extends javax.swing.JComponent
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....)
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, getAccessibleContext, 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, 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, transferFocusBackward, transferFocusUpCycle
public JPseudoFrame(javax.swing.JDesktopPane desktopPane, javax.swing.JMenuBar menubar)
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