javax.swing.plaf.basic
Class BasicInternalFrameTitlePane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.plaf.basic.BasicInternalFrameTitlePane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
MetalInternalFrameTitlePane

public class BasicInternalFrameTitlePane
extends JComponent

This class acts as a titlebar for JInternalFrames.

See Also:
Serialized Form

Nested Class Summary
 class BasicInternalFrameTitlePane.CloseAction
          The Action responsible for closing the JInternalFrame.
 class BasicInternalFrameTitlePane.IconifyAction
          This Action is responsible for iconifying the JInternalFrame.
 class BasicInternalFrameTitlePane.MaximizeAction
          This Action is responsible for maximizing the JInternalFrame.
 class BasicInternalFrameTitlePane.MoveAction
          This Action is responsible for dragging the JInternalFrame.
 class BasicInternalFrameTitlePane.PropertyChangeHandler
          This class is responsible for handling property change events from the JInternalFrame and adjusting the Title Pane as necessary.
 class BasicInternalFrameTitlePane.RestoreAction
          This Action is responsible for restoring the JInternalFrame.
 class BasicInternalFrameTitlePane.SizeAction
          This action is responsible for sizing the JInternalFrame.
 class BasicInternalFrameTitlePane.SystemMenuBar
          This class acts as the MenuBar for the TitlePane.
 class BasicInternalFrameTitlePane.TitlePaneLayout
          This class acts as the Layout Manager for the TitlePane.
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected static String CLOSE_CMD
          The action command for the Close action.
protected  Action closeAction
          The action associated with closing the JInternalFrame.
protected  JButton closeButton
          The button that closes the JInternalFrame.
protected  Icon closeIcon
          The icon displayed in the close button.
protected  JInternalFrame frame
          The JInternalFrame that this TitlePane is used in.
protected  JButton iconButton
          The button that iconifies the JInternalFrame.
protected  Icon iconIcon
          The icon displayed in the iconify button.
protected static String ICONIFY_CMD
          The action command for the Minimize action.
protected  Action iconifyAction
          The action associated with iconifying the JInternalFrame.
protected  JButton maxButton
          The button that maximizes the JInternalFrame.
protected  Icon maxIcon
          The icon displayed in the maximize button.
protected static String MAXIMIZE_CMD
          The action command for the Maximize action.
protected  Action maximizeAction
          The action associated with maximizing the JInternalFrame.
protected  JMenuBar menuBar
          The JMenuBar that is located at the top left of the Title Pane.
protected  Icon minIcon
          The icon displayed in the restore button.
protected static String MOVE_CMD
          The action command for the Move action.
protected  Action moveAction
          The action associated with moving the JInternalFrame.
protected  Color notSelectedTextColor
          The text color of the TitlePane when the JInternalFrame is not selected.
protected  Color notSelectedTitleColor
          The background color of the TitlePane when the JInternalFrame is not selected.
protected  PropertyChangeListener propertyChangeListener
          The Property Change listener that listens to the JInternalFrame.
protected static String RESTORE_CMD
          The action command for the Restore action.
protected  Action restoreAction
          The action associated with restoring the JInternalFrame.
protected  Color selectedTextColor
          The text color of the titlePane when the JInternalFrame is selected.
protected  Color selectedTitleColor
          The background color of the TitlePane when the JInternalFrame is selected.
protected static String SIZE_CMD
          The action command for the Size action.
protected  Action sizeAction
          The action associated with resizing the JInternalFrame.
protected  JMenu windowMenu
          The JMenu inside the menuBar.
 
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
BasicInternalFrameTitlePane(JInternalFrame f)
          Creates a new BasicInternalFrameTitlePane object that is used in the given JInternalFrame.
 
Method Summary
protected  void addSubComponents()
          This method adds the sub components to the TitlePane.
protected  void addSystemMenuItems(JMenu systemMenu)
          This method adds the MenuItems to the given JMenu.
protected  void assembleSystemMenu()
          This method creates the MenuBar used in the TitlePane.
protected  void createActions()
          This method creates the actions that are used to manipulate the JInternalFrame.
protected  void createButtons()
          This method creates the buttons used in the TitlePane.
protected  LayoutManager createLayout()
          This method creates a new LayoutManager for the TitlePane.
protected  PropertyChangeListener createPropertyChangeListener()
          This method creates a new PropertyChangeListener.
protected  JMenu createSystemMenu()
          This method creates a new JMenu.
protected  JMenuBar createSystemMenuBar()
          This method creates a new JMenubar.
protected  void enableActions()
          This method enables the actions for the TitlePane given the frame's properties.
protected  String getTitle(String text, FontMetrics fm, int availableWidth)
          This method returns the title string based on the available width and the font metrics.
protected  void installDefaults()
          This method installs the defaults determined by the look and feel.
protected  void installListeners()
          This method is used to install the listeners.
protected  void installTitlePane()
          This method installs the TitlePane onto the JInternalFrameTitlePane.
 void paintComponent(Graphics g)
          This method paints the TitlePane.
protected  void paintTitleBackground(Graphics g)
          This method paints the TitlePane's background.
protected  void postClosingEvent(JInternalFrame frame)
          This method fires something similar to a WINDOW_CLOSING event.
protected  void setButtonIcons()
          Set icons for the minimize-, maximize- and close-buttons.
protected  void showSystemMenu()
          This method programmatically shows the JMenu.
protected  void uninstallDefaults()
          This method uninstalls the defaults.
protected  void uninstallListeners()
          This method is used to uninstall the listeners.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, 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, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, 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, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, 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, processMouseEvent, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLOSE_CMD

protected static final String CLOSE_CMD
The action command for the Close action.


