< prev index next >
src/java.desktop/share/classes/javax/swing/plaf/metal/MetalRootPaneUI.java
Print this page
@@ -32,30 +32,30 @@
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import java.awt.*;
/**
- * Provides the metal look and feel implementation of <code>RootPaneUI</code>.
+ * Provides the metal look and feel implementation of {@code RootPaneUI}.
* <p>
- * <code>MetalRootPaneUI</code> provides support for the
- * <code>windowDecorationStyle</code> property of <code>JRootPane</code>.
- * <code>MetalRootPaneUI</code> does this by way of installing a custom
- * <code>LayoutManager</code>, a private <code>Component</code> to render
- * the appropriate widgets, and a private <code>Border</code>. The
- * <code>LayoutManager</code> is always installed, regardless of the value of
- * the <code>windowDecorationStyle</code> property, but the
- * <code>Border</code> and <code>Component</code> are only installed/added if
- * the <code>windowDecorationStyle</code> is other than
- * <code>JRootPane.NONE</code>.
+ * {@code MetalRootPaneUI} provides support for the
+ * {@code windowDecorationStyle} property of {@code JRootPane}.
+ * {@code MetalRootPaneUI} does this by way of installing a custom
+ * {@code LayoutManager}, a private {@code Component} to render
+ * the appropriate widgets, and a private {@code Border}. The
+ * {@code LayoutManager} is always installed, regardless of the value of
+ * the {@code windowDecorationStyle} property, but the
+ * {@code Border} and {@code Component} are only installed/added if
+ * the {@code windowDecorationStyle} is other than
+ * {@code JRootPane.NONE}.
* <p>
* <strong>Warning:</strong>
* 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 <code>java.beans</code> package.
+ * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Terry Kellerman
* @since 1.4
*/
@@ -81,71 +81,71 @@
* Region from edges that dragging is active from.
*/
private static final int BORDER_DRAG_THICKNESS = 5;
/**
- * Window the <code>JRootPane</code> is in.
+ * Window the {@code JRootPane} is in.
*/
private Window window;
/**
- * <code>JComponent</code> providing window decorations. This will be
+ * {@code JComponent} providing window decorations. This will be
* null if not providing window decorations.
*/
private JComponent titlePane;
/**
- * <code>MouseInputListener</code> that is added to the parent
- * <code>Window</code> the <code>JRootPane</code> is contained in.
+ * {@code MouseInputListener} that is added to the parent
+ * {@code Window} the {@code JRootPane} is contained in.
*/
private MouseInputListener mouseInputListener;
/**
- * The <code>LayoutManager</code> that is set on the
- * <code>JRootPane</code>.
+ * The {@code LayoutManager} that is set on the
+ * {@code JRootPane}.
*/
private LayoutManager layoutManager;
/**
- * <code>LayoutManager</code> of the <code>JRootPane</code> before we
+ * {@code LayoutManager} of the {@code JRootPane} before we
* replaced it.
*/
private LayoutManager savedOldLayout;
/**
- * <code>JRootPane</code> providing the look and feel for.
+ * {@code JRootPane} providing the look and feel for.
*/
private JRootPane root;
/**
- * <code>Cursor</code> used to track the cursor set by the user.
- * This is initially <code>Cursor.DEFAULT_CURSOR</code>.
+ * {@code Cursor} used to track the cursor set by the user.
+ * This is initially {@code Cursor.DEFAULT_CURSOR}.
*/
private Cursor lastCursor =
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
/**
- * Creates a UI for a <code>JRootPane</code>.
+ * Creates a UI for a {@code JRootPane}.
*
* @param c the JRootPane the RootPaneUI will be created for
* @return the RootPaneUI implementation for the passed in JRootPane
*/
public static ComponentUI createUI(JComponent c) {
return new MetalRootPaneUI();
}
/**
- * Invokes supers implementation of <code>installUI</code> to install
- * the necessary state onto the passed in <code>JRootPane</code>
+ * Invokes supers implementation of {@code installUI} to install
+ * the necessary state onto the passed in {@code JRootPane}
* to render the metal look and feel implementation of
- * <code>RootPaneUI</code>. If
- * the <code>windowDecorationStyle</code> property of the
- * <code>JRootPane</code> is other than <code>JRootPane.NONE</code>,
- * this will add a custom <code>Component</code> to render the widgets to
- * <code>JRootPane</code>, as well as installing a custom
- * <code>Border</code> and <code>LayoutManager</code> on the
- * <code>JRootPane</code>.
+ * {@code RootPaneUI}. If
+ * the {@code windowDecorationStyle} property of the
+ * {@code JRootPane} is other than {@code JRootPane.NONE},
+ * this will add a custom {@code Component} to render the widgets to
+ * {@code JRootPane}, as well as installing a custom
+ * {@code Border} and {@code LayoutManager} on the
+ * {@code JRootPane}.
*
* @param c the JRootPane to install state onto
*/
public void installUI(JComponent c) {
super.installUI(c);
@@ -157,15 +157,15 @@
}
/**
* Invokes supers implementation to uninstall any of its state. This will
- * also reset the <code>LayoutManager</code> of the <code>JRootPane</code>.
- * If a <code>Component</code> has been added to the <code>JRootPane</code>
+ * also reset the {@code LayoutManager} of the {@code JRootPane}.
+ * If a {@code Component} has been added to the {@code JRootPane}
* to render the window decoration style, this method will remove it.
* Similarly, this will revert the Border and LayoutManager of the
- * <code>JRootPane</code> to what it was before <code>installUI</code>
+ * {@code JRootPane} to what it was before {@code installUI}
* was invoked.
*
* @param c the JRootPane to uninstall state from
*/
public void uninstallUI(JComponent c) {
@@ -176,12 +176,12 @@
mouseInputListener = null;
root = null;
}
/**
- * Installs the appropriate <code>Border</code> onto the
- * <code>JRootPane</code>.
+ * Installs the appropriate {@code Border} onto the
+ * {@code JRootPane}.
*/
void installBorder(JRootPane root) {
int style = root.getWindowDecorationStyle();
if (style == JRootPane.NONE) {
@@ -198,15 +198,15 @@
private void uninstallBorder(JRootPane root) {
LookAndFeel.uninstallBorder(root);
}
/**
- * Installs the necessary Listeners on the parent <code>Window</code>,
+ * Installs the necessary Listeners on the parent {@code Window},
* if there is one.
* <p>
* This takes the parent so that cleanup can be done from
- * <code>removeNotify</code>, at which point the parent hasn't been
+ * {@code removeNotify}, at which point the parent hasn't been
* reset yet.
*
* @param parent The parent of the JRootPane
*/
private void installWindowListeners(JRootPane root, Component parent) {
@@ -224,22 +224,22 @@
window.addMouseMotionListener(mouseInputListener);
}
}
/**
- * Uninstalls the necessary Listeners on the <code>Window</code> the
+ * Uninstalls the necessary Listeners on the {@code Window} the
* Listeners were last installed on.
*/
private void uninstallWindowListeners(JRootPane root) {
if (window != null) {
window.removeMouseListener(mouseInputListener);
window.removeMouseMotionListener(mouseInputListener);
}
}
/**
- * Installs the appropriate LayoutManager on the <code>JRootPane</code>
+ * Installs the appropriate LayoutManager on the {@code JRootPane}
* to render the window decorations.
*/
private void installLayout(JRootPane root) {
if (layoutManager == null) {
layoutManager = createLayoutManager();
@@ -247,23 +247,23 @@
savedOldLayout = root.getLayout();
root.setLayout(layoutManager);
}
/**
- * Uninstalls the previously installed <code>LayoutManager</code>.
+ * Uninstalls the previously installed {@code LayoutManager}.
*/
private void uninstallLayout(JRootPane root) {
if (savedOldLayout != null) {
root.setLayout(savedOldLayout);
savedOldLayout = null;
}
}
/**
* Installs the necessary state onto the JRootPane to render client
- * decorations. This is ONLY invoked if the <code>JRootPane</code>
- * has a decoration style other than <code>JRootPane.NONE</code>.
+ * decorations. This is ONLY invoked if the {@code JRootPane}
+ * has a decoration style other than {@code JRootPane.NONE}.
*/
private void installClientDecorations(JRootPane root) {
installBorder(root);
JComponent titlePane = createTitlePane(root);
@@ -276,15 +276,15 @@
root.repaint();
}
}
/**
- * Uninstalls any state that <code>installClientDecorations</code> has
+ * Uninstalls any state that {@code installClientDecorations} has
* installed.
* <p>
* NOTE: This may be called if you haven't installed client decorations
- * yet (ie before <code>installClientDecorations</code> has been invoked).
+ * yet (ie before {@code installClientDecorations} has been invoked).
*/
private void uninstallClientDecorations(JRootPane root) {
uninstallBorder(root);
uninstallWindowListeners(root);
setTitlePane(root, null);
@@ -306,28 +306,28 @@
}
window = null;
}
/**
- * Returns the <code>JComponent</code> to render the window decoration
+ * Returns the {@code JComponent} to render the window decoration
* style.
*/
private JComponent createTitlePane(JRootPane root) {
return new MetalTitlePane(root, this);
}
/**
- * Returns a <code>MouseListener</code> that will be added to the
- * <code>Window</code> containing the <code>JRootPane</code>.
+ * Returns a {@code MouseListener} that will be added to the
+ * {@code Window} containing the {@code JRootPane}.
*/
private MouseInputListener createWindowMouseInputListener(JRootPane root) {
return new MouseInputHandler();
}
/**
- * Returns a <code>LayoutManager</code> that will be set on the
- * <code>JRootPane</code>.
+ * Returns a {@code LayoutManager} that will be set on the
+ * {@code JRootPane}.
*/
private LayoutManager createLayoutManager() {
return new MetalRootLayout();
}
@@ -336,11 +336,11 @@
* 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.
*
- * @param content the <code>JComponent</code> to use for the window title pane.
+ * @param content the {@code JComponent} to use for the window title pane.
*/
private void setTitlePane(JRootPane root, JComponent titlePane) {
JLayeredPane layeredPane = root.getLayeredPane();
JComponent oldTitlePane = getTitlePane();
@@ -354,42 +354,42 @@
}
this.titlePane = titlePane;
}
/**
- * Returns the <code>JComponent</code> rendering the title pane. If this
+ * Returns the {@code JComponent} rendering the title pane. If this
* returns null, it implies there is no need to render window decorations.
*
* @return the current window title pane, or null
* @see #setTitlePane
*/
private JComponent getTitlePane() {
return titlePane;
}
/**
- * Returns the <code>JRootPane</code> we're providing the look and
+ * Returns the {@code JRootPane} we're providing the look and
* feel for.
*/
private JRootPane getRootPane() {
return root;
}
/**
- * Invoked when a property changes. <code>MetalRootPaneUI</code> is
+ * Invoked when a property changes. {@code MetalRootPaneUI} is
* primarily interested in events originating from the
- * <code>JRootPane</code> it has been installed on identifying the
- * property <code>windowDecorationStyle</code>. If the
- * <code>windowDecorationStyle</code> has changed to a value other
- * than <code>JRootPane.NONE</code>, this will add a <code>Component</code>
- * to the <code>JRootPane</code> to render the window decorations, as well
- * as installing a <code>Border</code> on the <code>JRootPane</code>.
- * On the other hand, if the <code>windowDecorationStyle</code> has
- * changed to <code>JRootPane.NONE</code>, this will remove the
- * <code>Component</code> that has been added to the <code>JRootPane</code>
+ * {@code JRootPane} it has been installed on identifying the
+ * property {@code windowDecorationStyle}. If the
+ * {@code windowDecorationStyle} has changed to a value other
+ * than {@code JRootPane.NONE}, this will add a {@code Component}
+ * to the {@code JRootPane} to render the window decorations, as well
+ * as installing a {@code Border} on the {@code JRootPane}.
+ * On the other hand, if the {@code windowDecorationStyle} has
+ * changed to {@code JRootPane.NONE}, this will remove the
+ * {@code Component} that has been added to the {@code JRootPane}
* as well resetting the Border to what it was before
- * <code>installUI</code> was invoked.
+ * {@code installUI} was invoked.
*
* @param e A PropertyChangeEvent object describing the event source
* and the property that has changed.
*/
public void propertyChange(PropertyChangeEvent e) {
@@ -928,12 +928,12 @@
}
}
}
/**
- * Returns the corner that contains the point <code>x</code>,
- * <code>y</code>, or -1 if the position doesn't match a corner.
+ * Returns the corner that contains the point {@code x},
+ * {@code y}, or -1 if the position doesn't match a corner.
*/
private int calculateCorner(Window w, int x, int y) {
Insets insets = w.getInsets();
int xPosition = calculatePosition(x - insets.left,
w.getWidth() - insets.left - insets.right);
@@ -956,12 +956,12 @@
}
return cursorMapping[corner];
}
/**
- * Returns an integer indicating the position of <code>spot</code>
- * in <code>width</code>. The return value will be:
+ * Returns an integer indicating the position of {@code spot}
+ * in {@code width}. The return value will be:
* 0 if < BORDER_DRAG_THICKNESS
* 1 if < CORNER_DRAG_WIDTH
* 2 if >= CORNER_DRAG_WIDTH && < width - BORDER_DRAG_THICKNESS
* 3 if >= width - CORNER_DRAG_WIDTH
* 4 if >= width - BORDER_DRAG_THICKNESS
< prev index next >