RootPaneUI
.
MetalRootPaneUI
provides support for the
windowDecorationStyle
property of JRootPane
.
MetalRootPaneUI
does this by way of installing a custom
LayoutManager
, a private Component
to render
the appropriate widgets, and a private Border
. The
LayoutManager
is always installed, regardless of the value of
the windowDecorationStyle
property, but the
Border
and Component
are only installed/added if
the windowDecorationStyle
is other than
JRootPane.NONE
.
Warning
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeans
has been added to the java.beans
package.
Please see java.
.
Modifier and Type | Class and Description |
---|---|
private static class | MetalRootPaneUI.
A custom layout manager that is responsible for the layout of layeredPane, glassPane, menuBar and titlePane, if one has been installed. |
private class | MetalRootPaneUI.
MouseInputHandler is responsible for handling resize/moving of the Window. |
Modifier and Type | Field and Description |
---|---|
private static final int | BORDER_DRAG_THICKNESS
Region from edges that dragging is active from. |
private static final String[] | borderKeys
Keys to lookup borders in defaults table. |
private static final int | CORNER_DRAG_WIDTH
The amount of space (in pixels) that the cursor is changed on. |
private static final int[] | cursorMapping
Maps from positions to cursor type. |
private Cursor | lastCursor
|
private LayoutManager | layoutManager
The |
private MouseInputListener | mouseInputListener
|
private JRootPane | root
|
private LayoutManager | savedOldLayout
|
private JComponent | titlePane
|
private Window | window
Window the |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
private LayoutManager | |
private JComponent | |
public static ComponentUI | Returns: the RootPaneUI implementation for the passed in JRootPanethe JRootPane the RootPaneUI will be created for c)Hides javax. JRootPane .
|
private MouseInputListener | createWindowMouseInputListener(JRootPane root)
Returns a |
private JRootPane | |
private JComponent | Returns: the current window title pane, or nullReturns the |
pack-priv void | |
private void | installClientDecorations(JRootPane root)
Installs the necessary state onto the JRootPane to render client decorations. |
private void | installLayout(JRootPane root)
Installs the appropriate LayoutManager on the |
public void | installUI(JComponent
the JRootPane to install state onto c)Overrides javax. installUI to install
the necessary state onto the passed in JRootPane
to render the metal look and feel implementation of
RootPaneUI .
|
private void | installWindowListeners(JRootPane root, Component
The parent of the JRootPane parent)Installs the necessary Listeners on the parent |
public void | propertyChange(PropertyChangeEvent
A PropertyChangeEvent object describing the event source
and the property that has changed. e)Overrides javax. Implements java. |
private void | setTitlePane(JRootPane root, JComponent
the titlePane)JComponent to use for the window title pane.Sets the window title pane -- the JComponent used to provide a plaf a way to override the native operating system's window title pane with one whose look and feel are controlled by the plaf. |
private void | |
private void | uninstallClientDecorations(JRootPane root)
Uninstalls any state that |
private void | |
public void | uninstallUI(JComponent
the JRootPane to uninstall state from c)Overrides javax. |
private void | uninstallWindowListeners(JRootPane root)
Uninstalls the necessary Listeners on the |
BORDER_DRAG_THICKNESS | back to summary |
---|---|
private static final int BORDER_DRAG_THICKNESS Region from edges that dragging is active from. |
borderKeys | back to summary |
---|---|
private static final String[] borderKeys Keys to lookup borders in defaults table. |
CORNER_DRAG_WIDTH | back to summary |
---|---|
private static final int CORNER_DRAG_WIDTH The amount of space (in pixels) that the cursor is changed on. |
cursorMapping | back to summary |
---|---|
private static final int[] cursorMapping Maps from positions to cursor type. Refer to calculateCorner and calculatePosition for details of this. |
lastCursor | back to summary |
---|---|
private Cursor lastCursor
|
layoutManager | back to summary |
---|---|
private LayoutManager layoutManager The |
mouseInputListener | back to summary |
---|---|
private MouseInputListener mouseInputListener
|
root | back to summary |
---|---|
private JRootPane root
|
savedOldLayout | back to summary |
---|---|
private LayoutManager savedOldLayout
|
titlePane | back to summary |
---|---|
private JComponent titlePane
|
window | back to summary |
---|---|
private Window window Window the |
MetalRootPaneUI | back to summary |
---|---|
public MetalRootPaneUI() Constructs a |
createLayoutManager | back to summary |
---|---|
private LayoutManager createLayoutManager() Returns a |
createTitlePane | back to summary |
---|---|
private JComponent createTitlePane(JRootPane root) Returns the |
createUI | back to summary |
---|---|
public static ComponentUI createUI(JComponent c) Hides javax. Creates a UI for a
|
createWindowMouseInputListener | back to summary |
---|---|
private MouseInputListener createWindowMouseInputListener(JRootPane root) Returns a |
getRootPane | back to summary |
---|---|
private JRootPane getRootPane() Returns the |
getTitlePane | back to summary |
---|---|
private JComponent getTitlePane() Returns the
|
installBorder | back to summary |
---|---|
pack-priv void installBorder(JRootPane root) Installs the appropriate |
installClientDecorations | back to summary |
---|---|
private void installClientDecorations(JRootPane root) Installs the necessary state onto the JRootPane to render client
decorations. This is ONLY invoked if the |
installLayout | back to summary |
---|---|
private void installLayout(JRootPane root) Installs the appropriate LayoutManager on the |
installUI | back to summary |
---|---|
public void installUI(JComponent c) Overrides javax. Invokes supers implementation of
|
installWindowListeners | back to summary |
---|---|
private void installWindowListeners(JRootPane root, Component parent) Installs the necessary Listeners on the parent
This takes the parent so that cleanup can be done from
|
propertyChange | back to summary |
---|---|
public void propertyChange(PropertyChangeEvent e) Overrides javax. Implements java. Invoked when a property changes.
|
setTitlePane | back to summary |
---|---|
private void setTitlePane(JRootPane root, JComponent titlePane) Sets the window title pane -- the JComponent used to provide a plaf a way to override the native operating system's window title pane with one whose look and feel are controlled by the plaf. The plaf creates and sets this value; the default is null, implying a native operating system window title pane.
|
uninstallBorder | back to summary |
---|---|
private void uninstallBorder(JRootPane root) Removes any border that may have been installed. |
uninstallClientDecorations | back to summary |
---|---|
private void uninstallClientDecorations(JRootPane root) Uninstalls any state that Note This may be called if you haven't installed client decorations
yet (ie before |
uninstallLayout | back to summary |
---|---|
private void uninstallLayout(JRootPane root) Uninstalls the previously installed |
uninstallUI | back to summary |
---|---|
public void uninstallUI(JComponent c) Overrides javax. Invokes supers implementation to uninstall any of its state. This will
also reset the
|
uninstallWindowListeners | back to summary |
---|---|
private void uninstallWindowListeners(JRootPane root) Uninstalls the necessary Listeners on the |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public void | addLayoutComponent(String
the string to be associated with the component name, Component the component to be added comp)Implements java. comp to the layout,
associating it
with the string specified by name .
|
public void | addLayoutComponent(Component
the component to be added comp, Object where/how the component is added to the layout. constraints)Implements java. |
public float | getLayoutAlignmentX(Container
the target container target)Implements java. |
public float | getLayoutAlignmentY(Container
the target container target)Implements java. |
public void | invalidateLayout(Container
the target container target)Implements java. |
public void | layoutContainer(Container
the Container for which this layout manager is being used parent)Implements java. |
public Dimension | Returns: a Dimension object containing the layout's maximum sizethe Container for which this layout manager is being used target)Implements java. |
public Dimension | Returns: a Dimension object containing the layout's minimum sizethe Container for which this layout manager is being used parent)Implements java. |
public Dimension | Returns: a Dimension object containing the layout's preferred sizethe Container for which this layout manager is being used parent)Implements java. |
public void | removeLayoutComponent(Component
the component to be removed comp)Implements java. |
MetalRootLayout | back to summary |
---|---|
private MetalRootLayout() |
addLayoutComponent | back to summary |
---|---|
public void addLayoutComponent(String name, Component comp) Implements java. Doc from java. If the layout manager uses a per-component string,
adds the component |
addLayoutComponent | back to summary |
---|---|
public void addLayoutComponent(Component comp, Object constraints) Implements java. Doc from java. Adds the specified component to the layout, using the specified constraint object. |
getLayoutAlignmentX | back to summary |
---|---|
public float getLayoutAlignmentX(Container target) Implements java. Doc from java. Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
|
getLayoutAlignmentY | back to summary |
---|---|
public float getLayoutAlignmentY(Container target) Implements java. Doc from java. Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.
|
invalidateLayout | back to summary |
---|---|
public void invalidateLayout(Container target) Implements java. Doc from java. Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
|
layoutContainer | back to summary |
---|---|
public void layoutContainer(Container parent) Implements java. Instructs the layout manager to perform the layout for the specified container.
|
maximumLayoutSize | back to summary |
---|---|
public Dimension maximumLayoutSize(Container target) Implements java. Returns the maximum amount of space the layout can use. |
minimumLayoutSize | back to summary |
---|---|
public Dimension minimumLayoutSize(Container parent) Implements java. Returns the minimum amount of space the layout needs. |
preferredLayoutSize | back to summary |
---|---|
public Dimension preferredLayoutSize(Container parent) Implements java. Returns the amount of space the layout would like to have. |
removeLayoutComponent | back to summary |
---|---|
public void removeLayoutComponent(Component comp) Implements java. Doc from java. Removes the specified component from the layout.
|
Modifier and Type | Field and Description |
---|---|
private int | dragCursor
Used to determine the corner the resize is occurring from. |
private int | dragHeight
Height of the window when the drag started. |
private int | dragOffsetX
X location the mouse went down on for a drag operation. |
private int | dragOffsetY
Y location the mouse went down on for a drag operation. |
private int | dragWidth
Width of the window when the drag started. |
private boolean | isMovingWindow
Set to true if the drag operation is moving the window. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private void | |
private int | calculateCorner(Window w, int x, int y)
Returns the corner that contains the point |
private int | |
private int | |
public void | mouseClicked(MouseEvent
the event to be processed ev)Implements java. |
public void | mouseDragged(MouseEvent
the event to be processed ev)Implements java. |
public void | mouseEntered(MouseEvent
the event to be processed ev)Implements java. |
public void | mouseExited(MouseEvent
the event to be processed ev)Implements java. |
public void | mouseMoved(MouseEvent
the event to be processed ev)Implements java. |
public void | mousePressed(MouseEvent
the event to be processed ev)Implements java. |
public void | mouseReleased(MouseEvent
the event to be processed ev)Implements java. |
dragCursor | back to summary |
---|---|
private int dragCursor Used to determine the corner the resize is occurring from. |
dragHeight | back to summary |
---|---|
private int dragHeight Height of the window when the drag started. |
dragOffsetX | back to summary |
---|---|
private int dragOffsetX X location the mouse went down on for a drag operation. |
dragOffsetY | back to summary |
---|---|
private int dragOffsetY Y location the mouse went down on for a drag operation. |
dragWidth | back to summary |
---|---|
private int dragWidth Width of the window when the drag started. |
isMovingWindow | back to summary |
---|---|
private boolean isMovingWindow Set to true if the drag operation is moving the window. |
MouseInputHandler | back to summary |
---|---|
private MouseInputHandler() |
adjust | back to summary |
---|---|
private void adjust(Rectangle bounds, Dimension min, int deltaX, int deltaY, int deltaWidth, int deltaHeight) |
calculateCorner | back to summary |
---|---|
private int calculateCorner(Window w, int x, int y) Returns the corner that contains the point |
calculatePosition | back to summary |
---|---|
private int calculatePosition(int spot, int width) Returns an integer indicating the position of |
getCursor | back to summary |
---|---|
private int getCursor(int corner) Returns the Cursor to render for the specified corner. This returns 0 if the corner doesn't map to a valid Cursor |
mouseClicked | back to summary |
---|---|
public void mouseClicked(MouseEvent ev) Implements java. Doc from java. Invoked when the mouse button has been clicked (pressed and released) on a component.
|
mouseDragged | back to summary |
---|---|
public void mouseDragged(MouseEvent ev) Implements java. Doc from java. Invoked when a mouse button is pressed on a component and then
dragged.
Due to platform-dependent Drag&Drop implementations,
|
mouseEntered | back to summary |
---|---|
public void mouseEntered(MouseEvent ev) Implements java. Doc from java. Invoked when the mouse enters a component.
|
mouseExited | back to summary |
---|---|
public void mouseExited(MouseEvent ev) Implements java. Doc from java. Invoked when the mouse exits a component.
|
mouseMoved | back to summary |
---|---|
public void mouseMoved(MouseEvent ev) Implements java. Doc from java. Invoked when the mouse cursor has been moved onto a component but no buttons have been pushed.
|
mousePressed | back to summary |
---|---|
public void mousePressed(MouseEvent ev) Implements java. Doc from java. Invoked when a mouse button has been pressed on a component.
|
mouseReleased | back to summary |
---|---|
public void mouseReleased(MouseEvent ev) Implements java. Doc from java. Invoked when a mouse button has been released on a component.
|