|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.plaf.metal.MetalTitlePane
Class that manages a JLF awt.Window-descendant class's title bar.
This class assumes it will be created with a particular window decoration style, and that if the style changes, a new one will be created.
Nested Class Summary | |
private class |
MetalTitlePane.CloseAction
Actions used to close the Window . |
private class |
MetalTitlePane.IconifyAction
Actions used to iconfiy the Frame . |
private class |
MetalTitlePane.MaximizeAction
Actions used to restore the Frame . |
private class |
MetalTitlePane.PropertyChangeHandler
PropertyChangeListener installed on the Window. |
private class |
MetalTitlePane.RestoreAction
Actions used to restore the Frame . |
private class |
MetalTitlePane.SystemMenuBar
Class responsible for drawing the system menu. |
private class |
MetalTitlePane.TitlePaneLayout
This inner class is marked "public" due to a compiler bug. |
private class |
MetalTitlePane.WindowHandler
WindowListener installed on the Window, updates the state as necessary. |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private Color |
activeBackground
|
private MetalBumps |
activeBumps
|
private Color |
activeBumpsHighlight
|
private Color |
activeBumpsShadow
|
private Color |
activeForeground
|
private Color |
activeShadow
|
private int |
buttonsWidth
Room remaining in title for bumps. |
private Action |
closeAction
Action used to close the Window. |
private JButton |
closeButton
Button used to maximize or restore the Frame. |
private static Border |
handyEmptyBorder
|
private Action |
iconifyAction
Action used to iconify the Frame. |
private JButton |
iconifyButton
Button used to maximize or restore the Frame. |
private static int |
IMAGE_HEIGHT
|
private static int |
IMAGE_WIDTH
|
private Color |
inactiveBackground
|
private MetalBumps |
inactiveBumps
|
private Color |
inactiveForeground
|
private Color |
inactiveShadow
|
private Action |
maximizeAction
Action to restore the Frame size. |
private Icon |
maximizeIcon
Icon used for toggleButton when window is normal size. |
private JMenuBar |
menuBar
JMenuBar, typically renders the system menu items. |
private Icon |
minimizeIcon
Icon used for toggleButton when window is maximized. |
private java.beans.PropertyChangeListener |
propertyChangeListener
PropertyChangeListener added to the JRootPane. |
private Action |
restoreAction
Action to restore the Frame size. |
private JRootPane |
rootPane
JRootPane rendering for. |
private MetalRootPaneUI |
rootPaneUI
MetalRootPaneUI that created us. |
private int |
state
Buffered Frame.state property. |
private JButton |
toggleButton
Button used to maximize or restore the Frame. |
private Window |
window
Window we're currently in. |
private WindowListener |
windowListener
Listens for changes in the state of the Window listener to update the state of the widgets. |
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.Container |
|
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 | |
MetalTitlePane(JRootPane root,
MetalRootPaneUI ui)
|
Method Summary | |
private void |
addMenuItems(JMenu menu)
Adds the necessary JMenuItem s to the passed in menu. |
void |
addNotify()
Notifies this component that it now has a parent component. |
private String |
clippedText(String text,
FontMetrics fm,
int availTextWidth)
Convenience method to clip the passed in text to the specified size. |
private void |
close()
Closes the Window. |
private void |
createActions()
Create the Action s that get associated with the
buttons and menu items. |
private void |
createButtons()
Creates the Buttons that will be placed on the TitlePane. |
private LayoutManager |
createLayout()
Returns the LayoutManager that should be installed on
the MetalTitlePane . |
private JMenu |
createMenu()
Returns the JMenu displaying the appropriate menu items
for manipulating the Frame. |
protected JMenuBar |
createMenuBar()
Returns the JMenuBar displaying the appropriate
system menu items. |
private JButton |
createTitleButton()
Returns a JButton appropriate for placement on the
TitlePane. |
private WindowListener |
createWindowListener()
Returns the WindowListener to add to the
Window . |
private java.beans.PropertyChangeListener |
createWindowPropertyChangeListener()
Returns the PropertyChangeListener to install on
the Window . |
private void |
determineColors()
Determines the Colors to draw with. |
private Frame |
getFrame()
Returns the Frame rendering in. |
JRootPane |
getRootPane()
Returns the JRootPane this was created for. |
private String |
getTitle()
Returns the String to display as the title. |
private Window |
getWindow()
Returns the Window the JRootPane is
contained in. |
private int |
getWindowDecorationStyle()
Returns the decoration style of the JRootPane . |
private void |
iconify()
Iconifies the Frame. |
private void |
installDefaults()
Installs the fonts and necessary properties on the MetalTitlePane. |
private void |
installListeners()
Installs the necessary listeners. |
private void |
installSubcomponents()
Adds any sub-Components contained in the MetalTitlePane . |
private void |
maximize()
Maximizes the Frame. |
void |
paintComponent(Graphics g)
Renders the TitlePane. |
void |
removeNotify()
Notifies this component that it no longer has a parent component. |
private void |
restore()
Restores the Frame size. |
private void |
setActive(boolean isActive)
Updates state dependant upon the Window's active state. |
private void |
setState(int state)
Sets the state of the Window. |
private void |
setState(int state,
boolean updateRegardless)
Sets the state of the window. |
private void |
uninstall()
Uninstalls the necessary state. |
private void |
uninstallDefaults()
Uninstalls any previously installed UI values. |
private void |
uninstallListeners()
Uninstalls the necessary listeners. |
private void |
updateToggleButton(Action action,
Icon icon)
Updates the toggle button to contain the Icon icon , and
Action action . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final Border handyEmptyBorder
private static final int IMAGE_HEIGHT
private static final int IMAGE_WIDTH
private java.beans.PropertyChangeListener propertyChangeListener
private JMenuBar menuBar
private Action closeAction
private Action iconifyAction
private Action restoreAction
private Action maximizeAction
private JButton toggleButton
private JButton iconifyButton
private JButton closeButton
private Icon maximizeIcon
private Icon minimizeIcon
private WindowListener windowListener
private Window window
private JRootPane rootPane
private int buttonsWidth
private int state
private MetalRootPaneUI rootPaneUI
private Color inactiveBackground
private Color inactiveForeground
private Color inactiveShadow
private Color activeBumpsHighlight
private Color activeBumpsShadow
private Color activeBackground
private Color activeForeground
private Color activeShadow
private MetalBumps activeBumps
private MetalBumps inactiveBumps
Constructor Detail |
public MetalTitlePane(JRootPane root, MetalRootPaneUI ui)
Method Detail |
private void uninstall()
private void installListeners()
private void uninstallListeners()
private WindowListener createWindowListener()
WindowListener
to add to the
Window
.
private java.beans.PropertyChangeListener createWindowPropertyChangeListener()
PropertyChangeListener
to install on
the Window
.
public JRootPane getRootPane()
JRootPane
this was created for.
getRootPane
in class JComponent
JRootPane
that contains this component,
or null
if no JRootPane
is foundprivate int getWindowDecorationStyle()
JRootPane
.
public void addNotify()
JComponent
KeyboardAction
event listeners.
addNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
public void removeNotify()
JComponent
KeyboardAction
s
set up in the the chain of parent components are removed.
removeNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
private void installSubcomponents()
MetalTitlePane
.
private void determineColors()
private void installDefaults()
private void uninstallDefaults()
protected JMenuBar createMenuBar()
JMenuBar
displaying the appropriate
system menu items.
private void close()
private void iconify()
private void maximize()
private void restore()
private void createActions()
Action
s that get associated with the
buttons and menu items.
private JMenu createMenu()
JMenu
displaying the appropriate menu items
for manipulating the Frame.
private void addMenuItems(JMenu menu)
JMenuItem
s to the passed in menu.
private JButton createTitleButton()
JButton
appropriate for placement on the
TitlePane.
private void createButtons()
private LayoutManager createLayout()
LayoutManager
that should be installed on
the MetalTitlePane
.
private void setActive(boolean isActive)
private void setState(int state)
private void setState(int state, boolean updateRegardless)
updateRegardless
is
true and the state has not changed, this will update anyway.
private void updateToggleButton(Action action, Icon icon)
icon
, and
Action action
.
private Frame getFrame()
JRootPane
is not contained in a Frame
.
private Window getWindow()
Window
the JRootPane
is
contained in. This will return null if there is no parent ancestor
of the JRootPane
.
private String getTitle()
public void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- the Graphics
object to protectJComponent.paint(java.awt.Graphics)
,
ComponentUI
private String clippedText(String text, FontMetrics fm, int availTextWidth)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |