# HG changeset patch # User yan # Date 1404131556 -14400 # Node ID dbab904451e90ec10d98e364e2fa6db86f4800ef # Parent 487a5e71f6dd32b3f9b752beb2a788b6edd8a14e 8046434: Fix doclint warnings from javax.swing.plaf.metal package Reviewed-by: alexsch Contributed-by: Andrei Eremeev diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalBorders.java Mon Jun 30 16:32:36 2014 +0400 @@ -56,6 +56,9 @@ static Object NO_BUTTON_ROLLOVER = new StringUIClientPropertyKey("NoButtonRollover"); + /** + * The class represents the 3D border. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class Flush3DBorder extends AbstractBorder implements UIResource{ public void paintBorder(Component c, Graphics g, int x, int y, @@ -73,9 +76,15 @@ } } + /** + * The class represents the border of a {@code JButton}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ButtonBorder extends AbstractBorder implements UIResource { + /** + * The border insets. + */ protected static Insets borderInsets = new Insets( 3, 3, 3, 3 ); public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { @@ -188,6 +197,9 @@ } } + /** + * The class represents the border of a {@code JInternalFrame}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class InternalFrameBorder extends AbstractBorder implements UIResource { private static final int corner = 14; @@ -470,6 +482,9 @@ } } + /** + * The class represents the border of an option dialog. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class OptionDialogBorder extends AbstractBorder implements UIResource { int titleHeight = 0; @@ -532,8 +547,15 @@ } } + /** + * The class represents the border of a {@code JMenuBar}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class MenuBarBorder extends AbstractBorder implements UIResource { + + /** + * The border insets. + */ protected static Insets borderInsets = new Insets( 1, 0, 1, 0 ); public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { @@ -569,8 +591,15 @@ } } + /** + * The class represents the border of a {@code JMenuItem}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class MenuItemBorder extends AbstractBorder implements UIResource { + + /** + * The border insets. + */ protected static Insets borderInsets = new Insets( 2, 2, 2, 2 ); public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { @@ -617,8 +646,15 @@ } } + /** + * The class represents the border of a {@code JPopupMenu}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class PopupMenuBorder extends AbstractBorder implements UIResource { + + /** + * The border insets. + */ protected static Insets borderInsets = new Insets( 3, 1, 2, 1 ); public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) { @@ -642,6 +678,9 @@ } } + /** + * The class represents the border of a rollover {@code Button}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class RolloverButtonBorder extends ButtonBorder { @@ -693,9 +732,15 @@ } } + /** + * The class represents the border of a {@code JToolBar}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ToolBarBorder extends AbstractBorder implements UIResource, SwingConstants { + /** + * The instance of {@code MetalBumps}. + */ protected MetalBumps bumps = new MetalBumps( 10, 10, MetalLookAndFeel.getControlHighlight(), MetalLookAndFeel.getControlDarkShadow(), @@ -779,7 +824,9 @@ private static Border buttonBorder; /** - * Returns a border instance for a JButton + * Returns a border instance for a {@code JButton}. + * + * @return a border instance for a {@code JButton} * @since 1.3 */ public static Border getButtonBorder() { @@ -794,7 +841,9 @@ private static Border textBorder; /** - * Returns a border instance for a text component + * Returns a border instance for a text component. + * + * @return a border instance for a text component * @since 1.3 */ public static Border getTextBorder() { @@ -809,7 +858,9 @@ private static Border textFieldBorder; /** - * Returns a border instance for a JTextField + * Returns a border instance for a {@code JTextField}. + * + * @return a border instance for a {@code JTextField} * @since 1.3 */ public static Border getTextFieldBorder() { @@ -821,6 +872,9 @@ return textFieldBorder; } + /** + * The class represents the border of a {@code JTestField}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class TextFieldBorder extends Flush3DBorder { @@ -846,6 +900,9 @@ } } + /** + * The class represents the border of a {@code JScrollPane}. + */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class ScrollPaneBorder extends AbstractBorder implements UIResource { public void paintBorder(Component c, Graphics g, int x, int y, @@ -892,7 +949,9 @@ private static Border toggleButtonBorder; /** - * Returns a border instance for a JToggleButton + * Returns a border instance for a {@code JToggleButton}. + * + * @return a border instance for a {@code JToggleButton} * @since 1.3 */ public static Border getToggleButtonBorder() { @@ -942,6 +1001,10 @@ */ @SuppressWarnings("serial") // Superclass is not serializable across versions public static class TableHeaderBorder extends javax.swing.border.AbstractBorder { + + /** + * The border insets. + */ protected Insets editorBorderInsets = new Insets( 2, 2, 2, 0 ); public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { @@ -964,7 +1027,9 @@ } /** - * Returns a border instance for a Desktop Icon + * Returns a border instance for a Desktop Icon. + * + * @return a border instance for a Desktop Icon * @since 1.3 */ public static Border getDesktopIconBorder() { diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalButtonUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -52,10 +52,22 @@ */ @SuppressWarnings("serial") // Same-version serialization only public class MetalButtonUI extends BasicButtonUI { + // NOTE: These are not really needed, but at this point we can't pull // them. Their values are updated purely for historical reasons. + /** + * The color of the focused button. + */ protected Color focusColor; + + /** + * The color of the selected button. + */ protected Color selectColor; + + /** + * The color of the disabled color. + */ protected Color disabledTextColor; private static final Object METAL_BUTTON_UI_KEY = new Object(); @@ -63,6 +75,13 @@ // ******************************** // Create PLAF // ******************************** + + /** + * Returns an instance of {@code MetalButtonUI}. + * + * @param c a component + * @return an instance of {@code MetalButtonUI} + */ public static ComponentUI createUI(JComponent c) { AppContext appContext = AppContext.getAppContext(); MetalButtonUI metalButtonUI = @@ -96,17 +115,33 @@ // ******************************** // Default Accessors // ******************************** + + /** + * Returns the color of the selected button. + * + * @return the color of the selected button + */ protected Color getSelectColor() { selectColor = UIManager.getColor(getPropertyPrefix() + "select"); return selectColor; } + /** + * Returns the color of a disabled text. + * + * @return the color of a disabled text + */ protected Color getDisabledTextColor() { disabledTextColor = UIManager.getColor(getPropertyPrefix() + "disabledText"); return disabledTextColor; } + /** + * Returns the color of the focused button. + * + * @return the color of the focused button + */ protected Color getFocusColor() { focusColor = UIManager.getColor(getPropertyPrefix() + "focus"); return focusColor; diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxIcon.java Mon Jun 30 16:32:36 2014 +0400 @@ -49,6 +49,11 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalCheckBoxIcon implements Icon, UIResource, Serializable { + /** + * Returns the size of the control. + * + * @return the size of the control + */ protected int getControlSize() { return 13; } public void paintIcon(Component c, Graphics g, int x, int y) { @@ -91,6 +96,14 @@ } } + /** + * Paints {@code MetalCheckBoxIcon}. + * + * @param c a component + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + */ protected void drawCheck(Component c, Graphics g, int x, int y) { int controlSize = getControlSize(); g.fillRect( x+3, y+5, 2, controlSize-8 ); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalCheckBoxUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -67,6 +67,13 @@ // ******************************** // Create PlAF // ******************************** + + /** + * Returns an instance of {@code MetalCheckBoxUI}. + * + * @param b a component + * @return a new instance of {@code MetalCheckBoxUI} + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); MetalCheckBoxUI checkboxUI = diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxButton.java Mon Jun 30 16:32:36 2014 +0400 @@ -50,19 +50,72 @@ */ @SuppressWarnings("serial") // Same-version serialization only public class MetalComboBoxButton extends JButton { + + /** + * The instance of {@code JComboBox}. + */ protected JComboBox comboBox; + + /** + * The instance of {@code JList}. + */ protected JList listBox; + + /** + * The instance of {@code CellRendererPane}. + */ protected CellRendererPane rendererPane; + + /** + * The icon. + */ protected Icon comboIcon; + + /** + * The {@code iconOnly} value. + */ protected boolean iconOnly = false; + /** + * Returns the {@code JComboBox}. + * + * @return the {@code JComboBox} + */ public final JComboBox getComboBox() { return comboBox;} + + /** + * Sets the {@code JComboBox}. + * + * @param cb the {@code JComboBox} + */ public final void setComboBox( JComboBox cb ) { comboBox = cb;} + /** + * Returns the icon of the {@code JComboBox}. + * + * @return the icon of the {@code JComboBox} + */ public final Icon getComboIcon() { return comboIcon;} + + /** + * Sets the icon of the {@code JComboBox}. + * + * @param i the icon of the {@code JComboBox} + */ public final void setComboIcon( Icon i ) { comboIcon = i;} + /** + * Returns the {@code isIconOnly} value. + * + * @return the {@code isIconOnly} value + */ public final boolean isIconOnly() { return iconOnly;} + + /** + * If {@code isIconOnly} is {@code true} then only icon is painted. + * + * @param isIconOnly if {@code true} then only icon is painted + */ public final void setIconOnly( boolean isIconOnly ) { iconOnly = isIconOnly;} MetalComboBoxButton() { @@ -75,6 +128,14 @@ setModel( model ); } + /** + * Constructs a new instance of {@code MetalComboBoxButton}. + * + * @param cb an instance of {@code JComboBox} + * @param i an icon + * @param pane an instance of {@code CellRendererPane} + * @param list an instance of {@code JList} + */ public MetalComboBoxButton( JComboBox cb, Icon i, CellRendererPane pane, JList list ) { this(); @@ -85,6 +146,15 @@ setEnabled( comboBox.isEnabled() ); } + /** + * Constructs a new instance of {@code MetalComboBoxButton}. + * + * @param cb an instance of {@code JComboBox} + * @param i an icon + * @param onlyIcon if {@code true} only icon is painted + * @param pane an instance of {@code CellRendererPane} + * @param list an instance of {@code JList} + */ public MetalComboBoxButton( JComboBox cb, Icon i, boolean onlyIcon, CellRendererPane pane, JList list ) { this( cb, i, pane, list ); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxEditor.java Mon Jun 30 16:32:36 2014 +0400 @@ -50,6 +50,9 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalComboBoxEditor extends BasicComboBoxEditor { + /** + * Constructs a new instance of {@code MetalComboBoxEditor}. + */ public MetalComboBoxEditor() { super(); //editor.removeFocusListener(this); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalComboBoxUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -54,6 +54,12 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalComboBoxUI extends BasicComboBoxUI { + /** + * Constructs an instance of {@code MetalComboBoxUI}. + * + * @param c a component + * @return an instance of {@code MetalComboBoxUI} + */ public static ComponentUI createUI(JComponent c) { return new MetalComboBoxUI(); } @@ -234,6 +240,7 @@ * override. All the functionality of this method is in the * MetalPropertyChangeListener. * + * @param e an instance of {@code PropertyChangeEvent} * @deprecated As of Java 2 platform v1.4. */ @Deprecated @@ -251,11 +258,23 @@ public void layoutContainer( Container parent ) { layoutComboBox( parent, this ); } + + /** + * Lays out the parent container. + * + * @param parent a container + */ public void superLayout( Container parent ) { super.layoutContainer( parent ); } } + /** + * Lays out the {@code JComboBox} in the {@code parent} container. + * + * @param parent a container + * @param manager an instance of {@code MetalComboBoxLayoutManager} + */ // This is here because of a bug in the compiler. // When a protected-inner-class-savvy compiler comes out we // should move this into MetalComboBoxLayoutManager. @@ -367,6 +386,11 @@ @Deprecated public class MetalComboPopup extends BasicComboPopup { + /** + * Constructs a new instance of {@code MetalComboPopup}. + * + * @param cBox an instance of {@code JComboBox} + */ public MetalComboPopup( JComboBox cBox) { super( cBox ); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalDesktopIconUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -48,10 +48,19 @@ TitleListener titleListener; private int width; + /** + * Constructs a new instance of {@code MetalDesktopIconUI}. + * + * @param c a component + * @return a new instance of {@code MetalDesktopIconUI} + */ public static ComponentUI createUI(JComponent c) { return new MetalDesktopIconUI(); } + /** + * Constructs a new instance of {@code MetalDesktopIconUI}. + */ public MetalDesktopIconUI() { } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -138,13 +138,21 @@ } } - // - // ComponentUI Interface Implementation methods - // + /** + * Constructs a new instance of {@code MetalFileChooserUI}. + * + * @param c a component + * @return a new instance of {@code MetalFileChooserUI} + */ public static ComponentUI createUI(JComponent c) { return new MetalFileChooserUI((JFileChooser) c); } + /** + * Constructs a new instance of {@code MetalFileChooserUI}. + * + * @param filechooser a {@code JFileChooser} + */ public MetalFileChooserUI(JFileChooser filechooser) { super(filechooser); } @@ -446,6 +454,11 @@ groupLabels(new AlignedLabel[] { fileNameLabel, filesOfTypeLabel }); } + /** + * Returns the button panel. + * + * @return the button panel + */ protected JPanel getButtonPanel() { if (buttonPanel == null) { buttonPanel = new JPanel(); @@ -453,6 +466,11 @@ return buttonPanel; } + /** + * Returns the bottom panel. + * + * @return the bottom panel + */ protected JPanel getBottomPanel() { if(bottomPanel == null) { bottomPanel = new JPanel(); @@ -503,20 +521,42 @@ SwingUtilities.replaceUIActionMap(fc, actionMap); } + /** + * Returns an instance of {@code ActionMap}. + * + * @return an instance of {@code ActionMap} + */ protected ActionMap getActionMap() { return createActionMap(); } + /** + * Constructs an instance of {@code ActionMap}. + * + * @return an instance of {@code ActionMap} + */ protected ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); FilePane.addActionsToMap(map, filePane.getActions()); return map; } + /** + * Constructs a details view. + * + * @param fc a {@code JFileChooser} + * @return the list + */ protected JPanel createList(JFileChooser fc) { return filePane.createList(); } + /** + * Constructs a details view. + * + * @param fc a {@code JFileChooser} + * @return the details view + */ protected JPanel createDetailsView(JFileChooser fc) { return filePane.createDetailsView(); } @@ -533,7 +573,12 @@ // Obsolete class, not used in this version. protected class SingleClickListener extends MouseAdapter { - public SingleClickListener(JList list) { + /** + * Constructs an instance of {@code SingleClickListener}. + * + * @param list an instance of {@code JList} + */ + public SingleClickListener(JList list) { } } @@ -788,11 +833,16 @@ }; } - + /** + * Removes control buttons from bottom panel. + */ protected void removeControlButtons() { getBottomPanel().remove(getButtonPanel()); } + /** + * Adds control buttons to bottom panel. + */ protected void addControlButtons() { getBottomPanel().add(getButtonPanel()); } @@ -842,15 +892,31 @@ } } + /** + * Returns the directory name. + * + * @return the directory name + */ public String getDirectoryName() { // PENDING(jeff) - get the name from the directory combobox return null; } + /** + * Sets the directory name. + * + * @param dirname the directory name + */ public void setDirectoryName(String dirname) { // PENDING(jeff) - set the name in the directory combobox } + /** + * Constructs a new instance of {@code DirectoryComboBoxRenderer}. + * + * @param fc a {@code JFileChooser} + * @return a new instance of {@code DirectoryComboBoxRenderer} + */ protected DirectoryComboBoxRenderer createDirectoryComboBoxRenderer(JFileChooser fc) { return new DirectoryComboBoxRenderer(); } @@ -906,9 +972,12 @@ } - // - // DataModel for DirectoryComboxbox - // + /** + * Constructs a new instance of {@code DataModel} for {@code DirectoryComboBox}. + * + * @param fc a {@code JFileChooser} + * @return a new instance of {@code DataModel} for {@code DirectoryComboBox} + */ protected DirectoryComboBoxModel createDirectoryComboBoxModel(JFileChooser fc) { return new DirectoryComboBoxModel(); } @@ -924,6 +993,9 @@ JFileChooser chooser = getFileChooser(); FileSystemView fsv = chooser.getFileSystemView(); + /** + * Constructs an instance of {@code DirectoryComboBoxModel}. + */ public DirectoryComboBoxModel() { // Add the current directory to the model, and make it the // selectedDirectory @@ -1017,6 +1089,12 @@ } } + /** + * Returns the depth of {@code i}-th file. + * + * @param i an index + * @return the depth of {@code i}-th file + */ public int getDepth(int i) { return (depths != null && i >= 0 && i < depths.length) ? depths[i] : 0; } @@ -1039,9 +1117,11 @@ } } - // - // Renderer for Types ComboBox - // + /** + * Constructs a {@code Renderer} for types {@code ComboBox}. + * + * @return a {@code Renderer} for types {@code ComboBox} + */ protected FilterComboBoxRenderer createFilterComboBoxRenderer() { return new FilterComboBoxRenderer(); } @@ -1065,9 +1145,11 @@ } } - // - // DataModel for Types Comboxbox - // + /** + * Constructs a {@code DataModel} for types {@code ComboBox}. + * + * @return a {@code DataModel} for types {@code ComboBox} + */ protected FilterComboBoxModel createFilterComboBoxModel() { return new FilterComboBoxModel(); } @@ -1077,7 +1159,15 @@ */ @SuppressWarnings("serial") // Same-version serialization only protected class FilterComboBoxModel extends AbstractListModel implements ComboBoxModel, PropertyChangeListener { + + /** + * An array of file filters. + */ protected FileFilter[] filters; + + /** + * Constructs an instance of {@code FilterComboBoxModel}. + */ protected FilterComboBoxModel() { super(); filters = getFileChooser().getChoosableFileFilters(); @@ -1142,6 +1232,11 @@ } } + /** + * Invokes when {@code ListSelectionEvent} occurs. + * + * @param e an instance of {@code ListSelectionEvent} + */ public void valueChanged(ListSelectionEvent e) { JFileChooser fc = getFileChooser(); File f = fc.getSelectedFile(); @@ -1155,6 +1250,10 @@ */ @SuppressWarnings("serial") // Superclass is not serializable across versions protected class DirectoryComboBoxAction extends AbstractAction { + + /** + * Constructs a new instance of {@code DirectoryComboBoxAction}. + */ protected DirectoryComboBoxAction() { super("DirectoryComboBoxAction"); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java Mon Jun 30 16:32:36 2014 +0400 @@ -90,10 +90,22 @@ private static Icon oceanVerticalSliderThumb; // Constants + /** + * {@code DARK} is used for the property {@code Tree.expandedIcon}. + */ public static final boolean DARK = false; + + /** + * {@code LIGHT} is used for the property {@code Tree.collapsedIcon}. + */ public static final boolean LIGHT = true; // Accessor functions for Icons. Does the caching work. + /** + * Returns the instance of {@code FileChooserDetailViewIcon}. + * + * @return the instance of {@code FileChooserDetailViewIcon} + */ public static Icon getFileChooserDetailViewIcon() { if (fileChooserDetailViewIcon == null) { fileChooserDetailViewIcon = new FileChooserDetailViewIcon(); @@ -101,6 +113,11 @@ return fileChooserDetailViewIcon; } + /** + * Returns the instance of {@code FileChooserHomeFolderIcon}. + * + * @return the instance of {@code FileChooserHomeFolderIcon} + */ public static Icon getFileChooserHomeFolderIcon() { if (fileChooserHomeFolderIcon == null) { fileChooserHomeFolderIcon = new FileChooserHomeFolderIcon(); @@ -108,6 +125,11 @@ return fileChooserHomeFolderIcon; } + /** + * Returns the instance of {@code FileChooserListViewIcon}. + * + * @return the instance of {@code FileChooserListViewIcon} + */ public static Icon getFileChooserListViewIcon() { if (fileChooserListViewIcon == null) { fileChooserListViewIcon = new FileChooserListViewIcon(); @@ -115,6 +137,11 @@ return fileChooserListViewIcon; } + /** + * Returns the instance of {@code FileChooserNewFolderIcon}. + * + * @return the instance of {@code FileChooserNewFolderIcon} + */ public static Icon getFileChooserNewFolderIcon() { if (fileChooserNewFolderIcon == null) { fileChooserNewFolderIcon = new FileChooserNewFolderIcon(); @@ -122,6 +149,11 @@ return fileChooserNewFolderIcon; } + /** + * Returns the instance of {@code FileChooserUpFolderIcon}. + * + * @return the instance of {@code FileChooserUpFolderIcon} + */ public static Icon getFileChooserUpFolderIcon() { if (fileChooserUpFolderIcon == null) { fileChooserUpFolderIcon = new FileChooserUpFolderIcon(); @@ -129,14 +161,31 @@ return fileChooserUpFolderIcon; } + /** + * Constructs a new instance of {@code InternalFrameAltMaximizeIcon}. + * + * @param size the size of the icon + * @return a new instance of {@code InternalFrameAltMaximizeIcon} + */ public static Icon getInternalFrameAltMaximizeIcon(int size) { return new InternalFrameAltMaximizeIcon(size); } + /** + * Constructs a new instance of {@code InternalFrameCloseIcon}. + * + * @param size the size of the icon + * @return a new instance of {@code InternalFrameCloseIcon} + */ public static Icon getInternalFrameCloseIcon(int size) { return new InternalFrameCloseIcon(size); } + /** + * Returns the instance of {@code InternalFrameDefaultMenuIcon}. + * + * @return the instance of {@code InternalFrameDefaultMenuIcon} + */ public static Icon getInternalFrameDefaultMenuIcon() { if (internalFrameDefaultMenuIcon == null) { internalFrameDefaultMenuIcon = new InternalFrameDefaultMenuIcon(); @@ -144,14 +193,31 @@ return internalFrameDefaultMenuIcon; } + /** + * Constructs a new instance of {@code InternalFrameMaximizeIcon}. + * + * @param size the size of the icon + * @return a new instance of {@code InternalFrameMaximizeIcon} + */ public static Icon getInternalFrameMaximizeIcon(int size) { return new InternalFrameMaximizeIcon(size); } + /** + * Constructs a new instance of {@code InternalFrameMinimizeIcon}. + * + * @param size the size of the icon + * @return a new instance of {@code InternalFrameMinimizeIcon} + */ public static Icon getInternalFrameMinimizeIcon(int size) { return new InternalFrameMinimizeIcon(size); } + /** + * Returns the instance of {@code RadioButtonIcon}. + * + * @return the instance of {@code RadioButtonIcon} + */ public static Icon getRadioButtonIcon() { if (radioButtonIcon == null) { radioButtonIcon = new RadioButtonIcon(); @@ -161,6 +227,8 @@ /** * Returns a checkbox icon. + * + * @return a checkbox icon * @since 1.3 */ public static Icon getCheckBoxIcon() { @@ -170,6 +238,11 @@ return checkBoxIcon; } + /** + * Returns the instance of {@code TreeComputerIcon}. + * + * @return the instance of {@code TreeComputerIcon} + */ public static Icon getTreeComputerIcon() { if ( treeComputerIcon == null ) { treeComputerIcon = new TreeComputerIcon(); @@ -177,6 +250,11 @@ return treeComputerIcon; } + /** + * Returns the instance of {@code TreeFloppyDriveIcon}. + * + * @return the instance of {@code TreeFloppyDriveIcon} + */ public static Icon getTreeFloppyDriveIcon() { if ( treeFloppyDriveIcon == null ) { treeFloppyDriveIcon = new TreeFloppyDriveIcon(); @@ -184,10 +262,20 @@ return treeFloppyDriveIcon; } + /** + * Constructs a new instance of {@code TreeFolderIcon}. + * + * @return a new instance of {@code TreeFolderIcon} + */ public static Icon getTreeFolderIcon() { return new TreeFolderIcon(); } + /** + * Returns the instance of {@code TreeHardDriveIcon}. + * + * @return the instance of {@code TreeHardDriveIcon} + */ public static Icon getTreeHardDriveIcon() { if ( treeHardDriveIcon == null ) { treeHardDriveIcon = new TreeHardDriveIcon(); @@ -195,14 +283,30 @@ return treeHardDriveIcon; } + /** + * Constructs a new instance of {@code TreeLeafIcon}. + * + * @return a new instance of {@code TreeLeafIcon} + */ public static Icon getTreeLeafIcon() { return new TreeLeafIcon(); } + /** + * Constructs a new instance of {@code TreeControlIcon}. + * + * @param isCollapsed if {@code true} the icon is collapsed + * @return a new instance of {@code TreeControlIcon} + */ public static Icon getTreeControlIcon( boolean isCollapsed ) { return new TreeControlIcon( isCollapsed ); } + /** + * Returns an icon to be used by {@code JMenu}. + * + * @return an icon to be used by {@code JMenu} + */ public static Icon getMenuArrowIcon() { if (menuArrowIcon == null) { menuArrowIcon = new MenuArrowIcon(); @@ -220,6 +324,11 @@ return null; } + /** + * Returns an icon to be used by {@code JMenuItem}. + * + * @return an icon to be used by {@code JMenuItem} + */ public static Icon getMenuItemArrowIcon() { if (menuItemArrowIcon == null) { menuItemArrowIcon = new MenuItemArrowIcon(); @@ -227,6 +336,11 @@ return menuItemArrowIcon; } + /** + * Returns an icon to be used by {@code JCheckBoxMenuItem}. + * + * @return an icon to be used by {@code JCheckBoxMenuItem} + */ public static Icon getCheckBoxMenuItemIcon() { if (checkBoxMenuItemIcon == null) { checkBoxMenuItemIcon = new CheckBoxMenuItemIcon(); @@ -234,6 +348,11 @@ return checkBoxMenuItemIcon; } + /** + * Returns an icon to be used by {@code JRadioButtonMenuItem}. + * + * @return an icon to be used by {@code JRadioButtonMenuItem} + */ public static Icon getRadioButtonMenuItemIcon() { if (radioButtonMenuItemIcon == null) { radioButtonMenuItemIcon = new RadioButtonMenuItemIcon(); @@ -241,6 +360,11 @@ return radioButtonMenuItemIcon; } + /** + * Returns a thumb icon to be used by horizontal slider. + * + * @return a thumb icon to be used by horizontal slider + */ public static Icon getHorizontalSliderThumbIcon() { if (MetalLookAndFeel.usingOcean()) { if (oceanHorizontalSliderThumb == null) { @@ -253,6 +377,11 @@ return new HorizontalSliderThumbIcon(); } + /** + * Returns a thumb icon to be used by vertical slider. + * + * @return a thumb icon to be used by vertical slider + */ public static Icon getVerticalSliderThumbIcon() { if (MetalLookAndFeel.usingOcean()) { if (oceanVerticalSliderThumb == null) { @@ -1621,7 +1750,18 @@ } + /** + * Returns a shift of the icon. + * + * @return a shift of the icon + */ public int getShift() { return 0; } + + /** + * Returns an additional height of the icon. + * + * @return an additional height of the icon + */ public int getAdditionalHeight() { return 0; } public int getIconWidth() { return folderIcon16Size.width; } @@ -1719,7 +1859,18 @@ } + /** + * Returns a shift of the icon. + * + * @return a shift of the icon + */ public int getShift() { return 0; } + + /** + * Returns an additional height of the icon. + * + * @return an additional height of the icon + */ public int getAdditionalHeight() { return 0; } public int getIconWidth() { return fileIcon16Size.width; } @@ -1727,6 +1878,9 @@ } + /** + * The class represents a tree leaf icon. + */ public static class TreeLeafIcon extends FileIcon16 { public int getShift() { return 2; } public int getAdditionalHeight() { return 4; } @@ -1748,12 +1902,20 @@ */ @SuppressWarnings("serial") // Same-version serialization only public static class TreeControlIcon implements Icon, Serializable { - // This data member should not have been exposed. It's called - // isLight, but now it really means isCollapsed. Since we can't change - // any APIs... that's life. + + /** + * if {@code true} the icon is collapsed. + * NOTE: This data member should not have been exposed. It's called + * {@code isLight}, but now it really means {@code isCollapsed}. + * Since we can't change any APIs... that's life. + */ protected boolean isLight; - + /** + * Constructs an instance of {@code TreeControlIcon}. + * + * @param isCollapsed if {@code true} the icon is collapsed + */ public TreeControlIcon( boolean isCollapsed ) { isLight = isCollapsed; } @@ -1811,6 +1973,14 @@ } } + /** + * Paints the {@code TreeControlIcon}. + * + * @param c a component + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + */ public void paintMe(Component c, Graphics g, int x, int y) { g.setColor( MetalLookAndFeel.getPrimaryControlInfo() ); @@ -1823,7 +1993,7 @@ g.drawLine( xoff + 6, 4, xoff + 9, 4 ); // top g.drawLine( xoff + 10, 5, xoff + 10, 5 ); // top right dot g.drawLine( xoff + 11, 6, xoff + 11, 9 ); // right - g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // botom right dot + g.drawLine( xoff + 10, 10, xoff + 10, 10 ); // bottom right dot g.drawLine( xoff + 6, 11, xoff + 9, 11 ); // bottom g.drawLine( xoff + 5, 10, xoff + 5, 10 ); // bottom left dot diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameTitlePane.java Mon Jun 30 16:32:36 2014 +0400 @@ -46,8 +46,19 @@ @SuppressWarnings("serial") // Superclass is not serializable across versions public class MetalInternalFrameTitlePane extends BasicInternalFrameTitlePane { + /** + * The value {@code isPalette} + */ protected boolean isPalette = false; + + /** + * The palette close icon. + */ protected Icon paletteCloseIcon; + + /** + * The height of the palette title. + */ protected int paletteTitleHeight; private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0); @@ -94,6 +105,11 @@ private Color activeBumpsShadow = MetalLookAndFeel. getPrimaryControlDarkShadow(); + /** + * Constructs a new instance of {@code MetalInternalFrameTitlePane} + * + * @param f an instance of {@code JInternalFrame} + */ public MetalInternalFrameTitlePane(JInternalFrame f) { super( f ); } @@ -307,6 +323,11 @@ } } + /** + * Paints palette. + * + * @param g a instance of {@code Graphics} + */ public void paintPalette(Graphics g) { boolean leftToRight = MetalUtils.isLeftToRight(frame); @@ -471,6 +492,11 @@ bumps.paintIcon(this, g, bumpXOffset, bumpYOffset); } + /** + * If {@code b} is {@code true}, sets palette icons. + * + * @param b if {@code true}, sets palette icons + */ public void setPalette(boolean b) { isPalette = b; diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalInternalFrameUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -47,6 +47,9 @@ private static final Border handyEmptyBorder = new EmptyBorder(0,0,0,0); + /** + * The property {@code JInternalFrame.isPalette}. + */ protected static String IS_PALETTE = "JInternalFrame.isPalette"; private static String IS_PALETTE_KEY = "JInternalFrame.isPalette"; private static String FRAME_TYPE = "JInternalFrame.frameType"; @@ -54,10 +57,22 @@ private static String PALETTE_FRAME = "palette"; private static String OPTION_DIALOG = "optionDialog"; + + /** + * Constructs a new {@code MetalInternalFrameUI} instance. + * + * @param b an internal frame + */ public MetalInternalFrameUI(JInternalFrame b) { super(b); } + /** + * Constructs a new {@code MetalInternalFrameUI} instance. + * + * @param c a component + * @return a new {@code MetalInternalFrameUI} instance + */ public static ComponentUI createUI(JComponent c) { return new MetalInternalFrameUI( (JInternalFrame) c); } @@ -152,6 +167,11 @@ } } + /** + * If {@code isPalette} is {@code true}, sets palette border and title + * + * @param isPalette if {@code true}, sets palette border and title + */ // this should be deprecated - jcs public void setPalette(boolean isPalette) { if (isPalette) { diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLabelUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -56,6 +56,12 @@ private static final Object METAL_LABEL_UI_KEY = new Object(); + /** + * Returns an instance of {@code MetalLabelUI}. + * + * @param c a component + * @return an instance of {@code MetalLabelUI} + */ public static ComponentUI createUI(JComponent c) { if (System.getSecurityManager() != null) { AppContext appContext = AppContext.getAppContext(); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalPopupMenuSeparatorUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -43,6 +43,12 @@ public class MetalPopupMenuSeparatorUI extends MetalSeparatorUI { + /** + * Constructs a new {@code MetalPopupMenuSeparatorUI} instance. + * + * @param c a component + * @return a new {@code MetalPopupMenuSeparatorUI} instance + */ public static ComponentUI createUI( JComponent c ) { return new MetalPopupMenuSeparatorUI(); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalProgressBarUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -50,6 +50,12 @@ private Rectangle innards; private Rectangle box; + /** + * Constructs an instance of {@code MetalProgressBarUI}. + * + * @param c a component + * @return an instance of {@code MetalProgressBarUI} + */ public static ComponentUI createUI(JComponent c) { return new MetalProgressBarUI(); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalRadioButtonUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -58,8 +58,19 @@ private static final Object METAL_RADIO_BUTTON_UI_KEY = new Object(); + /** + * The color of the focused radio button. + */ protected Color focusColor; + + /** + * The color of the selected radio button. + */ protected Color selectColor; + + /** + * The color of a disabled text. + */ protected Color disabledTextColor; private boolean defaults_initialized = false; @@ -67,6 +78,13 @@ // ******************************** // Create PlAF // ******************************** + + /** + * Returns an instance of {@code MetalRadioButtonUI}. + * + * @param c a component + * @return an instance of {@code MetalRadioButtonUI} + */ public static ComponentUI createUI(JComponent c) { AppContext appContext = AppContext.getAppContext(); MetalRadioButtonUI metalRadioButtonUI = @@ -100,14 +118,30 @@ // ******************************** // Default Accessors // ******************************** + + /** + * Returns the color of the selected {@code JRadioButton}. + * + * @return the color of the selected {@code JRadioButton} + */ protected Color getSelectColor() { return selectColor; } + /** + * Returns the color of the disabled text. + * + * @return the color of the disabled text + */ protected Color getDisabledTextColor() { return disabledTextColor; } + /** + * Returns the color of the focused {@code JRadioButton}. + * + * @return the color of the focused {@code JRadioButton} + */ protected Color getFocusColor() { return focusColor; } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -59,17 +59,42 @@ private static Color thumbShadow; private static Color thumbHighlightColor; - + /** + * The metal bumps. + */ protected MetalBumps bumps; + /** + * The increase button. + */ protected MetalScrollButton increaseButton; + + /** + * The decrease button. + */ protected MetalScrollButton decreaseButton; + /** + * The width of the scroll bar. + */ protected int scrollBarWidth; + /** + * The property {@code JScrollBar.isFreeStanding}. + */ public static final String FREE_STANDING_PROP = "JScrollBar.isFreeStanding"; + + /** + * The value of the property {@code JScrollBar.isFreeStanding}. + */ protected boolean isFreeStanding = true; + /** + * Constructs a new {@code MetalScrollBarUI} instance. + * + * @param c a component + * @return a new {@code MetalScrollBarUI} instance + */ public static ComponentUI createUI( JComponent c ) { return new MetalScrollBarUI(); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollButton.java Mon Jun 30 16:32:36 2014 +0400 @@ -59,6 +59,13 @@ private int buttonWidth; + /** + * Constructs an instance of {@code MetalScrollButton}. + * + * @param direction the direction + * @param width the width + * @param freeStanding the free standing value + */ public MetalScrollButton( int direction, int width, boolean freeStanding ) { super( direction ); @@ -70,6 +77,11 @@ isFreeStanding = freeStanding; } + /** + * Sets the free standing value. + * + * @param freeStanding the free standing value + */ public void setFreeStanding( boolean freeStanding ) { isFreeStanding = freeStanding; @@ -115,14 +127,10 @@ g.setColor( arrowColor ); int startY = ((h+1) - arrowHeight) / 2; int startX = (w / 2); - // System.out.println( "startX :" + startX + " startY :"+startY); + for (int line = 0; line < arrowHeight; line++) { g.drawLine( startX-line, startY+line, startX +line+1, startY+line); } - /* g.drawLine( 7, 6, 8, 6 ); - g.drawLine( 6, 7, 9, 7 ); - g.drawLine( 5, 8, 10, 8 ); - g.drawLine( 4, 9, 11, 9 );*/ if (isEnabled) { g.setColor( highlightColor ); @@ -167,17 +175,10 @@ int startY = (((h+1) - arrowHeight) / 2)+ arrowHeight-1; int startX = (w / 2); - // System.out.println( "startX2 :" + startX + " startY2 :"+startY); - for (int line = 0; line < arrowHeight; line++) { g.drawLine( startX-line, startY-line, startX +line+1, startY-line); } - /* g.drawLine( 4, 5, 11, 5 ); - g.drawLine( 5, 6, 10, 6 ); - g.drawLine( 6, 7, 9, 7 ); - g.drawLine( 7, 8, 8, 8 ); */ - if (isEnabled) { g.setColor( highlightColor ); @@ -219,18 +220,10 @@ int startX = (((w+1) - arrowHeight) / 2) + arrowHeight-1; int startY = (h / 2); - //System.out.println( "startX2 :" + startX + " startY2 :"+startY); - for (int line = 0; line < arrowHeight; line++) { g.drawLine( startX-line, startY-line, startX -line, startY+line+1); } - -/* g.drawLine( 5, 4, 5, 11 ); - g.drawLine( 6, 5, 6, 10 ); - g.drawLine( 7, 6, 7, 9 ); - g.drawLine( 8, 7, 8, 8 );*/ - if (isEnabled) { g.setColor( highlightColor ); @@ -274,11 +267,6 @@ g.drawLine( startX+line, startY-line, startX +line, startY+line+1); } - /* g.drawLine( 6, 7, 6, 8 ); - g.drawLine( 7, 6, 7, 9 ); - g.drawLine( 8, 5, 8, 10 ); - g.drawLine( 9, 4, 9, 11 );*/ - if (isEnabled) { g.setColor( highlightColor ); @@ -341,6 +329,11 @@ return new Dimension( Integer.MAX_VALUE, Integer.MAX_VALUE ); } + /** + * Returns the width of the button. + * + * @return the width of the button + */ public int getButtonWidth() { return buttonWidth; } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalScrollPaneUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -56,6 +56,12 @@ private PropertyChangeListener scrollBarSwapListener; + /** + * Constructs a new {@code MetalScrollPaneUI}. + * + * @param x a component + * @return a new {@code MetalScrollPaneUI} + */ public static ComponentUI createUI(JComponent x) { return new MetalScrollPaneUI(); } @@ -97,6 +103,7 @@ } /** + * @param scrollPane an instance of the {@code JScrollPane} * @deprecated - Replaced by {@link #uninstallListeners(JComponent)} */ @Deprecated @@ -136,6 +143,11 @@ } } + /** + * Returns a new {@code PropertyChangeListener} for scroll bar swap events. + * + * @return a new {@code PropertyChangeListener} for scroll bar swap events. + */ protected PropertyChangeListener createScrollBarSwapListener() { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSeparatorUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -53,6 +53,12 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalSeparatorUI extends BasicSeparatorUI { + /** + * Constructs a new {@code MetalSeparatorUI} instance. + * + * @param c a component + * @return a new {@code MetalSeparatorUI} instance. + */ public static ComponentUI createUI( JComponent c ) { return new MetalSeparatorUI(); diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSliderUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -53,13 +53,42 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalSliderUI extends BasicSliderUI { + /** + * The buffer of a tick. + */ protected final int TICK_BUFFER = 4; + + /** + * The value of the property {@code JSlider.isFilled}. + * By default, {@code false} if the property is not set, + * {@code true} for Ocean theme. + */ protected boolean filledSlider = false; + // NOTE: these next five variables are currently unused. + /** + * The color of a thumb + */ protected static Color thumbColor; + + /** + * The color of highlighting. + */ protected static Color highlightColor; + + /** + * The color of dark shadow. + */ protected static Color darkShadowColor; + + /** + * The width of a track. + */ protected static int trackWidth; + + /** + * The length of a tick. + */ protected static int tickLength; private int safeLength; @@ -80,13 +109,24 @@ private static Icon SAFE_HORIZ_THUMB_ICON; private static Icon SAFE_VERT_THUMB_ICON; - + /** + * Property for {@code JSlider.isFilled}. + */ protected final String SLIDER_FILL = "JSlider.isFilled"; + /** + * Constructs a {@code MetalSliderUI} instance. + * + * @param c a component + * @return a {@code MetalSliderUI} instance + */ public static ComponentUI createUI(JComponent c) { return new MetalSliderUI(); } + /** + * Constructs a {@code MetalSliderUI} instance. + */ public MetalSliderUI() { super( null ); } @@ -126,10 +166,19 @@ prepareFilledSliderField(); } + /** + * Constructs {@code MetalPropertyListener}. + * + * @param slider a {@code JSlider} + * @return the {@code MetalPropertyListener} + */ protected PropertyChangeListener createPropertyChangeListener( JSlider slider ) { return new MetalPropertyListener(); } + /** + * {@code PropertyListener} for {@code JSlider.isFilled}. + */ protected class MetalPropertyListener extends BasicSliderUI.PropertyChangeHandler { public void propertyChange( PropertyChangeEvent e ) { // listen for slider fill super.propertyChange( e ); @@ -485,6 +534,8 @@ /** * Returns the shorter dimension of the track. + * + * @return the shorter dimension of the track */ protected int getTrackWidth() { // This strange calculation is here to keep the @@ -504,6 +555,8 @@ /** * Returns the longer dimension of the slide bar. (The slide bar is only the * part that runs directly under the thumb) + * + * @return the longer dimension of the slide bar */ protected int getTrackLength() { if ( slider.getOrientation() == JSlider.HORIZONTAL ) { @@ -514,6 +567,8 @@ /** * Returns the amount that the thumb goes past the slide bar. + * + * @return the amount that the thumb goes past the slide bar */ protected int getThumbOverhang() { return (int)(getThumbSize().getHeight()-getTrackWidth())/2; diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalSplitPaneUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -49,15 +49,20 @@ /** - * Creates a new MetalSplitPaneUI instance - */ + * Creates a new {@code MetalSplitPaneUI} instance + * + * @param x a component + * @return a new {@code MetalSplitPaneUI} instance + */ public static ComponentUI createUI(JComponent x) { return new MetalSplitPaneUI(); } /** - * Creates the default divider. - */ + * Creates the default divider. + * + * @return the default divider + */ public BasicSplitPaneDivider createDefaultDivider() { return new MetalSplitPaneDivider(this); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -50,12 +50,27 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalTabbedPaneUI extends BasicTabbedPaneUI { + /** + * The minimum width of a pane. + */ protected int minTabWidth = 40; // Background color for unselected tabs that don't have an explicitly // set color. private Color unselectedBackground; + + /** + * The color of tab's background. + */ protected Color tabAreaBackground; + + /** + * The color of the selected pane. + */ protected Color selectColor; + + /** + * The color of the highlight. + */ protected Color selectHighlight; private boolean tabsOpaque = true; @@ -65,6 +80,12 @@ // Selected border color for ocean. private Color oceanSelectedBorderColor; + /** + * Constructs {@code MetalTabbedPaneUI}. + * + * @param x a component + * @return an instance of {@code MetalTabbedPaneUI} + */ public static ComponentUI createUI( JComponent x ) { return new MetalTabbedPaneUI(); } @@ -116,6 +137,19 @@ } + /** + * Paints the top tab border. + * + * @param tabIndex a tab index + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param btm bottom + * @param rght right + * @param isSelected a selection + */ protected void paintTopTabBorder( int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, @@ -286,6 +320,15 @@ g.translate( -x, -y ); } + /** + * Returns {@code true} if the gap should be filled. + * + * @param currentRun the current run + * @param tabIndex the tab index + * @param x an X coordinate + * @param y an Y coordinate + * @return {@code true} if the gap should be filled + */ protected boolean shouldFillGap( int currentRun, int tabIndex, int x, int y ) { boolean result = false; @@ -322,6 +365,14 @@ return result; } + /** + * Returns the color of the gap. + * + * @param currentRun the current run + * @param x an X coordinate + * @param y an Y coordinate + * @return the color of the gap + */ protected Color getColorForGap( int currentRun, int x, int y ) { final int shadowWidth = 4; int selectedIndex = tabPane.getSelectedIndex(); @@ -349,6 +400,19 @@ return tabPane.getBackground(); } + /** + * Paints the left tab border. + * + * @param tabIndex a tab index + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param btm bottom + * @param rght right + * @param isSelected a selection + */ protected void paintLeftTabBorder( int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, @@ -466,6 +530,19 @@ } + /** + * Paints the bottom tab border. + * + * @param tabIndex a tab index + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param btm bottom + * @param rght right + * @param isSelected a selection + */ protected void paintBottomTabBorder( int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, @@ -623,6 +700,19 @@ g.translate( -x, -y ); } + /** + * Paints the right tab border. + * + * @param tabIndex a tab index + * @param g an instance of {@code Graphics} + * @param x an X coordinate + * @param y an Y coordinate + * @param w a width + * @param h a height + * @param btm bottom + * @param rght right + * @param isSelected a selection + */ protected void paintRightTabBorder( int tabIndex, Graphics g, int x, int y, int w, int h, int btm, int rght, @@ -842,6 +932,9 @@ super.paint( g, c ); } + /** + * Paints highlights below tab. + */ protected void paintHighlightBelowTab( ) { } @@ -1158,7 +1251,13 @@ return 0; } - // Don't rotate runs! + /** + * Returns {@code true} if tab runs should be rotated. + * + * @param tabPlacement a tab placement + * @param selectedRun a selected run + * @return {@code true} if tab runs should be rotated. + */ protected boolean shouldRotateTabRuns( int tabPlacement, int selectedRun ) { return false; } @@ -1200,6 +1299,9 @@ */ public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout { + /** + * Constructs {@code TabbedPaneLayout}. + */ public TabbedPaneLayout() { MetalTabbedPaneUI.this.super(); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTextFieldUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -50,6 +50,12 @@ @SuppressWarnings("serial") // Same-version serialization only public class MetalTextFieldUI extends BasicTextFieldUI { + /** + * Constructs {@code MetalTextFieldUI}. + * + * @param c a component + * @return the instance of {@code MetalTextFieldUI} + */ public static ComponentUI createUI(JComponent c) { return new MetalTextFieldUI(); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToggleButtonUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -60,8 +60,19 @@ private static final Object METAL_TOGGLE_BUTTON_UI_KEY = new Object(); + /** + * The color of a focused toggle button. + */ protected Color focusColor; + + /** + * The color of a selected button. + */ protected Color selectColor; + + /** + * The color of a disabled text. + */ protected Color disabledTextColor; private boolean defaults_initialized = false; @@ -69,6 +80,13 @@ // ******************************** // Create PLAF // ******************************** + + /** + * Constructs the {@code MetalToogleButtonUI}. + * + * @param b a component + * @return the {@code MetalToogleButtonUI}. + */ public static ComponentUI createUI(JComponent b) { AppContext appContext = AppContext.getAppContext(); MetalToggleButtonUI metalToggleButtonUI = @@ -101,14 +119,29 @@ // ******************************** // Default Accessors // ******************************** + /** + * Returns the color of a selected button. + * + * @return the color of a selected button + */ protected Color getSelectColor() { return selectColor; } + /** + * Returns the color of a disabled text. + * + * @return the color of a disabled text + */ protected Color getDisabledTextColor() { return disabledTextColor; } + /** + * Returns the color of a focused toggle button. + * + * @return the color of a focused toggle button + */ protected Color getFocusColor() { return focusColor; } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -158,6 +158,12 @@ return false; } + /** + * Constructs an instance of {@code MetalToolBarUI}. + * + * @param c a component + * @return an instance of {@code MetalToolBarUI} + */ public static ComponentUI createUI( JComponent c ) { return new MetalToolBarUI(); @@ -269,6 +275,11 @@ return new MetalDockingListener( toolBar ); } + /** + * Sets the offset of the mouse cursor inside the DragWindow. + * + * @param p the offset + */ protected void setDragOffset(Point p) { if (!GraphicsEnvironment.isHeadless()) { if (dragWindow == null) { @@ -346,17 +357,29 @@ } } - // No longer used. Cannot remove for compatibility reasons + /** + * No longer used. The class cannot be removed for compatibility reasons. + */ protected class MetalContainerListener extends BasicToolBarUI.ToolBarContListener {} - // No longer used. Cannot remove for compatibility reasons + /** + * No longer used. The class cannot be removed for compatibility reasons. + */ protected class MetalRolloverListener extends BasicToolBarUI.PropertyListener {} + /** + * {@code DockingListener} for {@code MetalToolBarUI}. + */ protected class MetalDockingListener extends DockingListener { private boolean pressedInBumps = false; + /** + * Constructs the {@code MetalDockingListener}. + * + * @param t an instance of {@code JToolBar} + */ public MetalDockingListener(JToolBar t) { super(t); } diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalToolTipUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -58,13 +58,26 @@ private Font smallFont; // Refer to note in getAcceleratorString about this field. private JToolTip tip; + + /** + * The space between strings. + */ public static final int padSpaceBetweenStrings = 12; private String acceleratorDelimiter; + /** + * Constructs an instance of the {@code MetalToolTipUI}. + */ public MetalToolTipUI() { super(); } + /** + * Returns an instance of the {@code MetalToolTipUI}. + * + * @param c a component + * @return an instance of the {@code MetalToolTipUI}. + */ public static ComponentUI createUI(JComponent c) { return sharedInstance; } @@ -148,6 +161,12 @@ return d; } + /** + * If the accelerator is hidden, the method returns {@code true}, + * otherwise, returns {@code false}. + * + * @return {@code true} if the accelerator is hidden. + */ protected boolean isAcceleratorHidden() { Boolean b = (Boolean)UIManager.get("ToolTip.hideAccelerator"); return b != null && b.booleanValue(); @@ -162,6 +181,11 @@ return retValue; } + /** + * Returns the accelerator string. + * + * @return the accelerator string. + */ // NOTE: This requires the tip field to be set before this is invoked. // As MetalToolTipUI is shared between all JToolTips the tip field is // set appropriately before this is invoked. Unfortunately this means diff -r 487a5e71f6dd -r dbab904451e9 jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java --- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Fri Jun 27 10:26:39 2014 -0700 +++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalTreeUI.java Mon Jun 30 16:32:36 2014 +0400 @@ -93,20 +93,26 @@ private int lineStyle = LEG_LINE_STYLE; private PropertyChangeListener lineStyleListener = new LineListener(); - // Boilerplate + /** + * Constructs the {@code MetalTreeUI}. + * + * @param x a component + * @return the instance of the {@code MetalTreeUI} + */ public static ComponentUI createUI(JComponent x) { return new MetalTreeUI(); } - public MetalTreeUI() - { + /** + * Constructs the {@code MetalTreeUI}. + */ + public MetalTreeUI() { super(); } - protected int getHorizontalLegBuffer() - { - return 3; - } + protected int getHorizontalLegBuffer() { + return 3; + } public void installUI( JComponent c ) { super.installUI( c ); @@ -123,24 +129,36 @@ super.uninstallUI(c); } - /** this function converts between the string passed into the client property - * and the internal representation (currently and int) - * - */ + /** + * Converts between the string passed into the client property + * and the internal representation (currently and int) + * + * @param lineStyleFlag a flag + */ protected void decodeLineStyle(Object lineStyleFlag) { - if ( lineStyleFlag == null || - lineStyleFlag.equals(LEG_LINE_STYLE_STRING)){ - lineStyle = LEG_LINE_STYLE; // default case - } else { - if ( lineStyleFlag.equals(NO_STYLE_STRING) ) { - lineStyle = NO_LINE_STYLE; - } else if ( lineStyleFlag.equals(HORIZ_STYLE_STRING) ) { - lineStyle = HORIZ_LINE_STYLE; - } - } - + if ( lineStyleFlag == null || + lineStyleFlag.equals(LEG_LINE_STYLE_STRING)) { + lineStyle = LEG_LINE_STYLE; // default case + } else { + if ( lineStyleFlag.equals(NO_STYLE_STRING) ) { + lineStyle = NO_LINE_STYLE; + } else if ( lineStyleFlag.equals(HORIZ_STYLE_STRING) ) { + lineStyle = HORIZ_LINE_STYLE; + } + } } + /** + * Returns {@code true} if a point with X coordinate {@code mouseX} + * and Y coordinate {@code mouseY} is in expanded control. + * + * @param row a row + * @param rowLevel a row level + * @param mouseX X coordinate + * @param mouseY Y coordinate + * @return {@code true} if a point with X coordinate {@code mouseX} + * and Y coordinate {@code mouseY} is in expanded control. + */ protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY) { if(tree != null && !isLeaf(row)) { @@ -175,6 +193,12 @@ } } + /** + * Paints the horizontal separators. + * + * @param g an instance of {@code Graphics} + * @param c a component + */ protected void paintHorizontalSeparators(Graphics g, JComponent c) { g.setColor( lineColor );