diff --git a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
index 58d61dc909a..c29f69a1765 100644
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java
@@ -24,7 +24,6 @@
*/
package com.sun.java.swing.plaf.gtk;
-import sun.swing.plaf.synth.SynthUI;
import sun.awt.UNIXToolkit;
import javax.swing.plaf.synth.*;
diff --git a/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java b/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java
index 6bcf7e6966c..087e9760177 100644
--- a/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java
@@ -60,13 +60,13 @@ public abstract class ComponentUI {
}
/**
- * Configures the specified component appropriate for the look and feel.
+ * Configures the specified component appropriately for the look and feel.
* This method is invoked when the ComponentUI
instance is being installed
* as the UI delegate on the specified component. This method should
* completely configure the component for the look and feel,
* including the following:
*
ComponentUI.update
method when
* the specified component is being painted. Subclasses should override
* this method and use the specified Graphics
object to
@@ -134,15 +134,15 @@ public abstract class ComponentUI {
}
/**
- * Notifies this UI delegate that it's time to paint the specified
+ * Notifies this UI delegate that it is time to paint the specified
* component. This method is invoked by JComponent
* when the specified component is being painted.
- * By default this method will fill the specified component with
- * its background color (if its opaque
property is
- * true
) and then immediately call paint
.
- * In general this method need not be overridden by subclasses;
- * all look-and-feel rendering code should reside in the paint
- * method.
+ *
+ * By default this method fills the specified component with
+ * its background color if its {@code opaque} property is {@code true},
+ * and then immediately calls {@code paint}. In general this method need
+ * not be overridden by subclasses; all look-and-feel rendering code should
+ * reside in the {@code paint} method.
*
* @param g the Graphics
context in which to paint
* @param c the component being painted;
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
index ded1d6a017d..22949be0580 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -24,14 +24,10 @@
*/
package javax.swing.plaf.basic;
-import javax.swing.*;
+import javax.swing.ComboBoxEditor;
+import javax.swing.JTextField;
import javax.swing.border.Border;
-
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
-
-import java.awt.*;
+import java.awt.Component;
import java.awt.event.*;
import java.lang.reflect.Method;
@@ -73,12 +69,17 @@ public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener {
* @param anObject the displayed value of the editor
*/
public void setItem(Object anObject) {
- if ( anObject != null ) {
- editor.setText(anObject.toString());
+ String text;
+ if ( anObject != null ) {
+ text = anObject.toString();
oldValue = anObject;
} else {
- editor.setText("");
+ text = "";
+ }
+ // workaround for 4530952
+ if (! text.equals(editor.getText())) {
+ editor.setText(text);
}
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java
index 3b2fa972e64..06de6fe44ea 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -30,7 +30,6 @@ import java.awt.event.*;
import javax.swing.*;
import javax.accessibility.*;
import javax.swing.plaf.*;
-import javax.swing.border.*;
import javax.swing.text.*;
import javax.swing.event.*;
import java.beans.PropertyChangeListener;
@@ -189,19 +188,20 @@ public class BasicComboBoxUI extends ComboBoxUI {
/**
* Indicates whether or not the combo box button should be square.
* If square, then the width and height are equal, and are both set to
- * the height of the combo (minus appropriate insets).
+ * the height of the combo minus appropriate insets.
+ *
+ * @since 1.7
*/
- private boolean squareButton = true;
+ protected boolean squareButton = true;
/**
- * Optional: if specified, these insets act as padding around the cell
- * renderer when laying out and painting the "selected" item in the
- * combo box. BasicComboBoxUI uses a single combo box renderer for rendering
- * both the main combo box item and also all the items in the dropdown
- * for the combo box. padding allows you to specify addition insets in
- * addition to those specified by the cell renderer.
+ * If specified, these insets act as padding around the cell renderer when
+ * laying out and painting the "selected" item in the combo box. These
+ * insets add to those specified by the cell renderer.
+ *
+ * @since 1.7
*/
- private Insets padding;
+ protected Insets padding;
// Used for calculating the default size.
private static ListCellRenderer getDefaultListCellRenderer() {
@@ -345,7 +345,7 @@ public class BasicComboBoxUI extends ComboBoxUI {
}
/**
- * Create and install the listeners for the combo box and its model.
+ * Creates and installs listeners for the combo box and its model.
* This method is called when the UI is installed.
*/
protected void installListeners() {
@@ -379,8 +379,8 @@ public class BasicComboBoxUI extends ComboBoxUI {
}
/**
- * Uninstalls the default colors, default font, default renderer, and default
- * editor into the JComboBox.
+ * Uninstalls the default colors, default font, default renderer,
+ * and default editor from the combo box.
*/
protected void uninstallDefaults() {
LookAndFeel.installColorsAndFont( comboBox,
@@ -391,7 +391,7 @@ public class BasicComboBoxUI extends ComboBoxUI {
}
/**
- * Remove the installed listeners from the combo box and its model.
+ * Removes the installed listeners from the combo box and its model.
* The number and types of listeners removed and in this method should be
* the same that was added in installListeners
*/
@@ -839,7 +839,7 @@ public class BasicComboBoxUI extends ComboBoxUI {
}
/**
- * Creates an button which will be used as the control to show or hide
+ * Creates a button which will be used as the control to show or hide
* the popup portion of the combo box.
*
* @return a button which represents the popup control
@@ -1392,12 +1392,17 @@ public class BasicComboBoxUI extends ComboBoxUI {
}
/**
- * This has been refactored out in hopes that it may be investigated and
- * simplified for the next major release. adding/removing
- * the component to the currentValuePane and changing the font may be
- * redundant operations.
+ * Returns the size a component would have if used as a cell renderer.
+ *
+ * @param comp a {@code Component} to check
+ * @return size of the component
+ * @since 1.7
*/
- private Dimension getSizeForComponent(Component comp) {
+ protected Dimension getSizeForComponent(Component comp) {
+ // This has been refactored out in hopes that it may be investigated and
+ // simplified for the next major release. adding/removing
+ // the component to the currentValuePane and changing the font may be
+ // redundant operations.
currentValuePane.add(comp);
comp.setFont(comboBox.getFont());
Dimension d = comp.getPreferredSize();
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java
index 2e663fb8449..c7a6bc33ce1 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java
@@ -141,11 +141,10 @@ public class BasicLabelUI extends LabelUI implements PropertyChangeListener
}
/**
- * Paint the label text in the foreground color, if the label
- * is opaque then paint the entire background with the background
- * color. The Label text is drawn by paintEnabledText() or
- * paintDisabledText(). The locations of the label parts are computed
- * by layoutCL.
+ * Paints the label text with the foreground color, if the label is opaque
+ * then paints the entire background with the background color. The Label
+ * text is drawn by {@link #paintEnabledText} or {@link #paintDisabledText}.
+ * The locations of the label parts are computed by {@link #layoutCL}.
*
* @see #paintEnabledText
* @see #paintDisabledText
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java
index 1d3ee7b3509..f28ff0445a8 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java
@@ -685,7 +685,7 @@ public class BasicListUI extends ListUI
/**
- * Create and install the listeners for the JList, its model, and its
+ * Creates and installs the listeners for the JList, its model, and its
* selectionModel. This method is called at installUI() time.
*
* @see #installUI
@@ -728,7 +728,7 @@ public class BasicListUI extends ListUI
/**
- * Remove the listeners for the JList, its model, and its
+ * Removes the listeners from the JList, its model, and its
* selectionModel. All of the listener fields, are reset to
* null here. This method is called at uninstallUI() time,
* it should be kept in sync with installListeners.
@@ -764,8 +764,8 @@ public class BasicListUI extends ListUI
/**
- * Initialize JList properties, e.g. font, foreground, and background,
- * and add the CellRendererPane. The font, foreground, and background
+ * Initializes list properties such as font, foreground, and background,
+ * and adds the CellRendererPane. The font, foreground, and background
* properties are only set if their current value is either null
* or a UIResource, other properties are set if the current
* value is null.
@@ -820,9 +820,9 @@ public class BasicListUI extends ListUI
/**
- * Set the JList properties that haven't been explicitly overridden to
- * null. A property is considered overridden if its current value
- * is not a UIResource.
+ * Sets the list properties that have not been explicitly overridden to
+ * {@code null}. A property is considered overridden if its current value
+ * is not a {@code UIResource}.
*
* @see #installDefaults
* @see #uninstallUI
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java
index 61c70c9bb0b..899c88bd428 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java
@@ -32,7 +32,6 @@ import java.beans.PropertyChangeListener;
import javax.swing.*;
import javax.swing.event.*;
-import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.text.View;
@@ -54,7 +53,12 @@ public class BasicMenuItemUI extends MenuItemUI
protected Color disabledForeground;
protected Color acceleratorForeground;
protected Color acceleratorSelectionForeground;
- private String acceleratorDelimiter;
+
+ /**
+ * Accelerator delimiter string, such as {@code '+'} in {@code 'Ctrl+C'}.
+ * @since 1.7
+ */
+ protected String acceleratorDelimiter;
protected int defaultTextIconGap;
protected Font acceleratorFont;
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
index b22a58795e6..2b006568f73 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -93,10 +93,13 @@ public class BasicScrollBarUI
* scrollbar. */
private boolean supportsAbsolutePositioning;
- /** Hint as to what width (when vertical) or height (when horizontal)
+ /**
+ * Hint as to what width (when vertical) or height (when horizontal)
* should be.
+ *
+ * @since 1.7
*/
- private int scrollBarWidth;
+ protected int scrollBarWidth;
private Handler handler;
@@ -117,18 +120,18 @@ public class BasicScrollBarUI
* number. If negative, then an overlap between the button and track will occur,
* which is useful for shaped buttons.
*
- * TODO This should be made protected in a feature release
+ * @since 1.7
*/
- private int incrGap;
+ protected int incrGap;
/**
* Distance between the decrement button and the track. This may be a negative
* number. If negative, then an overlap between the button and track will occur,
* which is useful for shaped buttons.
*
- * TODO This should be made protected in a feature release
+ * @since 1.7
*/
- private int decrGap;
+ protected int decrGap;
static void loadActionMap(LazyActionMap map) {
map.put(new Actions(Actions.POSITIVE_UNIT_INCREMENT));
@@ -586,7 +589,7 @@ public class BasicScrollBarUI
/**
- * Return the smallest acceptable size for the thumb. If the scrollbar
+ * Returns the smallest acceptable size for the thumb. If the scrollbar
* becomes so small that this size isn't available, the thumb will be
* hidden.
*
@@ -601,7 +604,7 @@ public class BasicScrollBarUI
}
/**
- * Return the largest acceptable size for the thumb. To create a fixed
+ * Returns the largest acceptable size for the thumb. To create a fixed
* size thumb one make this method and getMinimumThumbSize
* return the same value.
*
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
index 02bb547d318..8189567a855 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
@@ -1409,9 +1409,10 @@ public class BasicSliderUI extends SliderUI{
}
/**
- * Returns a value give a y position. If yPos is past the track at the top or the
- * bottom it will set the value to the min or max of the slider, depending if the
- * slider is inverted or not.
+ * Returns the value at the y position. If {@code yPos} is beyond the
+ * track at the the bottom or the top, this method sets the value to either
+ * the minimum or maximum value of the slider, depending on if the slider
+ * is inverted or not.
*/
public int valueForYPosition( int yPos ) {
int value;
@@ -1440,9 +1441,10 @@ public class BasicSliderUI extends SliderUI{
}
/**
- * Returns a value give an x position. If xPos is past the track at the left or the
- * right it will set the value to the min or max of the slider, depending if the
- * slider is inverted or not.
+ * Returns the value at the x position. If {@code xPos} is beyond the
+ * track at the left or the right, this method sets the value to either the
+ * minimum or maximum value of the slider, depending on if the slider is
+ * inverted or not.
*/
public int valueForXPosition( int xPos ) {
int value;
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
index 3a522317741..201c9e9313d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -268,7 +268,7 @@ public class BasicSpinnerUI extends SpinnerUI
}
/**
- * Create a LayoutManager
that manages the editor
,
+ * Creates a LayoutManager
that manages the editor
,
* nextButton
, and previousButton
* children of the JSpinner. These three children must be
* added with a constraint that identifies their role:
@@ -286,7 +286,7 @@ public class BasicSpinnerUI extends SpinnerUI
/**
- * Create a PropertyChangeListener
that can be
+ * Creates a PropertyChangeListener
that can be
* added to the JSpinner itself. Typically, this listener
* will call replaceEditor when the "editor" property changes,
* since it's the SpinnerUI's
responsibility to
@@ -302,16 +302,13 @@ public class BasicSpinnerUI extends SpinnerUI
/**
- * Create a component that will replace the spinner models value
- * with the object returned by spinner.getPreviousValue
.
- * By default the previousButton
is a JButton. This
- * method invokes installPreviousButtonListeners
to
- * install the necessary listeners to update the JSpinner
's
- * model in response to a user gesture. If a previousButton isn't needed
- * (in a subclass) then override this method to return null.
+ * Creates a decrement button, i.e. component that replaces the spinner
+ * value with the object returned by spinner.getPreviousValue
.
+ * By default the previousButton
is a {@code JButton}. If the
+ * decrement button is not needed this method should return {@code null}.
*
- * @return a component that will replace the spinners model with the
- * next value in the sequence, or null
+ * @return a component that will replace the spinner's value with the
+ * previous value in the sequence, or {@code null}
* @see #installUI
* @see #createNextButton
* @see #installPreviousButtonListeners
@@ -325,15 +322,13 @@ public class BasicSpinnerUI extends SpinnerUI
/**
- * Create a component that will replace the spinner models value
- * with the object returned by spinner.getNextValue
.
- * By default the nextButton
is a JButton
- * who's ActionListener
updates it's JSpinner
- * ancestors model. If a nextButton isn't needed (in a subclass)
- * then override this method to return null.
+ * Creates an increment button, i.e. component that replaces the spinner
+ * value with the object returned by spinner.getNextValue
.
+ * By default the nextButton
is a {@code JButton}. If the
+ * increment button is not needed this method should return {@code null}.
*
- * @return a component that will replace the spinners model with the
- * next value in the sequence, or null
+ * @return a component that will replace the spinner's value with the
+ * next value in the sequence, or {@code null}
* @see #installUI
* @see #createPreviousButton
* @see #installNextButtonListeners
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java
index 0be46948712..9d15ba91850 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java
@@ -829,7 +829,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
/**
* Returns the default non continuous layout divider, which is an
- * instanceof Canvas that fills the background in dark gray.
+ * instance of {@code Canvas} that fills in the background with dark gray.
*/
protected Component createDefaultNonContinuousLayoutDivider() {
return new Canvas() {
@@ -1041,11 +1041,11 @@ public class BasicSplitPaneUI extends SplitPaneUI
/**
- * Messaged after the JSplitPane the receiver is providing the look
- * and feel for paints its children.
+ * Called when the specified split pane has finished painting
+ * its children.
*/
- public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
- if(jc == splitPane && getLastDragLocation() != -1 &&
+ public void finishedPaintingChildren(JSplitPane sp, Graphics g) {
+ if(sp == splitPane && getLastDragLocation() != -1 &&
!isContinuousLayout() && !draggingHW) {
Dimension size = splitPane.getSize();
@@ -1062,7 +1062,7 @@ public class BasicSplitPaneUI extends SplitPaneUI
/**
- * Messaged to paint the look and feel.
+ * @inheritDoc
*/
public void paint(Graphics g, JComponent jc) {
if (!painted && splitPane.getDividerLocation()<0) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
index de4700faf06..a29a7fb1314 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
@@ -306,7 +306,7 @@ public class BasicTableHeaderUI extends TableHeaderUI {
}
/**
- * Initialize JTableHeader properties, e.g. font, foreground, and background.
+ * Initializes JTableHeader properties such as font, foreground, and background.
* The font, foreground, and background properties are only set if their
* current value is either null or a UIResource, other properties are set
* if the current value is null.
@@ -403,9 +403,9 @@ public class BasicTableHeaderUI extends TableHeaderUI {
}
/**
- * This method gets called every time the rollover column in the table
- * header is updated. Every look and feel supporting rollover effect
- * in table header should override this method and repaint the header.
+ * This method gets called every time when a rollover column in the table
+ * header is updated. Every look and feel that supports a rollover effect
+ * in a table header should override this method and repaint the header.
*
* @param oldColumn the index of the previous rollover column or -1 if the
* mouse was not over a column
@@ -736,7 +736,6 @@ public class BasicTableHeaderUI extends TableHeaderUI {
}
private Dimension createHeaderSize(long width) {
- TableColumnModel columnModel = header.getColumnModel();
// None of the callers include the intercell spacing, do it here.
if (width > Integer.MAX_VALUE) {
width = Integer.MAX_VALUE;
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
index cef9166355f..0a035fc4636 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java
@@ -37,6 +37,7 @@ import javax.swing.text.*;
import javax.swing.event.*;
import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
+import javax.swing.plaf.synth.SynthUI;
import sun.swing.DefaultLookup;
import sun.awt.AppContext;
import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag;
@@ -221,8 +222,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
// is ==, which is the case for the windows look and feel.
// Until an appropriate solution is found, the code is being
// reverted to what it was before the original fix.
- if (this instanceof sun.swing.plaf.synth.SynthUI ||
- (c instanceof JTextArea)) {
+ if (this instanceof SynthUI || (c instanceof JTextArea)) {
return;
}
Color background = c.getBackground();
@@ -289,7 +289,7 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
protected abstract String getPropertyPrefix();
/**
- * Initializes component properties, e.g. font, foreground,
+ * Initializes component properties, such as font, foreground,
* background, caret color, selection color, selected text color,
* disabled text color, and border color. The font, foreground, and
* background properties are only set if their current value is either null
@@ -377,9 +377,9 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
}
/**
- * Sets the component properties that haven't been explicitly overridden to
- * null. A property is considered overridden if its current value
- * is not a UIResource.
+ * Sets the component properties that have not been explicitly overridden
+ * to {@code null}. A property is considered overridden if its current
+ * value is not a {@code UIResource}.
*
* @see #installDefaults
* @see #uninstallUI
@@ -756,18 +756,18 @@ public abstract class BasicTextUI extends TextUI implements ViewFactory {
* things.
*
- * NOTE: Superclass is also not thread-safe in
- * it's rendering of the background, although that's not
- * an issue with the default rendering.
+ * NOTE: NOTE: Superclass is also not thread-safe in its
+ * rendering of the background, although that is not an issue with the
+ * default rendering.
*/
public void update(Graphics g, JComponent c) {
paint(g, c);
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java
index 0eafa7e3b6b..dd29df81b68 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -669,7 +669,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
/**
* Sets the border of the component to have a rollover border which
- * was created by createRolloverBorder
.
+ * was created by the {@link #createRolloverBorder} method.
*
* @param c component which will have a rollover border installed
* @see #createRolloverBorder
@@ -709,7 +709,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
/**
* Sets the border of the component to have a non-rollover border which
- * was created by createNonRolloverBorder
.
+ * was created by the {@link #createNonRolloverBorder} method.
*
* @param c component which will have a non-rollover border installed
* @see #createNonRolloverBorder
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
index 22fa61f00dc..0679db798f7 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
@@ -30,16 +30,12 @@ import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.datatransfer.*;
-import java.awt.dnd.*;
import java.beans.*;
-import java.io.*;
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.TooManyListenersException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.TreeUI;
@@ -1244,11 +1240,26 @@ public class BasicTreeUI extends TreeUI
drawingCache.clear();
}
- private boolean isDropLine(JTree.DropLocation loc) {
+ /**
+ * Tells if a {@code DropLocation} should be indicated by a line between
+ * nodes. This is meant for {@code javax.swing.DropMode.INSERT} and
+ * {@code javax.swing.DropMode.ON_OR_INSERT} drop modes.
+ *
+ * @param loc a {@code DropLocation}
+ * @return {@code true} if the drop location should be shown as a line
+ * @since 1.7
+ */
+ protected boolean isDropLine(JTree.DropLocation loc) {
return loc != null && loc.getPath() != null && loc.getChildIndex() != -1;
}
- private void paintDropLine(Graphics g) {
+ /**
+ * Paints the drop line.
+ *
+ * @param g {@code Graphics} object to draw on
+ * @since 1.7
+ */
+ protected void paintDropLine(Graphics g) {
JTree.DropLocation loc = tree.getDropLocation();
if (!isDropLine(loc)) {
return;
@@ -1262,7 +1273,14 @@ public class BasicTreeUI extends TreeUI
}
}
- private Rectangle getDropLineRect(JTree.DropLocation loc) {
+ /**
+ * Returns a ubounding box for the drop line.
+ *
+ * @param loc a {@code DropLocation}
+ * @return bounding box for the drop line
+ * @since 1.7
+ */
+ protected Rectangle getDropLineRect(JTree.DropLocation loc) {
Rectangle rect;
TreePath path = loc.getPath();
int index = loc.getChildIndex();
@@ -1684,7 +1702,7 @@ public class BasicTreeUI extends TreeUI
treeState.setExpandedState(path, true);
}
}
- updateLeadRow();
+ updateLeadSelectionRow();
updateSize();
}
}
@@ -2425,11 +2443,21 @@ public class BasicTreeUI extends TreeUI
return tree.getLeadSelectionPath();
}
- private void updateLeadRow() {
+ /**
+ * Updates the lead row of the selection.
+ * @since 1.7
+ */
+ protected void updateLeadSelectionRow() {
leadRow = getRowForPath(tree, getLeadSelectionPath());
}
- private int getLeadSelectionRow() {
+ /**
+ * Returns the lead row of the selection.
+ *
+ * @return selection lead row
+ * @since 1.7
+ */
+ protected int getLeadSelectionRow() {
return leadRow;
}
@@ -3345,7 +3373,7 @@ public class BasicTreeUI extends TreeUI
if (changeName == JTree.LEAD_SELECTION_PATH_PROPERTY) {
if (!ignoreLAChange) {
- updateLeadRow();
+ updateLeadSelectionRow();
repaintPath((TreePath)event.getOldValue());
repaintPath((TreePath)event.getNewValue());
}
@@ -3763,7 +3791,7 @@ public class BasicTreeUI extends TreeUI
completeEditing();
if(path != null && tree.isVisible(path)) {
treeState.setExpandedState(path, false);
- updateLeadRow();
+ updateLeadSelectionRow();
updateSize();
}
}
@@ -3823,7 +3851,7 @@ public class BasicTreeUI extends TreeUI
if(treeState != null && e != null) {
treeState.treeNodesInserted(e);
- updateLeadRow();
+ updateLeadSelectionRow();
TreePath path = e.getTreePath();
@@ -3848,7 +3876,7 @@ public class BasicTreeUI extends TreeUI
if(treeState != null && e != null) {
treeState.treeNodesRemoved(e);
- updateLeadRow();
+ updateLeadSelectionRow();
TreePath path = e.getTreePath();
@@ -3862,7 +3890,7 @@ public class BasicTreeUI extends TreeUI
if(treeState != null && e != null) {
treeState.treeStructureChanged(e);
- updateLeadRow();
+ updateLeadSelectionRow();
TreePath pPath = e.getTreePath();
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java
index 5acae97eded..f0e925876e2 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java
@@ -34,7 +34,7 @@ import java.awt.Dimension;
/**
* The default layout manager for Popup menus and menubars. This
* class is an extension of BoxLayout which adds the UIResource tag
- * so that plauggable L&Fs can distinguish it from user-installed
+ * so that pluggable L&Fs can distinguish it from user-installed
* layout managers on menus.
*
* @author Georges Saab
diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java
index 3f100bc811b..4062678fb67 100644
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java
@@ -257,12 +257,40 @@ public class NimbusLookAndFeel extends SynthLookAndFeel {
/**
* @inheritDoc
- * @return true
+ * @return {@code true}
*/
@Override public boolean shouldUpdateStyleOnAncestorChanged() {
return true;
}
+ /**
+ * @inheritDoc
+ *
+ *
Overridden to return {@code true} when one of the following + * properties change: + *
Registers a third party component with the NimbusLookAndFeel.
* diff --git a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html index 4453cc163fe..bac256c2667 100644 --- a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html +++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html @@ -88,12 +88,11 @@ encouraged.Note:
Most of the Swing API is not thread safe.
For details, see
-Threads and Swing,
+Concurrency in Swing,
a section in
The Java Tutorial.
+ target="_top">The Java Tutorial.
@since 1.7
@serial exclude
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthBorder.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthBorder.java
index 0d3fc851f05..96b7c23c02c 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthBorder.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthBorder.java
@@ -29,7 +29,6 @@ import javax.swing.*;
import javax.swing.text.JTextComponent;
import javax.swing.border.*;
import javax.swing.plaf.UIResource;
-import sun.swing.plaf.synth.SynthUI;
/**
* SynthBorder is a border that delegates to a Painter. The Insets
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
index c395f54eb41..99372a9e28d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java
@@ -25,40 +25,49 @@
package javax.swing.plaf.synth;
-import java.awt.*;
-import java.awt.event.*;
-import java.io.Serializable;
import javax.swing.*;
-import javax.swing.border.*;
import java.awt.*;
-import java.awt.event.*;
import java.beans.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicButtonUI;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.text.View;
-import sun.swing.plaf.synth.SynthUI;
-import sun.swing.plaf.synth.DefaultSynthStyle;
/**
- * Synth's ButtonUI implementation.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JButton}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthButtonUI extends BasicButtonUI implements
+public class SynthButtonUI extends BasicButtonUI implements
PropertyChangeListener, SynthUI {
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthButtonUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults(AbstractButton b) {
updateStyle(b);
LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners(AbstractButton b) {
super.installListeners(b);
b.addPropertyChangeListener(this);
@@ -99,11 +108,19 @@ class SynthButtonUI extends BasicButtonUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners(AbstractButton b) {
super.uninstallListeners(b);
b.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults(AbstractButton b) {
SynthContext context = getContext(b, ENABLED);
@@ -112,20 +129,20 @@ class SynthButtonUI extends BasicButtonUI implements
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
SynthContext getContext(JComponent c, int state) {
- Region region = getRegion(c);
+ Region region = SynthLookAndFeel.getRegion(c);
return SynthContext.getContext(SynthContext.class, c, region,
style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
/**
* Returns the current state of the passed in
- * This method is called by Looks up the {@code selectedTabPadInsets} property from the Style,
+ * which represents additional insets for the selected tab.
*
* @author Scott Violet
+ * @since 1.7
*/
-/**
- * Looks up 'selectedTabPadInsets' from the Style, which will be additional
- * insets for the selected tab.
- */
-class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyChangeListener {
+public class SynthTabbedPaneUI extends BasicTabbedPaneUI
+ implements PropertyChangeListener, SynthUI {
+
/**
* If non-zero, tabOverlap indicates the amount that the tab bounds
* should be altered such that they would overlap with a tab on either the
@@ -103,11 +105,17 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
private boolean selectedTabIsPressed = false;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthTabbedPaneUI();
}
- SynthTabbedPaneUI() {
+ private SynthTabbedPaneUI() {
textRect = new Rectangle();
iconRect = new Rectangle();
}
@@ -116,6 +124,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
updateStyle(tabPane);
}
@@ -175,16 +187,28 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
tabContentStyle.getInsets(tabContentContext, null);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
tabPane.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
tabPane.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(tabPane, ENABLED);
style.uninstallDefaults(context);
@@ -207,19 +231,19 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
tabContentStyle = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
- public SynthContext getContext(JComponent c, int state) {
+ private SynthContext getContext(JComponent c, int state) {
return SynthContext.getContext(SynthContext.class, c,
SynthLookAndFeel.getRegion(c),style, state);
}
- public SynthContext getContext(JComponent c, Region subregion) {
- return getContext(c, subregion, getComponentState(c));
- }
-
private SynthContext getContext(JComponent c, Region subregion, int state){
SynthStyle style = null;
Class klass = SynthContext.class;
@@ -236,14 +260,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return SynthContext.getContext(klass, c, subregion, style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
protected JButton createScrollButton(int direction) {
// added for Nimbus LAF so that it can use the basic arrow buttons
// UIManager is queried directly here because this is called before
@@ -256,6 +276,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return new SynthScrollableTabButton(direction);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle(tabPane);
@@ -313,6 +337,9 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
};
}
+ /**
+ * @inheritDoc
+ */
@Override
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) {
if (nudgeSelectedLabel) {
@@ -322,6 +349,9 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) {
if (nudgeSelectedLabel) {
@@ -331,6 +361,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -341,6 +375,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected int getBaseline(int tab) {
if (tabPane.getTabComponentAt(tab) != null ||
getTextViewForTab(tab) != null) {
@@ -361,11 +399,19 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return textRect.y + metrics.getAscent() + getBaselineOffset();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTabbedPaneBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -373,6 +419,12 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
int selectedIndex = tabPane.getSelectedIndex();
int tabPlacement = tabPane.getTabPlacement();
@@ -426,6 +478,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void paintTabArea(Graphics g, int tabPlacement,
int selectedIndex) {
// This can be invoked from ScrollabeTabPanel
@@ -439,7 +495,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
new Rectangle(x, y, width, height));
}
- protected void paintTabArea(SynthContext ss, Graphics g,
+ private void paintTabArea(SynthContext ss, Graphics g,
int tabPlacement, int selectedIndex,
Rectangle tabAreaBounds) {
Rectangle clipRect = g.getClipBounds();
@@ -493,6 +549,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void setRolloverTab(int index) {
int oldRolloverTab = getRolloverTab();
super.setRolloverTab(index);
@@ -519,7 +579,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
}
- protected void paintTab(SynthContext ss, Graphics g,
+ private void paintTab(SynthContext ss, Graphics g,
int tabPlacement, Rectangle[] rects, int tabIndex,
Rectangle iconRect, Rectangle textRect) {
Rectangle tabRect = rects[tabIndex];
@@ -587,7 +647,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
}
- protected void layoutLabel(SynthContext ss, int tabPlacement,
+ private void layoutLabel(SynthContext ss, int tabPlacement,
FontMetrics metrics, int tabIndex,
String title, Icon icon,
Rectangle tabRect, Rectangle iconRect,
@@ -614,7 +674,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
textRect.y += yNudge;
}
- protected void paintText(SynthContext ss,
+ private void paintText(SynthContext ss,
Graphics g, int tabPlacement,
Font font, FontMetrics metrics, int tabIndex,
String title, Rectangle textRect,
@@ -636,7 +696,7 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
- protected void paintContentBorder(SynthContext ss, Graphics g,
+ private void paintContentBorder(SynthContext ss, Graphics g,
int tabPlacement, int selectedIndex) {
int width = tabPane.getWidth();
int height = tabPane.getHeight();
@@ -683,7 +743,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
}
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
protected int calculateMaxTabHeight(int tabPlacement) {
FontMetrics metrics = getFontMetrics(tabContext.getStyle().getFont(
tabContext));
@@ -696,6 +759,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return result;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected int calculateTabWidth(int tabPlacement, int tabIndex,
FontMetrics metrics) {
Icon icon = getIconForTab(tabIndex);
@@ -723,6 +790,10 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return width;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected int calculateMaxTabWidth(int tabPlacement) {
FontMetrics metrics = getFontMetrics(tabContext.getStyle().getFont(
tabContext));
@@ -735,17 +806,25 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
return result;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected Insets getTabInsets(int tabPlacement, int tabIndex) {
updateTabContext(tabIndex, false, false, false,
(getFocusIndex() == tabIndex));
return tabInsets;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected FontMetrics getFontMetrics() {
return getFontMetrics(tabContext.getStyle().getFont(tabContext));
}
- protected FontMetrics getFontMetrics(Font font) {
+ private FontMetrics getFontMetrics(Font font) {
return tabPane.getFontMetrics(font);
}
@@ -787,7 +866,8 @@ class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyCh
* Overridden to create a TabbedPaneLayout subclass which takes into
* account tabOverlap.
*/
- @Override protected LayoutManager createLayoutManager() {
+ @Override
+ protected LayoutManager createLayoutManager() {
if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
return super.createLayoutManager();
} else { /* WRAP_TAB_LAYOUT */
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java
index b37d9f1262d..86b50eb935b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java
@@ -32,19 +32,18 @@ import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.table.*;
-
-import sun.swing.DefaultLookup;
-import sun.swing.plaf.synth.*;
import sun.swing.table.*;
/**
- * SynthTableHeaderUI implementation
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.table.JTableHeader}.
*
* @author Alan Chung
* @author Philip Milne
+ * @since 1.7
*/
-class SynthTableHeaderUI extends BasicTableHeaderUI implements
- PropertyChangeListener, SynthUI {
+public class SynthTableHeaderUI extends BasicTableHeaderUI
+ implements PropertyChangeListener, SynthUI {
//
// Instance Variables
@@ -54,10 +53,20 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param h component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent h) {
return new SynthTableHeaderUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
prevRenderer = header.getDefaultRenderer();
if (prevRenderer instanceof UIResource) {
@@ -79,11 +88,19 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
header.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
if (header.getDefaultRenderer() instanceof HeaderRenderer) {
header.setDefaultRenderer(prevRenderer);
@@ -96,11 +113,19 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
header.removePropertyChangeListener(this);
super.uninstallListeners();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -111,6 +136,10 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -118,10 +147,20 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
super.paint(g, context.getComponent());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTableHeaderBorder(context, g, x, y, w, h);
@@ -129,8 +168,12 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
//
// SynthUI
//
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -138,26 +181,25 @@ class SynthTableHeaderUI extends BasicTableHeaderUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
- updateStyle((JTableHeader)evt.getSource());
- }
- }
-
+ /**
+ * @inheritDoc
+ */
@Override
protected void rolloverColumnUpdated(int oldColumn, int newColumn) {
header.repaint(header.getHeaderRect(oldColumn));
header.repaint(header.getHeaderRect(newColumn));
}
+ /**
+ * @inheritDoc
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
+ updateStyle((JTableHeader)evt.getSource());
+ }
+ }
+
private class HeaderRenderer extends DefaultTableCellHeaderRenderer {
HeaderRenderer() {
setHorizontalAlignment(JLabel.LEADING);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
index dcd6b6275bf..43e8150dd22 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java
@@ -54,15 +54,15 @@ import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
-import sun.swing.plaf.synth.SynthUI;
-
/**
- * SynthTableUI implementation
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JTable}.
*
* @author Philip Milne
+ * @since 1.7
*/
-class SynthTableUI extends BasicTableUI implements SynthUI,
- PropertyChangeListener {
+public class SynthTableUI extends BasicTableUI
+ implements SynthUI, PropertyChangeListener {
//
// Instance Variables
//
@@ -88,18 +88,25 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
// The installation/uninstall procedures and support
//
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthTableUI();
}
/**
- * Initialize JTable properties, e.g. font, foreground, and background.
+ * Initializes JTable properties, such as font, foreground, and background.
* The font, foreground, and background properties are only set if their
* current value is either null or a UIResource, other properties are set
* if the current value is null.
*
* @see #installUI
*/
+ @Override
protected void installDefaults() {
dateRenderer = installRendererIfPossible(Date.class, null);
numberRenderer = installRendererIfPossible(Number.class, null);
@@ -189,11 +196,16 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
/**
* Attaches listeners to the JTable.
*/
+ @Override
protected void installListeners() {
super.installListeners();
table.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
table.setDefaultRenderer(Date.class, dateRenderer);
table.setDefaultRenderer(Number.class, numberRenderer);
@@ -213,6 +225,10 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
table.removePropertyChangeListener(this);
super.uninstallListeners();
@@ -221,8 +237,13 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
//
// SynthUI
//
+
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -230,18 +251,14 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
//
// Paint methods and support
//
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -252,11 +269,19 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTableBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -264,6 +289,12 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
Rectangle clip = g.getClipBounds();
@@ -647,6 +678,10 @@ class SynthTableUI extends BasicTableUI implements SynthUI,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (SynthLookAndFeel.shouldUpdateStyle(event)) {
updateStyle((JTable)event.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java
index 01947655afe..90c9a7e0553 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java
@@ -33,7 +33,6 @@ import java.awt.*;
import java.awt.event.FocusListener;
import java.awt.event.FocusEvent;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
/**
* Provides the look and feel for a plain text editor in the
@@ -50,40 +49,42 @@ import sun.swing.plaf.synth.SynthUI;
* Please see {@link java.beans.XMLEncoder}.
*
* @author Shannon Hickey
+ * @since 1.7
*/
-class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener {
+public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
+ private Handler handler = new Handler();
private SynthStyle style;
/**
- * Creates a UI for a JTextArea.
+ * Creates a UI object for a JTextArea.
*
* @param ta a text area
- * @return the UI
+ * @return the UI object
*/
public static ComponentUI createUI(JComponent ta) {
return new SynthTextAreaUI();
}
- public void focusGained(FocusEvent e) {
- getComponent().repaint();
- }
-
- public void focusLost(FocusEvent e) {
- getComponent().repaint();
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
// Installs the text cursor on the component
super.installDefaults();
updateStyle(getComponent());
- getComponent().addFocusListener(this);
+ getComponent().addFocusListener(handler);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(getComponent(), ENABLED);
getComponent().putClientProperty("caretAspectRatio", null);
- getComponent().removeFocusListener(this);
+ getComponent().removeFocusListener(handler);
style.uninstallDefaults(context);
context.dispose();
@@ -91,10 +92,6 @@ class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener
super.uninstallDefaults();
}
- public void installUI(JComponent c) {
- super.installUI(c);
- }
-
private void updateStyle(JTextComponent comp) {
SynthContext context = getContext(comp, ENABLED);
SynthStyle oldStyle = style;
@@ -112,8 +109,12 @@ class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -121,10 +122,10 @@ class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener
SynthLookAndFeel.getRegion(c), style, state);
}
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -135,14 +136,30 @@ class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
super.paint(g, getComponent());
}
+ /**
+ * @inheritDoc
+ *
+ * Overridden to do nothing.
+ */
+ @Override
protected void paintBackground(Graphics g) {
// Overriden to do nothing, all our painting is done from update/paint.
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTextAreaBorder(context, g, x, y, w, h);
@@ -158,10 +175,21 @@ class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener
*
* @param evt the property change event
*/
+ @Override
protected void propertyChange(PropertyChangeEvent evt) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
updateStyle((JTextComponent)evt.getSource());
}
super.propertyChange(evt);
}
+
+ private final class Handler implements FocusListener {
+ public void focusGained(FocusEvent e) {
+ getComponent().repaint();
+ }
+
+ public void focusLost(FocusEvent e) {
+ getComponent().repaint();
+ }
+ }
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java
index 225a965d874..c86b4a9dcca 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java
@@ -27,7 +27,6 @@ package javax.swing.plaf.synth;
import javax.swing.*;
import javax.swing.text.*;
-import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicTextFieldUI;
import java.awt.*;
@@ -35,11 +34,9 @@ import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Basis of a look and feel for a JTextField in the Synth
- * look and feel.
+ * Provides the Synth L&F UI delegate for {@link javax.swing.JTextField}.
*
* Warning:
* Serialized objects of this class will not be compatible with
@@ -51,27 +48,22 @@ import sun.swing.plaf.synth.SynthUI;
* Please see {@link java.beans.XMLEncoder}.
*
* @author Shannon Hickey
+ * @since 1.7
*/
-class SynthTextFieldUI
- extends BasicTextFieldUI
- implements SynthUI, FocusListener
-{
+public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI {
+ private Handler handler = new Handler();
private SynthStyle style;
/**
* Creates a UI for a JTextField.
*
* @param c the text field
- * @return the UI
+ * @return the UI object
*/
public static ComponentUI createUI(JComponent c) {
return new SynthTextFieldUI();
}
- public SynthTextFieldUI() {
- super();
- }
-
private void updateStyle(JTextComponent comp) {
SynthContext context = getContext(comp, ENABLED);
SynthStyle oldStyle = style;
@@ -155,8 +147,12 @@ class SynthTextFieldUI
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -164,10 +160,10 @@ class SynthTextFieldUI
SynthLookAndFeel.getRegion(c), style, state);
}
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -178,12 +174,15 @@ class SynthTextFieldUI
}
/**
- * Paints the interface. This is routed to the
- * paintSafely method under the guarantee that
- * the model won't change from the view of this thread
- * while it's rendering (if the associated model is
- * derived from AbstractDocument). This enables the
+ * Paints the specified component.
+ * This is routed to the {@link #paintSafely} method under
+ * the guarantee that the model does not change from the view of this
+ * thread while it is rendering (if the associated model is
+ * derived from {@code AbstractDocument}). This enables the
* model to potentially be updated asynchronously.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
*/
protected void paint(SynthContext context, Graphics g) {
super.paint(g, getComponent());
@@ -194,11 +193,20 @@ class SynthTextFieldUI
c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTextFieldBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ * Overridden to do nothing.
+ */
+ @Override
protected void paintBackground(Graphics g) {
// Overriden to do nothing, all our painting is done from update/paint.
}
@@ -214,6 +222,7 @@ class SynthTextFieldUI
*
* @param evt the property change event
*/
+ @Override
protected void propertyChange(PropertyChangeEvent evt) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
updateStyle((JTextComponent)evt.getSource());
@@ -221,26 +230,26 @@ class SynthTextFieldUI
super.propertyChange(evt);
}
- public void focusGained(FocusEvent e) {
- getComponent().repaint();
- }
-
- public void focusLost(FocusEvent e) {
- getComponent().repaint();
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
// Installs the text cursor on the component
super.installDefaults();
updateStyle(getComponent());
- getComponent().addFocusListener(this);
+ getComponent().addFocusListener(handler);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(getComponent(), ENABLED);
getComponent().putClientProperty("caretAspectRatio", null);
- getComponent().removeFocusListener(this);
+ getComponent().removeFocusListener(handler);
style.uninstallDefaults(context);
context.dispose();
@@ -248,7 +257,13 @@ class SynthTextFieldUI
super.uninstallDefaults();
}
- public void installUI(JComponent c) {
- super.installUI(c);
+ private final class Handler implements FocusListener {
+ public void focusGained(FocusEvent e) {
+ getComponent().repaint();
+ }
+
+ public void focusLost(FocusEvent e) {
+ getComponent().repaint();
+ }
}
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java
index ad2e51b4d34..0cef82e2e7a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java
@@ -45,14 +45,15 @@ import java.awt.*;
* Please see {@link java.beans.XMLEncoder}.
*
* @author Shannon Hickey
+ * @since 1.7
*/
-class SynthTextPaneUI extends SynthEditorPaneUI {
+public class SynthTextPaneUI extends SynthEditorPaneUI {
/**
* Creates a UI for the JTextPane.
*
* @param c the JTextPane object
- * @return the UI
+ * @return the UI object
*/
public static ComponentUI createUI(JComponent c) {
return new SynthTextPaneUI();
@@ -65,10 +66,15 @@ class SynthTextPaneUI extends SynthEditorPaneUI {
*
* @return the name ("TextPane")
*/
+ @Override
protected String getPropertyPrefix() {
return "TextPane";
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void installUI(JComponent c) {
super.installUI(c);
updateForeground(c.getForeground());
@@ -86,6 +92,7 @@ class SynthTextPaneUI extends SynthEditorPaneUI {
*
* @param evt the property change event
*/
+ @Override
protected void propertyChange(PropertyChangeEvent evt) {
super.propertyChange(evt);
@@ -150,11 +157,16 @@ class SynthTextPaneUI extends SynthEditorPaneUI {
}
}
+ @Override
void paintBackground(SynthContext context, Graphics g, JComponent c) {
context.getPainter().paintTextPaneBackground(context, g, 0, 0,
c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTextPaneBorder(context, g, x, y, w, h);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java
index d4b22baaf2b..ede8113849d 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java
@@ -31,18 +31,30 @@ import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
/**
- * Synth's ToggleButtonUI.
- *
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToggleButton}.
+ *
* @author Jeff Dinkins
+ * @since 1.7
*/
-class SynthToggleButtonUI extends SynthButtonUI {
+public class SynthToggleButtonUI extends SynthButtonUI {
// ********************************
// Create PLAF
// ********************************
+
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param b component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent b) {
return new SynthToggleButtonUI();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected String getPropertyPrefix() {
return "ToggleButton.";
@@ -57,6 +69,9 @@ class SynthToggleButtonUI extends SynthButtonUI {
}
}
+ /**
+ * @inheritDoc
+ */
@Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
index c49536c34e7..66a72b1ee70 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java
@@ -42,39 +42,53 @@ import javax.swing.JToolBar;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicToolBarUI;
import sun.swing.plaf.synth.SynthIcon;
-import sun.swing.plaf.synth.SynthUI;
/**
- * A Synth L&F implementation of ToolBarUI. This implementation
- * is a "combined" view/controller.
- *
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToolBar}.
*
+ * @since 1.7
*/
-class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
- SynthUI {
- protected Icon handleIcon = null;
- protected Rectangle contentRect = new Rectangle();
+public class SynthToolBarUI extends BasicToolBarUI
+ implements PropertyChangeListener, SynthUI {
+ private Icon handleIcon = null;
+ private Rectangle contentRect = new Rectangle();
private SynthStyle style;
private SynthStyle contentStyle;
private SynthStyle dragWindowStyle;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthToolBarUI();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installDefaults() {
toolBar.setLayout(createLayout());
updateStyle(toolBar);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installListeners() {
super.installListeners();
toolBar.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallListeners() {
super.uninstallListeners();
@@ -106,6 +120,9 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallDefaults() {
SynthContext context = getContext(toolBar, ENABLED);
@@ -131,18 +148,33 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
toolBar.setLayout(null);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installComponents() {}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallComponents() {}
+ /**
+ * Creates a {@code LayoutManager} to use with the toolbar.
+ *
+ * @return a {@code LayoutManager} instance
+ */
protected LayoutManager createLayout() {
return new SynthToolBarLayoutManager();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -161,18 +193,13 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
private int getComponentState(JComponent c, Region region) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
@Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -185,6 +212,9 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
@Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -193,6 +223,10 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintToolBarBorder(context, g, x, y, w, h,
@@ -200,17 +234,32 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
}
// Overloaded to do nothing so we can share listeners.
+ /**
+ * @inheritDoc
+ */
@Override
protected void setBorderToNonRollover(Component c) {}
// Overloaded to do nothing so we can share listeners.
+ /**
+ * @inheritDoc
+ */
@Override
protected void setBorderToRollover(Component c) {}
// Overloaded to do nothing so we can share listeners.
+ /**
+ * @inheritDoc
+ */
@Override
protected void setBorderToNormal(Component c) {}
+ /**
+ * Paints the toolbar.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
if (handleIcon != null && toolBar.isFloatable()) {
int startX = toolBar.getComponentOrientation().isLeftToRight() ?
@@ -227,7 +276,14 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
subcontext.dispose();
}
- public void paintContent(SynthContext context, Graphics g,
+ /**
+ * Paints the toolbar content.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ * @param bounds bounding box for the toolbar
+ */
+ protected void paintContent(SynthContext context, Graphics g,
Rectangle bounds) {
SynthLookAndFeel.updateSubregion(context, g, bounds);
context.getPainter().paintToolBarContentBackground(context, g,
@@ -238,6 +294,9 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
toolBar.getOrientation());
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void paintDragWindow(Graphics g) {
int w = dragWindow.getWidth();
@@ -258,6 +317,10 @@ class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
// PropertyChangeListener
//
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JToolBar)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java
index b129f9bedff..df23bac7579 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java
@@ -34,23 +34,33 @@ import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.basic.BasicToolTipUI;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.View;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's ToolTipUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToolTip}.
*
* @author Joshua Outwater
+ * @since 1.7
*/
-class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
- SynthUI {
+public class SynthToolTipUI extends BasicToolTipUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
-
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthToolTipUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults(JComponent c) {
updateStyle(c);
}
@@ -61,6 +71,10 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults(JComponent c) {
SynthContext context = getContext(c, ENABLED);
style.uninstallDefaults(context);
@@ -68,14 +82,26 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners(JComponent c) {
c.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners(JComponent c) {
c.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -85,10 +111,6 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
JComponent comp = ((JToolTip)c).getComponent();
@@ -98,6 +120,10 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -108,11 +134,19 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintToolTipBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -120,9 +154,14 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
JToolTip tip = (JToolTip)context.getComponent();
- String tipText = tip.getToolTipText();
Insets insets = tip.getInsets();
View v = (View)tip.getClientProperty(BasicHTML.propertyKey);
@@ -140,6 +179,10 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getPreferredSize(JComponent c) {
SynthContext context = getContext(c);
Insets insets = c.getInsets();
@@ -164,6 +207,10 @@ class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
return prefSize;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JToolTip)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
index 47011a865d3..e81064408b8 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java
@@ -48,15 +48,16 @@ import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import sun.swing.plaf.synth.SynthIcon;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Skinnable TreeUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JTree}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
- SynthUI {
+public class SynthTreeUI extends BasicTreeUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
private SynthStyle cellStyle;
@@ -67,27 +68,33 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
private Object linesStyle;
- private int leadRow;
-
private int padding;
private boolean useTreeColors;
- private Icon expandedIconWrapper;
+ private Icon expandedIconWrapper = new ExpandedIconWrapper();
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param x component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent x) {
return new SynthTreeUI();
}
- SynthTreeUI() {
- expandedIconWrapper = new ExpandedIconWrapper();
- }
-
+ /**
+ * @inheritDoc
+ */
@Override
public Icon getExpandedIcon() {
return expandedIconWrapper;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installDefaults() {
updateStyle(tree);
@@ -148,15 +155,21 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installListeners() {
super.installListeners();
tree.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
@Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -164,14 +177,6 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JTree c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
private SynthContext getContext(JComponent c, Region region) {
return getContext(c, region, getComponentState(c, region));
}
@@ -187,6 +192,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
return ENABLED | SELECTED;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected TreeCellEditor createDefaultCellEditor() {
TreeCellRenderer renderer = tree.getCellRenderer();
@@ -202,11 +210,17 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
return editor;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected TreeCellRenderer createDefaultCellRenderer() {
return new SynthTreeCellRenderer();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallDefaults() {
SynthContext context = getContext(tree, ENABLED);
@@ -226,12 +240,18 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallListeners() {
super.uninstallListeners();
tree.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
@Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -243,11 +263,18 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTreeBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
@Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -256,14 +283,16 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
context.dispose();
}
- private void updateLeadRow() {
- leadRow = getRowForPath(tree, tree.getLeadSelectionPath());
- }
-
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
paintContext = context;
- updateLeadRow();
+ updateLeadSelectionRow();
Rectangle paintBounds = g.getClipBounds();
Insets insets = tree.getInsets();
@@ -288,7 +317,6 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
boolean isExpanded;
boolean hasBeenExpanded;
boolean isLeaf;
- Rectangle boundsBuffer = new Rectangle();
Rectangle rowBounds = new Rectangle(0, 0, tree.getWidth(),0);
Rectangle bounds;
TreePath path;
@@ -392,83 +420,6 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
rendererPane.removeAll();
}
- private boolean isDropLine(JTree.DropLocation loc) {
- return loc != null && loc.getPath() != null && loc.getChildIndex() != -1;
- }
-
- private void paintDropLine(Graphics g) {
- JTree.DropLocation loc = tree.getDropLocation();
- if (!isDropLine(loc)) {
- return;
- }
-
- Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
- if (c != null) {
- g.setColor(c);
- Rectangle rect = getDropLineRect(loc);
- g.fillRect(rect.x, rect.y, rect.width, rect.height);
- }
- }
-
- private Rectangle getDropLineRect(JTree.DropLocation loc) {
- Rectangle rect;
- TreePath path = loc.getPath();
- int index = loc.getChildIndex();
- boolean ltr = tree.getComponentOrientation().isLeftToRight();
-
- Insets insets = tree.getInsets();
-
- if (tree.getRowCount() == 0) {
- rect = new Rectangle(insets.left,
- insets.top,
- tree.getWidth() - insets.left - insets.right,
- 0);
- } else {
- int row = tree.getRowForPath(path);
- TreeModel model = getModel();
- Object root = model.getRoot();
-
- if (path.getLastPathComponent() == root
- && index >= model.getChildCount(root)) {
-
- rect = tree.getRowBounds(tree.getRowCount() - 1);
- rect.y = rect.y + rect.height;
- Rectangle xRect;
-
- if (!tree.isRootVisible()) {
- xRect = tree.getRowBounds(0);
- } else if (model.getChildCount(root) == 0){
- xRect = tree.getRowBounds(0);
- xRect.x += totalChildIndent;
- xRect.width -= totalChildIndent + totalChildIndent;
- } else {
- TreePath lastChildPath = path.pathByAddingChild(
- model.getChild(root, model.getChildCount(root) - 1));
- xRect = tree.getPathBounds(lastChildPath);
- }
-
- rect.x = xRect.x;
- rect.width = xRect.width;
- } else {
- rect = tree.getPathBounds(path.pathByAddingChild(
- model.getChild(path.getLastPathComponent(), index)));
- }
- }
-
- if (rect.y != 0) {
- rect.y--;
- }
-
- if (!ltr) {
- rect.x = rect.x + rect.width - 100;
- }
-
- rect.width = 100;
- rect.height = 2;
-
- return rect;
- }
-
private void configureRenderer(SynthContext context) {
TreeCellRenderer renderer = tree.getCellRenderer();
@@ -502,6 +453,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds,
@@ -516,6 +470,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void paintHorizontalLine(Graphics g, JComponent c, int y,
int left, int right) {
@@ -523,6 +480,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
paintContext, "Tree.horizontalLine", g, left, y, right, y, linesStyle);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds, Insets insets,
@@ -532,6 +492,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void paintVerticalLine(Graphics g, JComponent c, int x, int top,
int bottom) {
@@ -539,7 +502,7 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
paintContext, "Tree.verticalLine", g, x, top, x, bottom, linesStyle);
}
- protected void paintRow(TreeCellRenderer renderer,
+ private void paintRow(TreeCellRenderer renderer,
DefaultTreeCellRenderer dtcr, SynthContext treeContext,
SynthContext cellContext, Graphics g, Rectangle clipBounds,
Insets insets, Rectangle bounds, Rectangle rowBounds,
@@ -558,7 +521,7 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
state |= SELECTED;
}
- if (tree.isFocusOwner() && row == leadRow) {
+ if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
state |= FOCUSED;
}
@@ -583,7 +546,7 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
int leadIndex;
if (tree.hasFocus()) {
- leadIndex = leadRow;
+ leadIndex = getLeadSelectionRow();
}
else {
leadIndex = -1;
@@ -625,6 +588,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
paintContext.setComponentState(state);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void drawCentered(Component c, Graphics graphics, Icon icon,
int x, int y) {
@@ -636,6 +602,10 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
y - h/2, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent event) {
if (SynthLookAndFeel.shouldUpdateStyle(event)) {
updateStyle((JTree)event.getSource());
@@ -648,6 +618,24 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
+ protected void paintDropLine(Graphics g) {
+ JTree.DropLocation loc = tree.getDropLocation();
+ if (!isDropLine(loc)) {
+ return;
+ }
+
+ Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
+ if (c != null) {
+ g.setColor(c);
+ Rectangle rect = getDropLineRect(loc);
+ g.fillRect(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+
private void repaintDropLocation(JTree.DropLocation loc) {
if (loc == null) {
return;
@@ -670,6 +658,9 @@ class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected int getRowX(int row, int depth) {
return super.getRowX(row, depth) + padding;
diff --git a/jdk/src/share/classes/sun/swing/plaf/synth/SynthUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthUI.java
similarity index 86%
rename from jdk/src/share/classes/sun/swing/plaf/synth/SynthUI.java
rename to jdk/src/share/classes/javax/swing/plaf/synth/SynthUI.java
index 0d9875f550d..0c14950ba99 100644
--- a/jdk/src/share/classes/sun/swing/plaf/synth/SynthUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthUI.java
@@ -22,18 +22,19 @@
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
-package sun.swing.plaf.synth;
+package javax.swing.plaf.synth;
import java.awt.Graphics;
import javax.swing.JComponent;
-import javax.swing.plaf.synth.*;
/**
* SynthUI is used to fetch the SynthContext for a particular Component.
*
* @author Scott Violet
+ * @since 1.7
*/
public interface SynthUI extends SynthConstants {
+
/**
* Returns the Context for the specified component.
*
@@ -44,6 +45,13 @@ public interface SynthUI extends SynthConstants {
/**
* Paints the border.
+ *
+ * @param context a component context
+ * @param g {@code Graphics} to paint on
+ * @param x the X coordinate
+ * @param y the Y coordinate
+ * @param w width of the border
+ * @param h height of the border
*/
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java
index fcc1bb1b321..1e71e227d9a 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java
@@ -25,40 +25,57 @@
package javax.swing.plaf.synth;
-import java.awt.*;
import java.beans.*;
import javax.swing.*;
-import javax.swing.border.*;
import javax.swing.plaf.*;
import java.awt.*;
-import java.awt.event.*;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's ViewportUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JViewport}.
*
+ * @since 1.7
*/
-class SynthViewportUI extends ViewportUI implements
- PropertyChangeListener, SynthUI {
+public class SynthViewportUI extends ViewportUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthViewportUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void installUI(JComponent c) {
super.installUI(c);
installDefaults(c);
installListeners(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
uninstallListeners(c);
uninstallDefaults(c);
}
+ /**
+ * Installs defaults for a viewport.
+ *
+ * @param c a {@code JViewport} object
+ */
protected void installDefaults(JComponent c) {
updateStyle(c);
}
@@ -85,14 +102,29 @@ class SynthViewportUI extends ViewportUI implements
context.dispose();
}
+ /**
+ * Installs listeners into the viewport.
+ *
+ * @param c a {@code JViewport} object
+ */
protected void installListeners(JComponent c) {
c.addPropertyChangeListener(this);
}
+ /**
+ * Uninstalls listeners from the viewport.
+ *
+ * @param c a {@code JViewport} object
+ */
protected void uninstallListeners(JComponent c) {
c.removePropertyChangeListener(this);
}
+ /**
+ * Uninstalls defaults from a viewport.
+ *
+ * @param c a {@code JViewport} object
+ */
protected void uninstallDefaults(JComponent c) {
SynthContext context = getContext(c, ENABLED);
style.uninstallDefaults(context);
@@ -100,8 +132,12 @@ class SynthViewportUI extends ViewportUI implements
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -113,10 +149,10 @@ class SynthViewportUI extends ViewportUI implements
return SynthLookAndFeel.getRegion(c);
}
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -127,12 +163,20 @@ class SynthViewportUI extends ViewportUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
// This does nothing on purpose, JViewport doesn't allow a border
// and therefor this will NEVER be called.
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -140,9 +184,19 @@ class SynthViewportUI extends ViewportUI implements
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JComponent)e.getSource());
AbstractButton
.
*/
@@ -164,6 +181,10 @@ class SynthButtonUI extends BasicButtonUI implements
return state;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public int getBaseline(JComponent c, int width, int height) {
if (c == null) {
throw new NullPointerException("Component must be non-null");
@@ -215,6 +236,10 @@ class SynthButtonUI extends BasicButtonUI implements
// Paint Methods
// ********************************
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -224,6 +249,10 @@ class SynthButtonUI extends BasicButtonUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -231,6 +260,12 @@ class SynthButtonUI extends BasicButtonUI implements
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
AbstractButton b = (AbstractButton)context.getComponent();
@@ -253,19 +288,22 @@ class SynthButtonUI extends BasicButtonUI implements
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintButtonBorder(context, g, x, y, w, h);
}
/**
- * Returns the default icon. This should NOT callback
+ * Returns the default icon. This should not callback
* to the JComponent.
*
- * @param b AbstractButton the icon is associated with
+ * @param b button the icon is associated with
* @return default icon
*/
-
protected Icon getDefaultIcon(AbstractButton b) {
SynthContext context = getContext(b);
Icon icon = context.getStyle().getIcon(context, getPropertyPrefix() + "icon");
@@ -274,7 +312,11 @@ class SynthButtonUI extends BasicButtonUI implements
}
/**
- * Returns the Icon to use in painting the button.
+ * Returns the Icon to use for painting the button. The icon is chosen with
+ * respect to the current state of the button.
+ *
+ * @param b button the icon is associated with
+ * @return an icon
*/
protected Icon getIcon(AbstractButton b) {
Icon icon = b.getIcon();
@@ -374,7 +416,7 @@ class SynthButtonUI extends BasicButtonUI implements
/**
* Returns the amount to shift the text/icon when painting.
*/
- protected int getTextShiftOffset(SynthContext state) {
+ private int getTextShiftOffset(SynthContext state) {
AbstractButton button = (AbstractButton)state.getComponent();
ButtonModel model = button.getModel();
@@ -389,6 +431,11 @@ class SynthButtonUI extends BasicButtonUI implements
// ********************************
// Layout Methods
// ********************************
+
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getMinimumSize(JComponent c) {
if (c.getComponentCount() > 0 && c.getLayout() != null) {
return null;
@@ -406,6 +453,10 @@ class SynthButtonUI extends BasicButtonUI implements
return size;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getPreferredSize(JComponent c) {
if (c.getComponentCount() > 0 && c.getLayout() != null) {
return null;
@@ -423,6 +474,10 @@ class SynthButtonUI extends BasicButtonUI implements
return size;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getMaximumSize(JComponent c) {
if (c.getComponentCount() > 0 && c.getLayout() != null) {
return null;
@@ -442,7 +497,8 @@ class SynthButtonUI extends BasicButtonUI implements
}
/**
- * Returns the Icon used in calculating the pref/min/max size.
+ * Returns the Icon used in calculating the
+ * preferred/minimum/maximum size.
*/
protected Icon getSizingIcon(AbstractButton b) {
Icon icon = getEnabledIcon(b, b.getIcon());
@@ -452,6 +508,10 @@ class SynthButtonUI extends BasicButtonUI implements
return icon;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((AbstractButton)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java
index c440bfcd0b1..6601adfaeb9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java
@@ -27,56 +27,50 @@ package javax.swing.plaf.synth;
import java.awt.*;
-import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.*;
-import javax.swing.border.*;
-import java.io.Serializable;
/**
- * Synth's CheckBoxMenuItemUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JCheckBoxMenuItem}.
*
* @author Leif Samuelsson
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
+ * @since 1.7
*/
-class SynthCheckBoxMenuItemUI extends SynthMenuItemUI {
+public class SynthCheckBoxMenuItemUI extends SynthMenuItemUI {
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthCheckBoxMenuItemUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected String getPropertyPrefix() {
return "CheckBoxMenuItem";
}
- public void processMouseEvent(JMenuItem item, MouseEvent e,
- MenuElement path[], MenuSelectionManager manager) {
- Point p = e.getPoint();
- if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) {
- if (e.getID() == MouseEvent.MOUSE_RELEASED) {
- manager.clearSelectedPath();
- item.doClick(0);
- } else {
- manager.setSelectedPath(path);
- }
- } else if (item.getModel().isArmed()) {
- int c = path.length - 1;
- MenuElement newPath[] = new MenuElement[c];
- for (int i = 0; i < c; i++) {
- newPath[i] = path[i];
- }
- manager.setSelectedPath(newPath);
- }
- }
-
+ @Override
void paintBackground(SynthContext context, Graphics g, JComponent c) {
context.getPainter().paintCheckBoxMenuItemBackground(context, g, 0, 0,
c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintCheckBoxMenuItemBorder(context, g, x, y, w, h);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java
index 15fae42629f..7794fd601f7 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java
@@ -25,36 +25,51 @@
package javax.swing.plaf.synth;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.plaf.*;
-import java.io.Serializable;
+import javax.swing.JComponent;
+import java.awt.Graphics;
+import javax.swing.plaf.ComponentUI;
/**
- * Synth's CheckBoxUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JCheckBox}.
*
* @author Jeff Dinkins
+ * @since 1.7
*/
-class SynthCheckBoxUI extends SynthRadioButtonUI {
+public class SynthCheckBoxUI extends SynthRadioButtonUI {
// ********************************
// Create PLAF
// ********************************
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param b component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent b) {
return new SynthCheckBoxUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected String getPropertyPrefix() {
return "CheckBox.";
}
+ @Override
void paintBackground(SynthContext context, Graphics g, JComponent c) {
context.getPainter().paintCheckBoxBackground(context, g, 0, 0,
c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintCheckBoxBorder(context, g, x, y, w, h);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java
index 8a8dbf63220..0b240d1ff0c 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java
@@ -28,34 +28,39 @@ package javax.swing.plaf.synth;
import javax.swing.*;
import javax.swing.colorchooser.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicColorChooserUI;
-import java.util.*;
import java.awt.*;
-import java.awt.image.*;
-import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's ColorChooserUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JColorChooser}.
*
* @author Tom Santos
* @author Steve Wilson
+ * @since 1.7
*/
-class SynthColorChooserUI extends BasicColorChooserUI implements
+public class SynthColorChooserUI extends BasicColorChooserUI implements
PropertyChangeListener, SynthUI {
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthColorChooserUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected AbstractColorChooserPanel[] createDefaultChoosers() {
SynthContext context = getContext(chooser, ENABLED);
AbstractColorChooserPanel[] panels = (AbstractColorChooserPanel[])
@@ -68,6 +73,10 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
return panels;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
super.installDefaults();
updateStyle(chooser);
@@ -79,6 +88,10 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(chooser, ENABLED);
@@ -88,16 +101,28 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
super.uninstallDefaults();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
chooser.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
chooser.removePropertyChangeListener(this);
super.uninstallListeners();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -107,14 +132,14 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -125,6 +150,10 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -132,14 +161,29 @@ class SynthColorChooserUI extends BasicColorChooserUI implements
context.dispose();
}
+ /**
+ * Paints the specified component.
+ * This implementation does not perform any actions.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintColorChooserBorder(context, g, x, y,w,h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JColorChooser)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
index 7687a0d7bcb..0acd15594e9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java
@@ -27,21 +27,21 @@ package javax.swing.plaf.synth;
import java.awt.*;
import java.awt.event.*;
-import java.lang.reflect.*;
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.event.*;
import javax.swing.plaf.basic.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's ComboBoxUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JComboBox}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthComboBoxUI extends BasicComboBoxUI implements
+public class SynthComboBoxUI extends BasicComboBoxUI implements
PropertyChangeListener, SynthUI {
private SynthStyle style;
private boolean useListColors;
@@ -93,12 +93,11 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
private boolean forceOpaque = false;
/**
- * NOTE: This serves the same purpose as the same field in BasicComboBoxUI.
- * It is here because I could not give the padding field in
- * BasicComboBoxUI protected access in an update release.
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
*/
- private Insets padding;
-
public static ComponentUI createUI(JComponent c) {
return new SynthComboBoxUI();
}
@@ -118,21 +117,6 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
@Override
protected void installDefaults() {
- //NOTE: This next line of code was added because, since squareButton in
- //BasicComboBoxUI is private, I need to have some way of reading it from UIManager.
- //This is an incomplete solution (since it implies that squareButons,
- //once set, cannot be reset per state. Probably ok, but not always ok).
- //This line of code should be removed at the same time that squareButton
- //is made protected in the super class.
- super.installDefaults();
-
- //This is here instead of in updateStyle because the value for padding
- //needs to remain consistent with the value for padding in
- //BasicComboBoxUI. I wouldn't have this value here at all if not
- //for the fact that I cannot make "padding" protected in any way
- //for an update release. This *should* be fixed in Java 7
- padding = UIManager.getInsets("ComboBox.padding");
-
updateStyle(comboBox);
}
@@ -142,6 +126,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
style = SynthLookAndFeel.updateStyle(context, this);
if (style != oldStyle) {
+ padding = (Insets) style.get(context, "ComboBox.padding");
popupInsets = (Insets)style.get(context, "ComboBox.popupInsets");
useListColors = style.getBoolean(context,
"ComboBox.rendererUseListColors", true);
@@ -149,6 +134,8 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
"ComboBox.buttonWhenNotEditable", false);
pressedWhenPopupVisible = style.getBoolean(context,
"ComboBox.pressedWhenPopupVisible", false);
+ squareButton = style.getBoolean(context,
+ "ComboBox.squareButton", true);
if (oldStyle != null) {
uninstallKeyboardActions();
@@ -164,6 +151,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installListeners() {
comboBox.addPropertyChangeListener(this);
@@ -172,6 +162,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
super.installListeners();
}
+ /**
+ * @inheritDoc
+ */
@Override
public void uninstallUI(JComponent c) {
if (popup instanceof SynthComboPopup) {
@@ -181,6 +174,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
buttonHandler = null;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallDefaults() {
SynthContext context = getContext(comboBox, ENABLED);
@@ -190,6 +186,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
style = null;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallListeners() {
editorFocusHandler.unregister();
@@ -200,6 +199,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
super.uninstallListeners();
}
+ /**
+ * @inheritDoc
+ */
@Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
@@ -210,10 +212,6 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
// currently we have a broken situation where if a developer
// takes the border from a JComboBox and sets it on a JTextField
@@ -252,6 +250,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected ComboPopup createPopup() {
SynthComboPopup p = new SynthComboPopup(comboBox);
@@ -259,11 +260,17 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
return p;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected ListCellRenderer createRenderer() {
return new SynthComboBoxRenderer();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected ComboBoxEditor createEditor() {
return new SynthComboBoxEditor();
@@ -273,6 +280,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
// end UI Initialization
//======================
+ /**
+ * @inheritDoc
+ */
@Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
@@ -280,6 +290,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected JButton createArrowButton() {
SynthArrowButton button = new SynthArrowButton(SwingConstants.SOUTH);
@@ -291,6 +304,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
//=================================
// begin ComponentUI Implementation
+ /**
+ * @inheritDoc
+ */
@Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -302,6 +318,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
@Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -310,6 +329,12 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
hasFocus = comboBox.hasFocus();
if ( !comboBox.isEditable() ) {
@@ -318,6 +343,9 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
}
+ /**
+ * @inheritDoc
+ */
@Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
@@ -375,7 +403,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
/**
- * Return the default size of an empty display area of the combo box using
+ * Returns the default size of an empty display area of the combo box using
* the current renderer and font.
*
* This method was overridden to use SynthComboBoxRenderer instead of
@@ -393,23 +421,6 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
return new Dimension(d.width, d.height);
}
- /**
- * This has been refactored out in hopes that it may be investigated and
- * simplified for the next major release. adding/removing
- * the component to the currentValuePane and changing the font may be
- * redundant operations.
- *
- * NOTE: This method was copied in its entirety from BasicComboBoxUI. Might
- * want to make it protected in BasicComboBoxUI in Java 7
- */
- private Dimension getSizeForComponent(Component comp) {
- currentValuePane.add(comp);
- comp.setFont(comboBox.getFont());
- Dimension d = comp.getPreferredSize();
- currentValuePane.remove(comp);
- return d;
- }
-
/**
* From BasicComboBoxRenderer v 1.18.
*
@@ -478,85 +489,17 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
- /**
- * From BasicCombBoxEditor v 1.24.
- */
- private static class SynthComboBoxEditor implements
- ComboBoxEditor, UIResource {
- protected JTextField editor;
- private Object oldValue;
+ private static class SynthComboBoxEditor
+ extends BasicComboBoxEditor.UIResource {
- public SynthComboBoxEditor() {
- editor = new JTextField("",9);
- editor.setName("ComboBox.textField");
- }
-
- @Override
- public Component getEditorComponent() {
- return editor;
- }
-
- /**
- * Sets the item that should be edited.
- *
- * @param anObject the displayed value of the editor
- */
- @Override
- public void setItem(Object anObject) {
- String text;
-
- if ( anObject != null ) {
- text = anObject.toString();
- oldValue = anObject;
- } else {
- text = "";
- }
- // workaround for 4530952
- if (!text.equals(editor.getText())) {
- editor.setText(text);
- }
- }
-
- @Override
- public Object getItem() {
- Object newValue = editor.getText();
-
- if (oldValue != null && !(oldValue instanceof String)) {
- // The original value is not a string. Should return the value in it's
- // original type.
- if (newValue.equals(oldValue.toString())) {
- return oldValue;
- } else {
- // Must take the value from the editor and get the value and cast it to the new type.
- Class> cls = oldValue.getClass();
- try {
- Method method = cls.getMethod("valueOf", new Class[]{String.class});
- newValue = method.invoke(oldValue, new Object[] { editor.getText()});
- } catch (Exception ex) {
- // Fail silently and return the newValue (a String object)
- }
- }
- }
- return newValue;
- }
-
- @Override
- public void selectAll() {
- editor.selectAll();
- editor.requestFocus();
- }
-
- @Override
- public void addActionListener(ActionListener l) {
- editor.addActionListener(l);
- }
-
- @Override
- public void removeActionListener(ActionListener l) {
- editor.removeActionListener(l);
+ @Override public JTextField createEditorComponent() {
+ JTextField f = new JTextField("", 9);
+ f.setName("ComboBox.textField");
+ return f;
}
}
+
/**
* Handles all the logic for treating the combo as a button when it is
* not editable, and when shouldActLikeButton() is true. This class is a
@@ -620,7 +563,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
//------------------------------------------------------------------
/**
- * {@inheritDoc}
+ * @inheritDoc
*
* Ensures that isPressed() will return true if the combo is pressed,
* or the arrowButton is pressed, or if the combo popup is
@@ -634,7 +577,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
/**
- * {@inheritDoc}
+ * @inheritDoc
*
* Ensures that the armed state is in sync with the pressed state
* if shouldActLikeButton is true. Without this method, the arrow
@@ -649,7 +592,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
/**
- * {@inheritDoc}
+ * @inheritDoc
*
* Ensures that isRollover() will return true if the combo is
* rolled over, or the arrowButton is rolled over.
@@ -660,7 +603,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
/**
- * {@inheritDoc}
+ * @inheritDoc
*
* Forwards pressed states to the internal "pressed" field
*/
@@ -671,7 +614,7 @@ class SynthComboBoxUI extends BasicComboBoxUI implements
}
/**
- * {@inheritDoc}
+ * @inheritDoc
*
* Forwards rollover states to the internal "over" field
*/
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDefaultLookup.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDefaultLookup.java
index 34ad3f0049d..e87f70efcce 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDefaultLookup.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDefaultLookup.java
@@ -27,7 +27,6 @@ package javax.swing.plaf.synth;
import sun.swing.DefaultLookup;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
-import sun.swing.plaf.synth.SynthUI;
/**
* SynthDefaultLookup redirects all lookup calls to the SynthContext.
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java
index 333a68ae76a..09c2bb52bcc 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java
@@ -28,36 +28,44 @@ package javax.swing.plaf.synth;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicDesktopIconUI;
import java.beans.*;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth L&F for a minimized window on a desktop.
+ * Provides the Synth L&F UI delegate for a minimized internal frame on a desktop.
*
* @author Joshua Outwater
+ * @since 1.7
*/
-class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
- ActionListener, PropertyChangeListener {
+public class SynthDesktopIconUI extends BasicDesktopIconUI
+ implements SynthUI, PropertyChangeListener {
private SynthStyle style;
+ private Handler handler = new Handler();
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthDesktopIconUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installComponents() {
if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
iconPane = new JToggleButton(frame.getTitle(), frame.getFrameIcon()) {
- public String getToolTipText() {
+ @Override public String getToolTipText() {
return getText();
}
- public JPopupMenu getComponentPopupMenu() {
+ @Override public JPopupMenu getComponentPopupMenu() {
return frame.getComponentPopupMenu();
}
};
@@ -73,24 +81,37 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
desktopIcon.add(iconPane, BorderLayout.CENTER);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
desktopIcon.addPropertyChangeListener(this);
if (iconPane instanceof JToggleButton) {
frame.addPropertyChangeListener(this);
- ((JToggleButton)iconPane).addActionListener(this);
+ ((JToggleButton)iconPane).addActionListener(handler);
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
if (iconPane instanceof JToggleButton) {
+ ((JToggleButton)iconPane).removeActionListener(handler);
frame.removePropertyChangeListener(this);
}
desktopIcon.removePropertyChangeListener(this);
super.uninstallListeners();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
updateStyle(desktopIcon);
}
@@ -101,6 +122,10 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(desktopIcon, ENABLED);
style.uninstallDefaults(context);
@@ -108,12 +133,16 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
- Region region = getRegion(c);
+ Region region = SynthLookAndFeel.getRegion(c);
return SynthContext.getContext(SynthContext.class, c, region,
style, state);
}
@@ -122,10 +151,10 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
return SynthLookAndFeel.getComponentState(c);
}
- Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -136,6 +165,10 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -143,33 +176,24 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintDesktopIconBorder(context, g, x, y, w, h);
}
- public void actionPerformed(ActionEvent evt) {
- if (evt.getSource() instanceof JToggleButton) {
- // Either iconify the frame or deiconify and activate it.
- JToggleButton button = (JToggleButton)evt.getSource();
- try {
- boolean selected = button.isSelected();
- if (!selected && !frame.isIconifiable()) {
- button.setSelected(true);
- } else {
- frame.setIcon(!selected);
- if (selected) {
- frame.setSelected(true);
- }
- }
- } catch (PropertyVetoException e2) {
- }
- }
- }
-
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() instanceof JInternalFrame.JDesktopIcon) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
@@ -191,4 +215,25 @@ class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
}
}
}
+
+ private final class Handler implements ActionListener {
+ public void actionPerformed(ActionEvent evt) {
+ if (evt.getSource() instanceof JToggleButton) {
+ // Either iconify the frame or deiconify and activate it.
+ JToggleButton button = (JToggleButton)evt.getSource();
+ try {
+ boolean selected = button.isSelected();
+ if (!selected && !frame.isIconifiable()) {
+ button.setSelected(true);
+ } else {
+ frame.setIcon(!selected);
+ if (selected) {
+ frame.setSelected(true);
+ }
+ }
+ } catch (PropertyVetoException e2) {
+ }
+ }
+ }
+ }
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java
index b793f2b380f..0f90f57854f 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java
@@ -29,34 +29,38 @@ import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicDesktopPaneUI;
-
import java.beans.*;
-
import java.awt.event.*;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.Graphics;
-import java.awt.KeyboardFocusManager;
import java.awt.*;
-import java.util.Vector;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth L&F for a desktop.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JDesktopPane}.
*
* @author Joshua Outwater
* @author Steve Wilson
+ * @since 1.7
*/
-class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
+public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
PropertyChangeListener, SynthUI {
private SynthStyle style;
private TaskBar taskBar;
private DesktopManager oldDesktopManager;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthDesktopPaneUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
desktop.addPropertyChangeListener(this);
@@ -68,6 +72,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
updateStyle(desktop);
@@ -114,6 +122,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
if (taskBar != null) {
desktop.removeComponentListener(taskBar);
@@ -123,6 +135,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
super.uninstallListeners();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(desktop, ENABLED);
@@ -147,6 +163,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDesktopManager() {
if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
desktopManager = oldDesktopManager = desktop.getDesktopManager();
@@ -159,6 +179,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDesktopManager() {
if (oldDesktopManager != null && !(oldDesktopManager instanceof UIResource)) {
desktopManager = desktop.getDesktopManager();
@@ -397,7 +421,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
}
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -407,14 +434,14 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -425,6 +452,10 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -432,14 +463,28 @@ class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintDesktopPaneBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
updateStyle((JDesktopPane)evt.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
index e864944fad5..9fdf1c6b265 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java
@@ -31,47 +31,52 @@ import javax.swing.text.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicEditorPaneUI;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Provides the look and feel for a JEditorPane in the
- * Synth look and feel.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JEditorPane}.
*
* @author Shannon Hickey
+ * @since 1.7
*/
-class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
+public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
private SynthStyle style;
/*
* I would prefer to use UIResource instad of this.
* Unfortunately Boolean is a final class
*/
private Boolean localTrue = Boolean.TRUE;
- private Boolean localFalse = Boolean.FALSE;
/**
- * Creates a UI for the JTextPane.
+ * Creates a new UI object for the given component.
*
- * @param c the JTextPane component
- * @return the UI
+ * @param c component to create UI object for
+ * @return the UI object
*/
public static ComponentUI createUI(JComponent c) {
return new SynthEditorPaneUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
// Installs the text cursor on the component
super.installDefaults();
JComponent c = getComponent();
Object clientProperty =
c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
- if (clientProperty == null
- || clientProperty == localFalse) {
- c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
- localTrue);
+ if (clientProperty == null) {
+ c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, localTrue);
}
updateStyle(getComponent());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(getComponent(), ENABLED);
JComponent c = getComponent();
@@ -84,7 +89,7 @@ class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
Object clientProperty =
c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
if (clientProperty == localTrue) {
- getComponent().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
+ c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
Boolean.FALSE);
}
super.uninstallDefaults();
@@ -100,6 +105,7 @@ class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
*
* @param evt the property change event
*/
+ @Override
protected void propertyChange(PropertyChangeEvent evt) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
updateStyle((JTextComponent)evt.getSource());
@@ -124,6 +130,10 @@ class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -137,6 +147,10 @@ class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -146,10 +160,20 @@ class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
super.paint(g, getComponent());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void paintBackground(Graphics g) {
// Overriden to do nothing, all our painting is done from update/paint.
}
@@ -159,6 +183,10 @@ class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintEditorPaneBorder(context, g, x, y, w, h);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java
index 6d0204d27ad..6ea91e7bf3c 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java
@@ -24,16 +24,17 @@
*/
package javax.swing.plaf.synth;
-import java.awt.*;
-import javax.swing.*;
+import java.awt.Graphics;
+import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
/**
- * Provides the look and feel implementation for
- * JFormattedTextField
.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JFormattedTextField}.
*
+ * @since 1.7
*/
-class SynthFormattedTextFieldUI extends SynthTextFieldUI {
+public class SynthFormattedTextFieldUI extends SynthTextFieldUI {
/**
* Creates a UI for a JFormattedTextField.
*
@@ -51,15 +52,24 @@ class SynthFormattedTextFieldUI extends SynthTextFieldUI {
*
* @return the name "FormattedTextField"
*/
+ @Override
protected String getPropertyPrefix() {
return "FormattedTextField";
}
+ /**
+ * @inheritDoc
+ */
+ @Override
void paintBackground(SynthContext context, Graphics g, JComponent c) {
context.getPainter().paintFormattedTextFieldBackground(context, g, 0,
0, c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintFormattedTextFieldBorder(context, g, x, y,
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
index 51e9d1497d6..d0fe4acb764 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java
@@ -30,14 +30,9 @@ import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
-import javax.swing.border.*;
-import javax.swing.event.InternalFrameEvent;
-import java.util.EventListener;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
-import java.beans.VetoableChangeListener;
import java.beans.PropertyVetoException;
-import sun.swing.plaf.synth.SynthUI;
import sun.swing.SwingUtilities2;
/**
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
index a89fba5e8eb..9ffc3ca36be 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java
@@ -27,52 +27,61 @@ package javax.swing.plaf.synth;
import java.awt.*;
import java.awt.event.*;
-import java.awt.peer.LightweightPeer;
-
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
-import javax.swing.event.*;
-
import java.beans.*;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's InternalFrameUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JInternalFrame}.
*
* @author David Kloba
* @author Joshua Outwater
* @author Rich Schiavi
+ * @since 1.7
*/
-class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
- PropertyChangeListener {
+public class SynthInternalFrameUI extends BasicInternalFrameUI
+ implements SynthUI, PropertyChangeListener {
private SynthStyle style;
- private static DesktopManager sharedDesktopManager;
- private boolean componentListenerAdded = false;
-
- private Rectangle parentBounds;
-
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param b component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent b) {
return new SynthInternalFrameUI((JInternalFrame)b);
}
- public SynthInternalFrameUI(JInternalFrame b) {
+ protected SynthInternalFrameUI(JInternalFrame b) {
super(b);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void installDefaults() {
frame.setLayout(internalFrameLayout = createLayoutManager());
updateStyle(frame);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
frame.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallComponents() {
if (frame.getComponentPopupMenu() instanceof UIResource) {
frame.setComponentPopupMenu(null);
@@ -80,6 +89,10 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
super.uninstallComponents();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
frame.removePropertyChangeListener(this);
super.uninstallListeners();
@@ -104,6 +117,10 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(frame, ENABLED);
style.uninstallDefaults(context);
@@ -115,6 +132,10 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -124,24 +145,28 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- public int getComponentState(JComponent c) {
+ private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected JComponent createNorthPane(JInternalFrame w) {
titlePane = new SynthInternalFrameTitlePane(w);
titlePane.setName("InternalFrame.northPane");
return titlePane;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected ComponentListener createComponentListener() {
if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
return new ComponentHandler() {
- public void componentResized(ComponentEvent e) {
+ @Override public void componentResized(ComponentEvent e) {
if (frame != null && frame.isMaximum()) {
JDesktopPane desktop = (JDesktopPane)e.getSource();
for (Component comp : desktop.getComponents()) {
@@ -168,6 +193,10 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -178,6 +207,10 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -185,15 +218,29 @@ class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintInternalFrameBorder(context,
g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
SynthStyle oldStyle = style;
JInternalFrame f = (JInternalFrame)evt.getSource();
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
index f46f4d261f1..456d5bf218b 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java
@@ -29,38 +29,37 @@ import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.text.View;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Insets;
-import java.awt.Color;
import java.awt.Graphics;
-import java.awt.Font;
import java.awt.FontMetrics;
import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's LabelUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JLabel}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthLabelUI extends BasicLabelUI implements SynthUI {
+public class SynthLabelUI extends BasicLabelUI implements SynthUI {
private SynthStyle style;
/**
* Returns the LabelUI implementation used for the skins look and feel.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
*/
public static ComponentUI createUI(JComponent c){
return new SynthLabelUI();
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults(JLabel c) {
updateStyle(c);
}
@@ -71,6 +70,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults(JLabel c){
SynthContext context = getContext(c, ENABLED);
@@ -79,6 +82,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -88,10 +95,6 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
int state = SynthLookAndFeel.getComponentState(c);
if (SynthLookAndFeel.selectedUI == this &&
@@ -101,6 +104,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
return state;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public int getBaseline(JComponent c, int width, int height) {
if (c == null) {
throw new NullPointerException("Component must be non-null");
@@ -153,6 +160,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
* component. This method is invoked by JComponent
* when the specified component is being painted.
*/
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -163,6 +174,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -170,6 +185,12 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
JLabel label = (JLabel)context.getComponent();
Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -185,11 +206,19 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
label.getIconTextGap(), label.getDisplayedMnemonicIndex(), 0);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintLabelBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getPreferredSize(JComponent c) {
JLabel label = (JLabel)c;
Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -207,7 +236,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
return size;
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getMinimumSize(JComponent c) {
JLabel label = (JLabel)c;
Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -225,6 +257,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
return size;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public Dimension getMaximumSize(JComponent c) {
JLabel label = (JLabel)c;
Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -242,7 +278,10 @@ class SynthLabelUI extends BasicLabelUI implements SynthUI {
return size;
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
super.propertyChange(e);
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java
index 09907613f3f..909ab69b1d9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java
@@ -27,38 +27,39 @@ package javax.swing.plaf.synth;
import javax.swing.*;
import javax.swing.border.*;
-import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
-import javax.swing.text.Position;
-
import java.awt.*;
-import java.awt.event.*;
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.*;
-
-import java.util.ArrayList;
-import java.util.TooManyListenersException;
-
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's ListUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JList}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthListUI extends BasicListUI implements PropertyChangeListener,
- SynthUI {
+public class SynthListUI extends BasicListUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
private boolean useListColors;
private boolean useUIBorder;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param list component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent list) {
return new SynthListUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -69,27 +70,47 @@ class SynthListUI extends BasicListUI implements PropertyChangeListener,
paint(g, c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintListBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
list.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JList)e.getSource());
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
list.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
if (list.getCellRenderer() == null ||
(list.getCellRenderer() instanceof UIResource)) {
@@ -135,6 +156,10 @@ class SynthListUI extends BasicListUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
super.uninstallDefaults();
@@ -145,6 +170,10 @@ class SynthListUI extends BasicListUI implements PropertyChangeListener,
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -154,27 +183,23 @@ class SynthListUI extends BasicListUI implements PropertyChangeListener,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
private class SynthListCellRenderer extends DefaultListCellRenderer.UIResource {
- public String getName() {
+ @Override public String getName() {
return "List.cellRenderer";
}
- public void setBorder(Border b) {
+ @Override public void setBorder(Border b) {
if (useUIBorder || b instanceof SynthBorder) {
super.setBorder(b);
}
}
- public Component getListCellRendererComponent(JList list, Object value,
+ @Override public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
if (!useListColors && (isSelected || cellHasFocus)) {
SynthLookAndFeel.setSelectedUI((SynthLabelUI)SynthLookAndFeel.
@@ -190,7 +215,7 @@ class SynthListUI extends BasicListUI implements PropertyChangeListener,
return this;
}
- public void paint(Graphics g) {
+ @Override public void paint(Graphics g) {
super.paint(g);
SynthLookAndFeel.resetSelectedUI();
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
index 976ec0adc66..1db09641cc9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java
@@ -234,44 +234,9 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
* shouldUpdateStyleOnAncestorChanged
as necessary.
*/
static boolean shouldUpdateStyle(PropertyChangeEvent event) {
- String eName = event.getPropertyName();
- if ("name" == eName) {
- // Always update on a name change
- return true;
- }
- else if ("componentOrientation" == eName) {
- // Always update on a component orientation change
- return true;
- }
- else if ("ancestor" == eName && event.getNewValue() != null) {
- // Only update on an ancestor change when getting a valid
- // parent and the LookAndFeel wants this.
- LookAndFeel laf = UIManager.getLookAndFeel();
- return (laf instanceof SynthLookAndFeel &&
- ((SynthLookAndFeel)laf).
- shouldUpdateStyleOnAncestorChanged());
- }
- // Note: The following two nimbus based overrides should be refactored
- // to be in the Nimbus LAF. Due to constraints in an update release,
- // we couldn't actually provide the public API necessary to allow
- // NimbusLookAndFeel (a subclass of SynthLookAndFeel) to provide its
- // own rules for shouldUpdateStyle.
- else if ("Nimbus.Overrides" == eName) {
- // Always update when the Nimbus.Overrides client property has
- // been changed
- return true;
- }
- else if ("Nimbus.Overrides.InheritDefaults" == eName) {
- // Always update when the Nimbus.Overrides.InheritDefaults
- // client property has changed
- return true;
- }
- else if ("JComponent.sizeVariant" == eName) {
- // Always update when the JComponent.sizeVariant
- // client property has changed
- return true;
- }
- return false;
+ LookAndFeel laf = UIManager.getLookAndFeel();
+ return (laf instanceof SynthLookAndFeel &&
+ ((SynthLookAndFeel) laf).shouldUpdateStyleOnEvent(event));
}
/**
@@ -303,12 +268,6 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
* @param c Component to update style for.
*/
public static void updateStyles(Component c) {
- _updateStyles(c);
- c.repaint();
- }
-
- // Implementation for updateStyles
- private static void _updateStyles(Component c) {
if (c instanceof JComponent) {
// Yes, this is hacky. A better solution is to get the UI
// and cast, but JComponent doesn't expose a getter for the UI
@@ -332,6 +291,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
updateStyles(child);
}
}
+ c.repaint();
}
/**
@@ -788,6 +748,27 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
return false;
}
+ /**
+ * Returns whether or not the UIs should update their styles when a
+ * particular event occurs.
+ *
+ * @param ev a {@code PropertyChangeEvent}
+ * @return whether or not the UIs should update their styles
+ * @since 1.7
+ */
+ protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
+ String eName = ev.getPropertyName();
+ if ("name" == eName || "componentOrientation" == eName) {
+ return true;
+ }
+ if ("ancestor" == eName && ev.getNewValue() != null) {
+ // Only update on an ancestor change when getting a valid
+ // parent and the LookAndFeel wants this.
+ return shouldUpdateStyleOnAncestorChanged();
+ }
+ return false;
+ }
+
/**
* Returns the antialiasing information as specified by the host desktop.
* Antialiasing might be forced off if the desktop is GNOME and the user
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java
index c7be3f7f445..613d3723181 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java
@@ -25,45 +25,49 @@
package javax.swing.plaf.synth;
import javax.swing.*;
-import javax.swing.event.*;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-
-import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's MenuBarUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JMenuBar}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
- SynthUI {
+public class SynthMenuBarUI extends BasicMenuBarUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param x component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent x) {
return new SynthMenuBarUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
if (menuBar.getLayout() == null ||
menuBar.getLayout() instanceof UIResource) {
- menuBar.setLayout(new DefaultMenuLayout(menuBar,BoxLayout.LINE_AXIS));
+ menuBar.setLayout(new SynthMenuLayout(menuBar,BoxLayout.LINE_AXIS));
}
updateStyle(menuBar);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
menuBar.addPropertyChangeListener(this);
@@ -82,6 +86,10 @@ class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(menuBar, ENABLED);
@@ -90,11 +98,19 @@ class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
menuBar.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -104,14 +120,14 @@ class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -122,6 +138,10 @@ class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -129,14 +149,28 @@ class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintMenuBarBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JMenuBar)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java
index 3bcc044a12e..668e4878a7e 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java
@@ -24,41 +24,44 @@
*/
package javax.swing.plaf.synth;
-import javax.swing.plaf.basic.BasicHTML;
import java.awt.*;
-import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-
import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
-import javax.swing.text.View;
-import sun.swing.plaf.synth.*;
import sun.swing.MenuItemLayoutHelper;
/**
- * Synth's MenuItemUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JMenuItem}.
*
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
* @author Fredrik Lagerblad
+ * @since 1.7
*/
-class SynthMenuItemUI extends BasicMenuItemUI implements
+public class SynthMenuItemUI extends BasicMenuItemUI implements
PropertyChangeListener, SynthUI {
private SynthStyle style;
private SynthStyle accStyle;
- private String acceleratorDelimiter;
-
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthMenuItemUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
// Remove values from the parent's Client Properties.
@@ -69,10 +72,18 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
updateStyle(menuItem);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
menuItem.addPropertyChangeListener(this);
@@ -122,6 +133,10 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
accContext.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(menuItem, ENABLED);
style.uninstallDefaults(context);
@@ -137,11 +152,19 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
super.uninstallDefaults();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
menuItem.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -151,7 +174,7 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- public SynthContext getContext(JComponent c, Region region) {
+ SynthContext getContext(JComponent c, Region region) {
return getContext(c, region, getComponentState(c, region));
}
@@ -160,10 +183,6 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
region, accStyle, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
int state;
@@ -186,6 +205,10 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
return getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected Dimension getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,
@@ -203,6 +226,10 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -212,6 +239,10 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -219,6 +250,12 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
SynthContext accContext = getContext(menuItem,
Region.MENU_ITEM_ACCELERATOR);
@@ -236,11 +273,19 @@ class SynthMenuItemUI extends BasicMenuItemUI implements
SynthGraphicsUtils.paintBackground(context, g, c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintMenuItemBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JMenuItem)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java
similarity index 69%
rename from jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java
rename to jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java
index 1757a2e661a..f821c22f4f8 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java
@@ -25,44 +25,29 @@
package javax.swing.plaf.synth;
-import javax.swing.*;
-import javax.swing.plaf.UIResource;
-
+import javax.swing.plaf.basic.DefaultMenuLayout;
+import javax.swing.JPopupMenu;
import java.awt.Container;
import java.awt.Dimension;
/**
- * The default layout manager for Popup menus and menubars. This
- * class is an extension of BoxLayout which adds the UIResource tag
- * so that plauggable L&Fs can distinguish it from user-installed
- * layout managers on menus.
- *
- * Derived from javax.swing.plaf.basic.DefaultMenuLayout
+ * @inheritDoc
*
* @author Georges Saab
*/
-class DefaultMenuLayout extends BoxLayout implements UIResource {
- public DefaultMenuLayout(Container target, int axis) {
+class SynthMenuLayout extends DefaultMenuLayout {
+ public SynthMenuLayout(Container target, int axis) {
super(target, axis);
}
public Dimension preferredLayoutSize(Container target) {
if (target instanceof JPopupMenu) {
JPopupMenu popupMenu = (JPopupMenu) target;
-
popupMenu.putClientProperty(
SynthMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
- sun.swing.MenuItemLayoutHelper.clearUsedClientProperties(popupMenu);
-
- if (popupMenu.getComponentCount() == 0) {
- return new Dimension(0, 0);
- }
}
- // Make BoxLayout recalculate cached preferred sizes
- super.invalidateLayout(target);
-
return super.preferredLayoutSize(target);
}
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
index 78835abf141..ccee8b42c1f 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java
@@ -25,40 +25,48 @@
package javax.swing.plaf.synth;
import java.awt.*;
-import java.awt.event.*;
import java.beans.*;
import javax.swing.*;
-import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
-import javax.swing.border.*;
-import java.util.Arrays;
-import java.util.ArrayList;
-import sun.swing.plaf.synth.SynthUI;
import sun.swing.MenuItemLayoutHelper;
/**
- * Synth's MenuUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JMenu}.
*
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
+ * @since 1.7
*/
-class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
- SynthUI {
+public class SynthMenuUI extends BasicMenuUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
private SynthStyle accStyle;
- private String acceleratorDelimiter;
-
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param x component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent x) {
return new SynthMenuUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
updateStyle(menuItem);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
menuItem.addPropertyChangeListener(this);
@@ -111,6 +119,10 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
accContext.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void uninstallUI(JComponent c) {
super.uninstallUI(c);
// Remove values from the parent's Client Properties.
@@ -121,6 +133,10 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(menuItem, ENABLED);
style.uninstallDefaults(context);
@@ -136,22 +152,30 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
super.uninstallDefaults();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
menuItem.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
SynthContext getContext(JComponent c, int state) {
- Region region = getRegion(c);
+ Region region = SynthLookAndFeel.getRegion(c);
return SynthContext.getContext(SynthContext.class, c, region,
style, state);
}
- public SynthContext getContext(JComponent c, Region region) {
+ SynthContext getContext(JComponent c, Region region) {
return getContext(c, region, getComponentState(c, region));
}
@@ -160,10 +184,6 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
region, accStyle, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
int state;
@@ -186,6 +206,10 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
return getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected Dimension getPreferredMenuItemSize(JComponent c,
Icon checkIcon,
Icon arrowIcon,
@@ -202,7 +226,10 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
return value;
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -213,6 +240,10 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -220,6 +251,12 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
SynthContext accContext = getContext(menuItem,
Region.MENU_ITEM_ACCELERATOR);
@@ -232,11 +269,19 @@ class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
accContext.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintMenuBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JMenu)e.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java
index eb0512a95ab..4a7e97b83a9 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java
@@ -28,34 +28,45 @@ package javax.swing.plaf.synth;
import java.awt.*;
import java.beans.*;
import javax.swing.*;
-import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import sun.swing.DefaultLookup;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's OptionPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JOptionPane}.
*
* @author James Gosling
* @author Scott Violet
* @author Amy Fowler
+ * @since 1.7
*/
-class SynthOptionPaneUI extends BasicOptionPaneUI implements
+public class SynthOptionPaneUI extends BasicOptionPaneUI implements
PropertyChangeListener, SynthUI {
private SynthStyle style;
/**
- * Creates a new BasicOptionPaneUI instance.
- */
+ * Creates a new UI object for the given component.
+ *
+ * @param x component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent x) {
return new SynthOptionPaneUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults() {
updateStyle(optionPane);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
optionPane.addPropertyChangeListener(this);
@@ -80,6 +91,10 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(optionPane, ENABLED);
@@ -88,11 +103,19 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
optionPane.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installComponents() {
optionPane.add(createMessageArea());
@@ -108,6 +131,10 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
optionPane.applyComponentOrientation(optionPane.getComponentOrientation());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -117,14 +144,14 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -135,6 +162,10 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -142,30 +173,49 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintOptionPaneBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JOptionPane)e.getSource());
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected boolean getSizeButtonsToSameWidth() {
return DefaultLookup.getBoolean(optionPane, this,
"OptionPane.sameSizeButtons", true);
}
/**
- * Messaged from installComponents to create a Container containing the
- * body of the message. The icon is the created by calling
- * addIcon
.
+ * Called from {@link #installComponents} to create a {@code Container}
+ * containing the body of the message. The icon is the created by calling
+ * {@link #addIcon}.
*/
+ @Override
protected Container createMessageArea() {
JPanel top = new JPanel();
top.setName("OptionPane.messageArea");
@@ -206,6 +256,10 @@ class SynthOptionPaneUI extends BasicOptionPaneUI implements
return top;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected Container createSeparator() {
JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java
index 1646bdad62d..aee3979cb55 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java
@@ -25,7 +25,6 @@
package javax.swing.plaf.synth;
import java.awt.*;
-import javax.swing.*;
/**
* SynthPainter
is used for painting portions of
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java
index 6979b9be048..c1e30e2a376 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java
@@ -25,29 +25,37 @@
package javax.swing.plaf.synth;
-import java.awt.*;
import javax.swing.*;
-import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicPanelUI;
import java.awt.*;
-import java.awt.event.*;
import java.beans.*;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's PanelUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JPanel}.
*
* @author Steve Wilson
+ * @since 1.7
*/
-class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
- SynthUI {
+public class SynthPanelUI extends BasicPanelUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param c component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent c) {
return new SynthPanelUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void installUI(JComponent c) {
JPanel p = (JPanel)c;
@@ -55,6 +63,10 @@ class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
installListeners(p);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void uninstallUI(JComponent c) {
JPanel p = (JPanel)c;
@@ -62,18 +74,36 @@ class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
super.uninstallUI(c);
}
+ /**
+ * Installs listeners into the panel.
+ *
+ * @param p the {@code JPanel} object
+ */
protected void installListeners(JPanel p) {
p.addPropertyChangeListener(this);
}
+ /**
+ * Uninstalls listeners from the panel.
+ *
+ * @param p the {@code JPanel} object
+ */
protected void uninstallListeners(JPanel p) {
p.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installDefaults(JPanel p) {
updateStyle(p);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults(JPanel p) {
SynthContext context = getContext(p, ENABLED);
@@ -88,6 +118,10 @@ class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -97,14 +131,14 @@ class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -115,6 +149,10 @@ class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -122,15 +160,29 @@ class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
// do actual painting
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintPanelBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent pce) {
if (SynthLookAndFeel.shouldUpdateStyle(pce)) {
updateStyle((JPanel)pce.getSource());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java
index 52c7a4d7435..a25457df798 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java
@@ -25,21 +25,19 @@
package javax.swing.plaf.synth;
-import java.awt.*;
+import java.awt.Graphics;
import javax.swing.*;
import javax.swing.text.*;
-import javax.swing.plaf.*;
+import javax.swing.plaf.ComponentUI;
/**
- * Provides the Synth look and feel for a password field.
- * The only difference from the standard text field is that
- * the view of the text is simply a string of the echo
- * character as specified in JPasswordField, rather than the
- * real text contained in the field.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JPasswordField}.
*
* @author Shannon Hickey
+ * @since 1.7
*/
-class SynthPasswordFieldUI extends SynthTextFieldUI {
+public class SynthPasswordFieldUI extends SynthTextFieldUI {
/**
* Creates a UI for a JPasswordField.
@@ -58,6 +56,7 @@ class SynthPasswordFieldUI extends SynthTextFieldUI {
*
* @return the name ("PasswordField")
*/
+ @Override
protected String getPropertyPrefix() {
return "PasswordField";
}
@@ -68,20 +67,33 @@ class SynthPasswordFieldUI extends SynthTextFieldUI {
* @param elem the element
* @return the view
*/
+ @Override
public View create(Element elem) {
return new PasswordView(elem);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
void paintBackground(SynthContext context, Graphics g, JComponent c) {
context.getPainter().paintPasswordFieldBackground(context, g, 0, 0,
c.getWidth(), c.getHeight());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintPasswordFieldBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
ActionMap map = SwingUtilities.getUIActionMap(getComponent());
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java
index 50d1c2781ac..e09150b4288 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java
@@ -26,49 +26,43 @@
package javax.swing.plaf.synth;
import javax.swing.*;
-import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
-import javax.swing.border.*;
-
-import java.applet.Applet;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
import java.awt.Graphics;
-import java.awt.KeyboardFocusManager;
-import java.awt.Window;
-import java.awt.event.*;
-import java.awt.AWTEvent;
-import java.awt.Toolkit;
-
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
-import java.util.*;
-import sun.swing.plaf.synth.SynthUI;
-
/**
- * Synth's PopupMenuUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JPopupMenu}.
*
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
+ * @since 1.7
*/
-class SynthPopupMenuUI extends BasicPopupMenuUI implements
- PropertyChangeListener, SynthUI {
+public class SynthPopupMenuUI extends BasicPopupMenuUI
+ implements PropertyChangeListener, SynthUI {
private SynthStyle style;
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param x component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent x) {
return new SynthPopupMenuUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void installDefaults() {
if (popupMenu.getLayout() == null ||
popupMenu.getLayout() instanceof UIResource) {
- popupMenu.setLayout(new DefaultMenuLayout(
- popupMenu, BoxLayout.Y_AXIS));
+ popupMenu.setLayout(new SynthMenuLayout(popupMenu, BoxLayout.Y_AXIS));
}
updateStyle(popupMenu);
}
@@ -86,11 +80,19 @@ class SynthPopupMenuUI extends BasicPopupMenuUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void installListeners() {
super.installListeners();
popupMenu.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(popupMenu, ENABLED);
@@ -103,11 +105,19 @@ class SynthPopupMenuUI extends BasicPopupMenuUI implements
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
popupMenu.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -117,14 +127,14 @@ class SynthPopupMenuUI extends BasicPopupMenuUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -135,6 +145,10 @@ class SynthPopupMenuUI extends BasicPopupMenuUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -142,14 +156,28 @@ class SynthPopupMenuUI extends BasicPopupMenuUI implements
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintPopupMenuBorder(context, g, x, y, w, h);
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle(popupMenu);
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
index c6a75375bf7..87cbb4606ad 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java
@@ -32,16 +32,17 @@ import javax.swing.plaf.*;
import javax.swing.plaf.basic.BasicProgressBarUI;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
import sun.swing.SwingUtilities2;
/**
- * Synth's ProgressBarUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JProgressBar}.
*
* @author Joshua Outwater
+ * @since 1.7
*/
-class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
- PropertyChangeListener {
+public class SynthProgressBarUI extends BasicProgressBarUI
+ implements SynthUI, PropertyChangeListener {
private SynthStyle style;
private int progressPadding;
private boolean rotateText; // added for Nimbus LAF
@@ -49,22 +50,37 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
private boolean tileWhenIndeterminate; //whether to tile indeterminate painting
private int tileWidth; //the width of each tile
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param x component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent x) {
return new SynthProgressBarUI();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installListeners() {
super.installListeners();
progressBar.addPropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallListeners() {
super.uninstallListeners();
progressBar.removePropertyChangeListener(this);
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void installDefaults() {
updateStyle(progressBar);
@@ -101,6 +117,9 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void uninstallDefaults() {
SynthContext context = getContext(progressBar, ENABLED);
@@ -110,6 +129,10 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
style = null;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
return getContext(c, getComponentState(c));
}
@@ -119,14 +142,13 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
private int getComponentState(JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
+ /**
+ * @inheritDoc
+ */
@Override
public int getBaseline(JComponent c, int width, int height) {
super.getBaseline(c, width, height);
@@ -142,6 +164,9 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
return -1;
}
+ /**
+ * @inheritDoc
+ */
@Override
protected Rectangle getBox(Rectangle r) {
if (tileWhenIndeterminate) {
@@ -151,6 +176,9 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
protected void setAnimationIndex(int newValue) {
if (paintOutsideClip) {
@@ -164,6 +192,9 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -176,6 +207,9 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
@Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -184,6 +218,12 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
context.dispose();
}
+ /**
+ * Paints the specified component.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
JProgressBar pBar = (JProgressBar)context.getComponent();
int x = 0, y = 0, width = 0, height = 0;
@@ -261,8 +301,14 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
}
}
- protected void paintText(SynthContext context, Graphics g,
- String title) {
+ /**
+ * Paints the component's text.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ * @param title the text to paint
+ */
+ protected void paintText(SynthContext context, Graphics g, String title) {
if (progressBar.isStringPainted()) {
SynthStyle style = context.getStyle();
Font font = style.getFont(context);
@@ -323,12 +369,20 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintProgressBarBorder(context, g, x, y, w, h,
progressBar.getOrientation());
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e) ||
"indeterminate".equals(e.getPropertyName())) {
@@ -336,6 +390,9 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
}
}
+ /**
+ * @inheritDoc
+ */
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension size = null;
@@ -398,5 +455,5 @@ class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
size.height += border.top + border.bottom;
return size;
- }
+ }
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java
index fd814acf1a9..8fb7c39da41 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java
@@ -27,49 +27,46 @@ package javax.swing.plaf.synth;
import javax.swing.*;
import java.awt.*;
-import java.awt.event.*;
import javax.swing.plaf.*;
-import javax.swing.border.*;
/**
- * Synth's RadioButtonMenuItemUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JRadioButtonMenuItem}.
*
* @author Georges Saab
* @author David Karlton
+ * @since 1.7
*/
-class SynthRadioButtonMenuItemUI extends SynthMenuItemUI {
+public class SynthRadioButtonMenuItemUI extends SynthMenuItemUI {
+
+ /**
+ * Creates a new UI object for the given component.
+ *
+ * @param b component to create UI object for
+ * @return the UI object
+ */
public static ComponentUI createUI(JComponent b) {
return new SynthRadioButtonMenuItemUI();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected String getPropertyPrefix() {
return "RadioButtonMenuItem";
}
- public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
- Point p = e.getPoint();
- if(p.x >= 0 && p.x < item.getWidth() &&
- p.y >= 0 && p.y < item.getHeight()) {
- if(e.getID() == MouseEvent.MOUSE_RELEASED) {
- manager.clearSelectedPath();
- item.doClick(0);
- item.setArmed(false);
- } else
- manager.setSelectedPath(path);
- } else if(item.getModel().isArmed()) {
- MenuElement newPath[] = new MenuElement[path.length-1];
- int i,c;
- for(i=0,c=path.length-1;ipropertyChangeListener
added
- * by installListeners.
- * uninstallUI
.
- *
- * @see #installListeners
+ * @inheritDoc
*/
@Override
protected void uninstallListeners() {
@@ -100,7 +97,7 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
}
/**
- * Initialize the JSpinner
border
,
+ * Initializes the JSpinner
border
,
* foreground
, and background
, properties
* based on the corresponding "Spinner.*" properties from defaults table.
* The JSpinners
layout is set to the value returned by
@@ -112,6 +109,7 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
* @see LookAndFeel#installBorder
* @see LookAndFeel#installColors
*/
+ @Override
protected void installDefaults() {
LayoutManager layout = spinner.getLayout();
@@ -144,6 +142,7 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
* @see #installDefaults
* @see #uninstallUI
*/
+ @Override
protected void uninstallDefaults() {
if (spinner.getLayout() instanceof UIResource) {
spinner.setLayout(null);
@@ -156,25 +155,19 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
style = null;
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
protected LayoutManager createLayout() {
return new SpinnerLayout();
}
/**
- * Create a component that will replace the spinner models value
- * with the object returned by spinner.getPreviousValue
.
- * By default the previousButton
is a JButton
- * who's ActionListener
updates it's JSpinner
- * ancestors model. If a previousButton isn't needed (in a subclass)
- * then override this method to return null.
- *
- * @return a component that will replace the spinners model with the
- * next value in the sequence, or null
- * @see #installUI
- * @see #createNextButton
+ * @inheritDoc
*/
+ @Override
protected Component createPreviousButton() {
JButton b = new SynthArrowButton(SwingConstants.SOUTH);
b.setName("Spinner.previousButton");
@@ -184,18 +177,9 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
/**
- * Create a component that will replace the spinner models value
- * with the object returned by spinner.getNextValue
.
- * By default the nextButton
is a JButton
- * who's ActionListener
updates it's JSpinner
- * ancestors model. If a nextButton isn't needed (in a subclass)
- * then override this method to return null.
- *
- * @return a component that will replace the spinners model with the
- * next value in the sequence, or null
- * @see #installUI
- * @see #createPreviousButton
+ * @inheritDoc
*/
+ @Override
protected Component createNextButton() {
JButton b = new SynthArrowButton(SwingConstants.NORTH);
b.setName("Spinner.nextButton");
@@ -227,6 +211,7 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
* @see #replaceEditor
* @see JSpinner#getEditor
*/
+ @Override
protected JComponent createEditor() {
JComponent editor = spinner.getEditor();
editor.setName("Spinner.editor");
@@ -250,6 +235,7 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
* @see #createEditor
* @see #createPropertyChangeListener
*/
+ @Override
protected void replaceEditor(JComponent oldEditor, JComponent newEditor) {
spinner.remove(oldEditor);
spinner.add(newEditor, "Editor");
@@ -283,8 +269,12 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -292,17 +282,10 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
SynthLookAndFeel.getRegion(c), style, state);
}
-
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -314,6 +297,10 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -321,10 +308,19 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
context.dispose();
}
-
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintSpinnerBorder(context, g, x, y, w, h);
@@ -426,9 +422,11 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
}
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
- String propertyName = e.getPropertyName();
JSpinner spinner = (JSpinner)(e.getSource());
SpinnerUI spinnerUI = spinner.getUI();
@@ -444,34 +442,13 @@ class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
/** Listen to editor text field focus changes and repaint whole spinner */
private class EditorFocusHandler implements FocusListener{
/** Invoked when a editor text field gains the keyboard focus. */
- public void focusGained(FocusEvent e) {
+ @Override public void focusGained(FocusEvent e) {
spinner.repaint();
}
/** Invoked when a editor text field loses the keyboard focus. */
- public void focusLost(FocusEvent e) {
+ @Override public void focusLost(FocusEvent e) {
spinner.repaint();
}
}
-
- /** Override the arrowbuttons focus handling to follow the text fields focus */
- private class SpinnerArrowButton extends SynthArrowButton{
- public SpinnerArrowButton(int direction) {
- super(direction);
- }
-
- @Override
- public boolean isFocusOwner() {
- if (spinner == null){
- return super.isFocusOwner();
- } else if (spinner.getEditor() instanceof JSpinner.DefaultEditor){
- return ((JSpinner.DefaultEditor)spinner.getEditor())
- .getTextField().isFocusOwner();
- } else if (spinner.getEditor()!= null) {
- return spinner.getEditor().isFocusOwner();
- } else {
- return super.isFocusOwner();
- }
- }
- }
}
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
index 6cf4da962a2..930e756f3b0 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java
@@ -31,19 +31,19 @@ import java.awt.event.*;
import java.beans.*;
import java.util.*;
import javax.swing.*;
-import javax.swing.event.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
-import sun.swing.plaf.synth.SynthUI;
/**
- * Synth's SplitPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JSplitPane}.
*
* @author Scott Violet
+ * @since 1.7
*/
-class SynthSplitPaneUI extends BasicSplitPaneUI implements
- PropertyChangeListener, SynthUI {
+public class SynthSplitPaneUI extends BasicSplitPaneUI
+ implements PropertyChangeListener, SynthUI {
/**
* Keys to use for forward focus traversal when the JComponent is
* managing focus.
@@ -68,6 +68,9 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
/**
* Creates a new SynthSplitPaneUI instance
+ *
+ * @param x component to create UI object for
+ * @return the UI object
*/
public static ComponentUI createUI(JComponent x) {
return new SynthSplitPaneUI();
@@ -76,6 +79,7 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
/**
* Installs the UI defaults.
*/
+ @Override
protected void installDefaults() {
updateStyle(splitPane);
@@ -161,6 +165,7 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
/**
* Installs the event listeners for the UI.
*/
+ @Override
protected void installListeners() {
super.installListeners();
splitPane.addPropertyChangeListener(this);
@@ -169,6 +174,7 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
/**
* Uninstalls the UI defaults.
*/
+ @Override
protected void uninstallDefaults() {
SynthContext context = getContext(splitPane, ENABLED);
@@ -186,16 +192,20 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
/**
- * Uninstalls the event listeners for the UI.
+ * Uninstalls the event listeners from the UI.
*/
+ @Override
protected void uninstallListeners() {
super.uninstallListeners();
splitPane.removePropertyChangeListener(this);
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public SynthContext getContext(JComponent c) {
- return getContext(c, getComponentState(c));
+ return getContext(c, SynthLookAndFeel.getComponentState(c));
}
private SynthContext getContext(JComponent c, int state) {
@@ -203,14 +213,6 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
SynthLookAndFeel.getRegion(c), style, state);
}
- private Region getRegion(JComponent c) {
- return SynthLookAndFeel.getRegion(c);
- }
-
- private int getComponentState(JComponent c) {
- return SynthLookAndFeel.getComponentState(c);
- }
-
SynthContext getContext(JComponent c, Region region) {
return getContext(c, region, getComponentState(c, region));
}
@@ -233,7 +235,10 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
return state;
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void propertyChange(PropertyChangeEvent e) {
if (SynthLookAndFeel.shouldUpdateStyle(e)) {
updateStyle((JSplitPane)e.getSource());
@@ -243,6 +248,7 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
/**
* Creates the default divider.
*/
+ @Override
public BasicSplitPaneDivider createDefaultDivider() {
SynthSplitPaneDivider divider = new SynthSplitPaneDivider(this);
@@ -250,6 +256,10 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
return divider;
}
+ /**
+ * @inheritDoc
+ */
+ @Override
protected Component createDefaultNonContinuousLayoutDivider() {
return new Canvas() {
public void paint(Graphics g) {
@@ -258,6 +268,10 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
};
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void update(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -268,6 +282,10 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paint(Graphics g, JComponent c) {
SynthContext context = getContext(c);
@@ -275,13 +293,22 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
context.dispose();
}
+ /**
+ * Paints the specified component. This implementation does nothing.
+ *
+ * @param context context for the component being painted
+ * @param g {@code Graphics} object used for painting
+ */
protected void paint(SynthContext context, Graphics g) {
// This is done to update package private variables in
// BasicSplitPaneUI
super.paint(g, splitPane);
}
-
+ /**
+ * @inheritDoc
+ */
+ @Override
public void paintBorder(SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintSplitPaneBorder(context, g, x, y, w, h);
@@ -299,6 +326,10 @@ class SynthSplitPaneUI extends BasicSplitPaneUI implements
context.dispose();
}
+ /**
+ * @inheritDoc
+ */
+ @Override
public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
if(jc == splitPane && getLastDragLocation() != -1 &&
!isContinuousLayout() && !draggingHW) {
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java
index 52e9ef11b08..521addc21bc 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java
@@ -33,7 +33,6 @@ import javax.swing.text.DefaultEditorKit;
import java.util.HashMap;
import java.util.Map;
import javax.swing.text.JTextComponent;
-import sun.swing.plaf.synth.SynthUI;
/**
* SynthStyle
is a set of style properties.
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyleFactory.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyleFactory.java
index 562c0286067..8a0f88f3d65 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyleFactory.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyleFactory.java
@@ -24,10 +24,7 @@
*/
package javax.swing.plaf.synth;
-import java.awt.*;
-import java.util.*;
-import javax.swing.plaf.*;
-import javax.swing.*;
+import javax.swing.JComponent;
/**
* Factory used for obtaining SynthStyle
s. Each of the
diff --git a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
index cef94e151d1..3b026d1fc4c 100644
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
@@ -34,19 +34,21 @@ import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
import sun.swing.SwingUtilities2;
/**
- * A Synth L&F implementation of TabbedPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JTabbedPane}.
+ *
+ *