ICONIFY_CMD

protected static final String ICONIFY_CMD
The action command for the Minimize action.


MAXIMIZE_CMD

protected static final String MAXIMIZE_CMD
The action command for the Maximize action.


MOVE_CMD

protected static final String MOVE_CMD
The action command for the Move action.


RESTORE_CMD

protected static final String RESTORE_CMD
The action command for the Restore action.


SIZE_CMD

protected static final String SIZE_CMD
The action command for the Size action.


closeAction

protected Action closeAction
The action associated with closing the JInternalFrame.


iconifyAction

protected Action iconifyAction
The action associated with iconifying the JInternalFrame.


maximizeAction

protected Action maximizeAction
The action associated with maximizing the JInternalFrame.


moveAction

protected Action moveAction
The action associated with moving the JInternalFrame.


restoreAction

protected Action restoreAction
The action associated with restoring the JInternalFrame.


sizeAction

protected Action sizeAction
The action associated with resizing the JInternalFrame.


closeButton

protected JButton closeButton
The button that closes the JInternalFrame.


iconButton

protected JButton iconButton
The button that iconifies the JInternalFrame.


maxButton

protected JButton maxButton
The button that maximizes the JInternalFrame.


minIcon

protected Icon minIcon
The icon displayed in the restore button.


maxIcon

protected Icon maxIcon
The icon displayed in the maximize button.


iconIcon

protected Icon iconIcon
The icon displayed in the iconify button.


closeIcon

protected Icon closeIcon
The icon displayed in the close button.


frame

protected JInternalFrame frame
The JInternalFrame that this TitlePane is used in.


menuBar

protected JMenuBar menuBar
The JMenuBar that is located at the top left of the Title Pane.


windowMenu

protected JMenu windowMenu
The JMenu inside the menuBar.


notSelectedTextColor

protected Color notSelectedTextColor
The text color of the TitlePane when the JInternalFrame is not selected.


notSelectedTitleColor

protected Color notSelectedTitleColor
The background color of the TitlePane when the JInternalFrame is not selected.


selectedTextColor

protected Color selectedTextColor
The text color of the titlePane when the JInternalFrame is selected.


selectedTitleColor

protected Color selectedTitleColor
The background color of the TitlePane when the JInternalFrame is selected.


propertyChangeListener

protected PropertyChangeListener propertyChangeListener
The Property Change listener that listens to the JInternalFrame.

Constructor Detail

BasicInternalFrameTitlePane

public BasicInternalFrameTitlePane(JInternalFrame f)
Creates a new BasicInternalFrameTitlePane object that is used in the given JInternalFrame.

Parameters:
f - The JInternalFrame this BasicInternalFrameTitlePane will be used in.
Method Detail

installTitlePane

protected void installTitlePane()
This method installs the TitlePane onto the JInternalFrameTitlePane. It also creates any children components that need to be created and adds listeners to the appropriate components.


addSubComponents

protected void addSubComponents()
This method adds the sub components to the TitlePane.


createActions

protected void createActions()
This method creates the actions that are used to manipulate the JInternalFrame.


installListeners

protected void installListeners()
This method is used to install the listeners.


uninstallListeners

protected void uninstallListeners()
This method is used to uninstall the listeners.


installDefaults

protected void installDefaults()
This method installs the defaults determined by the look and feel.


uninstallDefaults

protected void uninstallDefaults()
This method uninstalls the defaults.


createButtons

protected void createButtons()
This method creates the buttons used in the TitlePane.


setButtonIcons

protected void setButtonIcons()
Set icons for the minimize-, maximize- and close-buttons.


assembleSystemMenu

protected void assembleSystemMenu()
This method creates the MenuBar used in the TitlePane.


addSystemMenuItems

protected void addSystemMenuItems(JMenu systemMenu)
This method adds the MenuItems to the given JMenu.

Parameters:
systemMenu - The JMenu to add MenuItems to.

createSystemMenuBar

protected JMenuBar createSystemMenuBar()
This method creates a new JMenubar.

Returns:
A new JMenuBar.

createSystemMenu

protected JMenu createSystemMenu()
This method creates a new JMenu.

Returns:
A new JMenu.

showSystemMenu

protected void showSystemMenu()
This method programmatically shows the JMenu.


paintComponent

public void paintComponent(Graphics g)
This method paints the TitlePane.

Overrides:
paintComponent in class JComponent
Parameters:
g - The Graphics object to paint with.
See Also:
JComponent.paint(java.awt.Graphics), JComponent.paintBorder(java.awt.Graphics), JComponent.paintChildren(java.awt.Graphics)

paintTitleBackground

protected void paintTitleBackground(Graphics g)
This method paints the TitlePane's background.

Parameters:
g - The Graphics object to paint with.

getTitle

protected String getTitle(String text,
                          FontMetrics fm,
                          int availableWidth)
This method returns the title string based on the available width and the font metrics.

Parameters:
text - The desired title.
fm - The FontMetrics of the font used.
availableWidth - The available width.
Returns:
The allowable string.

postClosingEvent

protected void postClosingEvent(JInternalFrame frame)
This method fires something similar to a WINDOW_CLOSING event.

Parameters:
frame - The JInternalFrame that is being closed.

enableActions

protected void enableActions()
This method enables the actions for the TitlePane given the frame's properties.


createPropertyChangeListener

protected PropertyChangeListener createPropertyChangeListener()
This method creates a new PropertyChangeListener.

Returns:
A new PropertyChangeListener.

createLayout

protected LayoutManager createLayout()
This method creates a new LayoutManager for the TitlePane.

Returns:
A new LayoutManager.