mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-31 13:15:26 +00:00
8250850: Address reliance on default constructors in the javax.swing.plaf.metal APIs
Reviewed-by: serb
This commit is contained in:
parent
0643f3aa4c
commit
fa31c0de68
@ -57,11 +57,21 @@ public class MetalBorders {
|
||||
static Object NO_BUTTON_ROLLOVER =
|
||||
new StringUIClientPropertyKey("NoButtonRollover");
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalBorders}.
|
||||
*/
|
||||
public MetalBorders() {}
|
||||
|
||||
/**
|
||||
* The class represents the 3D border.
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public static class Flush3DBorder extends AbstractBorder implements UIResource{
|
||||
/**
|
||||
* Constructs a {@code Flush3DBorder}.
|
||||
*/
|
||||
public Flush3DBorder() {}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
if (c.isEnabled()) {
|
||||
@ -88,6 +98,11 @@ public class MetalBorders {
|
||||
*/
|
||||
protected static Insets borderInsets = new Insets( 3, 3, 3, 3 );
|
||||
|
||||
/**
|
||||
* Constructs a {@code ButtonBorder}.
|
||||
*/
|
||||
public ButtonBorder() {}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
|
||||
if (!(c instanceof AbstractButton)) {
|
||||
return;
|
||||
@ -205,6 +220,11 @@ public class MetalBorders {
|
||||
public static class InternalFrameBorder extends AbstractBorder implements UIResource {
|
||||
private static final int corner = 14;
|
||||
|
||||
/**
|
||||
* Constructs a {@code InternalFrameBorder}.
|
||||
*/
|
||||
public InternalFrameBorder() {}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
|
||||
@ -464,6 +484,11 @@ public class MetalBorders {
|
||||
public static class PaletteBorder extends AbstractBorder implements UIResource {
|
||||
int titleHeight = 0;
|
||||
|
||||
/**
|
||||
* Constructs a {@code PaletteBorder}.
|
||||
*/
|
||||
public PaletteBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
|
||||
|
||||
g.translate(x,y);
|
||||
@ -490,6 +515,11 @@ public class MetalBorders {
|
||||
public static class OptionDialogBorder extends AbstractBorder implements UIResource {
|
||||
int titleHeight = 0;
|
||||
|
||||
/**
|
||||
* Constructs a {@code OptionDialogBorder}.
|
||||
*/
|
||||
public OptionDialogBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
|
||||
|
||||
g.translate(x,y);
|
||||
@ -559,6 +589,11 @@ public class MetalBorders {
|
||||
*/
|
||||
protected static Insets borderInsets = new Insets( 1, 0, 1, 0 );
|
||||
|
||||
/**
|
||||
* Constructs a {@code MenuBarBorder}.
|
||||
*/
|
||||
public MenuBarBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
|
||||
g.translate(x, y);
|
||||
|
||||
@ -600,6 +635,11 @@ public class MetalBorders {
|
||||
*/
|
||||
protected static Insets borderInsets = new Insets( 2, 2, 2, 2 );
|
||||
|
||||
/**
|
||||
* Constructs a {@code MenuItemBorder}.
|
||||
*/
|
||||
public MenuItemBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
|
||||
if (!(c instanceof JMenuItem)) {
|
||||
return;
|
||||
@ -655,6 +695,11 @@ public class MetalBorders {
|
||||
*/
|
||||
protected static Insets borderInsets = new Insets( 3, 1, 2, 1 );
|
||||
|
||||
/**
|
||||
* Constructs a {@code PopupMenuBorder}.
|
||||
*/
|
||||
public PopupMenuBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
|
||||
g.translate( x, y );
|
||||
|
||||
@ -682,6 +727,11 @@ public class MetalBorders {
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public static class RolloverButtonBorder extends ButtonBorder {
|
||||
|
||||
/**
|
||||
* Constructs a {@code RolloverButtonBorder}.
|
||||
*/
|
||||
public RolloverButtonBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h ) {
|
||||
AbstractButton b = (AbstractButton) c;
|
||||
ButtonModel model = b.getModel();
|
||||
@ -744,6 +794,11 @@ public class MetalBorders {
|
||||
MetalLookAndFeel.getControlDarkShadow(),
|
||||
UIManager.getColor("ToolBar.background"));
|
||||
|
||||
/**
|
||||
* Constructs a {@code ToolBarBorder}.
|
||||
*/
|
||||
public ToolBarBorder() {}
|
||||
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int w, int h )
|
||||
{
|
||||
if (!(c instanceof JToolBar)) {
|
||||
@ -876,6 +931,11 @@ public class MetalBorders {
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public static class TextFieldBorder extends Flush3DBorder {
|
||||
|
||||
/**
|
||||
* Constructs a {@code TextFieldBorder}.
|
||||
*/
|
||||
public TextFieldBorder() {}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
|
||||
@ -903,6 +963,11 @@ public class MetalBorders {
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public static class ScrollPaneBorder extends AbstractBorder implements UIResource {
|
||||
/**
|
||||
* Constructs a {@code ScrollPaneBorder}.
|
||||
*/
|
||||
public ScrollPaneBorder() {}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y,
|
||||
int w, int h) {
|
||||
|
||||
@ -966,6 +1031,11 @@ public class MetalBorders {
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public static class ToggleButtonBorder extends ButtonBorder {
|
||||
/**
|
||||
* Constructs a {@code ToggleButtonBorder}.
|
||||
*/
|
||||
public ToggleButtonBorder() {}
|
||||
|
||||
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
|
||||
AbstractButton button = (AbstractButton)c;
|
||||
ButtonModel model = button.getModel();
|
||||
@ -1000,6 +1070,11 @@ public class MetalBorders {
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public static class TableHeaderBorder extends javax.swing.border.AbstractBorder {
|
||||
|
||||
/**
|
||||
* Constructs a {@code TableHeaderBorder}.
|
||||
*/
|
||||
public TableHeaderBorder() {}
|
||||
|
||||
/**
|
||||
* The border insets.
|
||||
*/
|
||||
|
||||
@ -76,6 +76,11 @@ public class MetalButtonUI extends BasicButtonUI {
|
||||
// Create PLAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalButtonUI}.
|
||||
*/
|
||||
public MetalButtonUI() {}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code MetalButtonUI}.
|
||||
*
|
||||
|
||||
@ -49,6 +49,11 @@ import javax.swing.plaf.*;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public class MetalCheckBoxIcon implements Icon, UIResource, Serializable {
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalCheckBoxIcon}.
|
||||
*/
|
||||
public MetalCheckBoxIcon() {}
|
||||
|
||||
/**
|
||||
* Returns the size of the control.
|
||||
*
|
||||
|
||||
@ -68,6 +68,11 @@ public class MetalCheckBoxUI extends MetalRadioButtonUI {
|
||||
// Create PlAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalCheckBoxUI}.
|
||||
*/
|
||||
public MetalCheckBoxUI() {}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code MetalCheckBoxUI}.
|
||||
*
|
||||
|
||||
@ -140,5 +140,9 @@ public class MetalComboBoxEditor extends BasicComboBoxEditor {
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public static class UIResource extends MetalComboBoxEditor
|
||||
implements javax.swing.plaf.UIResource {
|
||||
/**
|
||||
* Constructs a {@code UIResource}.
|
||||
*/
|
||||
public UIResource() {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,6 +43,11 @@ import javax.swing.plaf.basic.BasicComboBoxUI;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public class MetalComboBoxIcon implements Icon, Serializable {
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalComboBoxIcon}.
|
||||
*/
|
||||
public MetalComboBoxIcon() {}
|
||||
|
||||
/**
|
||||
* Paints the horizontal bars for the
|
||||
*/
|
||||
|
||||
@ -54,6 +54,11 @@ import java.beans.*;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public class MetalComboBoxUI extends BasicComboBoxUI {
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalComboBoxUI}.
|
||||
*/
|
||||
public MetalComboBoxUI() {}
|
||||
|
||||
/**
|
||||
* Constructs an instance of {@code MetalComboBoxUI}.
|
||||
*
|
||||
@ -210,6 +215,11 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
|
||||
* Instantiate it only within subclasses of {@code MetalComboBoxUI}.
|
||||
*/
|
||||
public class MetalPropertyChangeListener extends BasicComboBoxUI.PropertyChangeHandler {
|
||||
/**
|
||||
* Constructs a {@code MetalPropertyChangeListener}.
|
||||
*/
|
||||
public MetalPropertyChangeListener() {}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent e) {
|
||||
super.propertyChange( e );
|
||||
String propertyName = e.getPropertyName();
|
||||
@ -255,6 +265,11 @@ public class MetalComboBoxUI extends BasicComboBoxUI {
|
||||
* Instantiate it only within subclasses of {@code MetalComboBoxUI}.
|
||||
*/
|
||||
public class MetalComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
|
||||
/**
|
||||
* Constructs a {@code MetalComboBoxLayoutManager}.
|
||||
*/
|
||||
public MetalComboBoxLayoutManager() {}
|
||||
|
||||
public void layoutContainer( Container parent ) {
|
||||
layoutComboBox( parent, this );
|
||||
}
|
||||
|
||||
@ -1129,6 +1129,11 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
|
||||
*/
|
||||
@SuppressWarnings("serial") // Superclass is not serializable across versions
|
||||
public class FilterComboBoxRenderer extends DefaultListCellRenderer {
|
||||
/**
|
||||
* Constructs a {@code FilterComboBoxRenderer}.
|
||||
*/
|
||||
public FilterComboBoxRenderer() {}
|
||||
|
||||
public Component getListCellRendererComponent(JList<?> list,
|
||||
Object value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
|
||||
@ -102,6 +102,11 @@ public class MetalIconFactory implements Serializable {
|
||||
*/
|
||||
public static final boolean LIGHT = true;
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalIconFactory}.
|
||||
*/
|
||||
public MetalIconFactory() {}
|
||||
|
||||
// Accessor functions for Icons. Does the caching work.
|
||||
/**
|
||||
* Returns the instance of {@code FileChooserDetailViewIcon}.
|
||||
@ -645,6 +650,11 @@ public class MetalIconFactory implements Serializable {
|
||||
public static class PaletteCloseIcon implements Icon, UIResource, Serializable{
|
||||
int iconSize = 7;
|
||||
|
||||
/**
|
||||
* Constructs a {@code PaletteCloseIcon}.
|
||||
*/
|
||||
public PaletteCloseIcon() {}
|
||||
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
JButton parentButton = (JButton)c;
|
||||
ButtonModel buttonModel = parentButton.getModel();
|
||||
@ -1648,6 +1658,11 @@ public class MetalIconFactory implements Serializable {
|
||||
|
||||
ImageCacher imageCacher;
|
||||
|
||||
/**
|
||||
* Constructs a {@code FolderIcon16}.
|
||||
*/
|
||||
public FolderIcon16() {}
|
||||
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
GraphicsConfiguration gc = c.getGraphicsConfiguration();
|
||||
if (imageCacher == null) {
|
||||
@ -1739,6 +1754,11 @@ public class MetalIconFactory implements Serializable {
|
||||
*/
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public static class TreeFolderIcon extends FolderIcon16 {
|
||||
/**
|
||||
* Constructs a {@code TreeFolderIcon}.
|
||||
*/
|
||||
public TreeFolderIcon() {}
|
||||
|
||||
public int getShift() { return -1; }
|
||||
public int getAdditionalHeight() { return 2; }
|
||||
}
|
||||
@ -1762,6 +1782,11 @@ public class MetalIconFactory implements Serializable {
|
||||
|
||||
ImageCacher imageCacher;
|
||||
|
||||
/**
|
||||
* Constructs a {@code FileIcon16}.
|
||||
*/
|
||||
public FileIcon16() {}
|
||||
|
||||
public void paintIcon(Component c, Graphics g, int x, int y) {
|
||||
GraphicsConfiguration gc = c.getGraphicsConfiguration();
|
||||
if (imageCacher == null) {
|
||||
@ -1839,6 +1864,10 @@ public class MetalIconFactory implements Serializable {
|
||||
* The class represents a tree leaf icon.
|
||||
*/
|
||||
public static class TreeLeafIcon extends FileIcon16 {
|
||||
/**
|
||||
* Constructs a {@code TreeLeafIcon}.
|
||||
*/
|
||||
public TreeLeafIcon() {}
|
||||
public int getShift() { return 2; }
|
||||
public int getAdditionalHeight() { return 4; }
|
||||
}
|
||||
|
||||
@ -56,6 +56,11 @@ public class MetalLabelUI extends BasicLabelUI
|
||||
|
||||
private static final Object METAL_LABEL_UI_KEY = new Object();
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalLabelUI}.
|
||||
*/
|
||||
public MetalLabelUI() {}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code MetalLabelUI}.
|
||||
*
|
||||
|
||||
@ -108,6 +108,10 @@ public class MetalLookAndFeel extends BasicLookAndFeel
|
||||
*/
|
||||
private static boolean useSystemFonts;
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalLookAndFeel}.
|
||||
*/
|
||||
public MetalLookAndFeel() {}
|
||||
|
||||
/**
|
||||
* Returns true if running on Windows.
|
||||
|
||||
@ -39,6 +39,11 @@ import javax.swing.plaf.basic.*;
|
||||
* @since 1.5
|
||||
*/
|
||||
public class MetalMenuBarUI extends BasicMenuBarUI {
|
||||
/**
|
||||
* Constructs a {@code MetalMenuBarUI}.
|
||||
*/
|
||||
public MetalMenuBarUI() {}
|
||||
|
||||
/**
|
||||
* Creates the <code>ComponentUI</code> implementation for the passed
|
||||
* in component.
|
||||
|
||||
@ -43,6 +43,11 @@ import javax.swing.plaf.*;
|
||||
|
||||
public class MetalPopupMenuSeparatorUI extends MetalSeparatorUI
|
||||
{
|
||||
/**
|
||||
* Constructs a {@code MetalPopupMenuSeparatorUI}.
|
||||
*/
|
||||
public MetalPopupMenuSeparatorUI() {}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MetalPopupMenuSeparatorUI} instance.
|
||||
*
|
||||
|
||||
@ -50,6 +50,11 @@ public class MetalProgressBarUI extends BasicProgressBarUI {
|
||||
private Rectangle innards;
|
||||
private Rectangle box;
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalProgressBarUI}.
|
||||
*/
|
||||
public MetalProgressBarUI() {}
|
||||
|
||||
/**
|
||||
* Constructs an instance of {@code MetalProgressBarUI}.
|
||||
*
|
||||
|
||||
@ -79,6 +79,11 @@ public class MetalRadioButtonUI extends BasicRadioButtonUI {
|
||||
// Create PlAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalRadioButtonUI}.
|
||||
*/
|
||||
public MetalRadioButtonUI() {}
|
||||
|
||||
/**
|
||||
* Returns an instance of {@code MetalRadioButtonUI}.
|
||||
*
|
||||
|
||||
@ -123,6 +123,11 @@ public class MetalRootPaneUI extends BasicRootPaneUI
|
||||
private Cursor lastCursor =
|
||||
Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalRootPaneUI}.
|
||||
*/
|
||||
public MetalRootPaneUI() {}
|
||||
|
||||
/**
|
||||
* Creates a UI for a <code>JRootPane</code>.
|
||||
*
|
||||
|
||||
@ -89,6 +89,11 @@ public class MetalScrollBarUI extends BasicScrollBarUI
|
||||
*/
|
||||
protected boolean isFreeStanding = true;
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalScrollBarUI}.
|
||||
*/
|
||||
public MetalScrollBarUI() {}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MetalScrollBarUI} instance.
|
||||
*
|
||||
|
||||
@ -56,6 +56,11 @@ public class MetalScrollPaneUI extends BasicScrollPaneUI
|
||||
|
||||
private PropertyChangeListener scrollBarSwapListener;
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalScrollPaneUI}.
|
||||
*/
|
||||
public MetalScrollPaneUI() {}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MetalScrollPaneUI}.
|
||||
*
|
||||
|
||||
@ -53,6 +53,11 @@ import javax.swing.plaf.basic.BasicSeparatorUI;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public class MetalSeparatorUI extends BasicSeparatorUI
|
||||
{
|
||||
/**
|
||||
* Constructs a {@code MetalSeparatorUI}.
|
||||
*/
|
||||
public MetalSeparatorUI() {}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MetalSeparatorUI} instance.
|
||||
*
|
||||
|
||||
@ -46,7 +46,10 @@ import javax.swing.plaf.basic.*;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public class MetalSplitPaneUI extends BasicSplitPaneUI
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalSplitPaneUI}.
|
||||
*/
|
||||
public MetalSplitPaneUI() {}
|
||||
|
||||
/**
|
||||
* Creates a new {@code MetalSplitPaneUI} instance
|
||||
|
||||
@ -80,6 +80,11 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
|
||||
// Selected border color for ocean.
|
||||
private Color oceanSelectedBorderColor;
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalTabbedPaneUI}.
|
||||
*/
|
||||
public MetalTabbedPaneUI() {}
|
||||
|
||||
/**
|
||||
* Constructs {@code MetalTabbedPaneUI}.
|
||||
*
|
||||
|
||||
@ -50,6 +50,11 @@ import javax.swing.plaf.basic.*;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public class MetalTextFieldUI extends BasicTextFieldUI {
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalTextFieldUI}.
|
||||
*/
|
||||
public MetalTextFieldUI() {}
|
||||
|
||||
/**
|
||||
* Constructs {@code MetalTextFieldUI}.
|
||||
*
|
||||
|
||||
@ -76,6 +76,11 @@ public abstract class MetalTheme {
|
||||
static ColorUIResource white = new ColorUIResource( 255, 255, 255 );
|
||||
private static ColorUIResource black = new ColorUIResource( 0, 0, 0 );
|
||||
|
||||
/**
|
||||
* Constructor for subclasses to call.
|
||||
*/
|
||||
protected MetalTheme() {}
|
||||
|
||||
/**
|
||||
* Returns the name of this theme.
|
||||
*
|
||||
|
||||
@ -81,6 +81,11 @@ public class MetalToggleButtonUI extends BasicToggleButtonUI {
|
||||
// Create PLAF
|
||||
// ********************************
|
||||
|
||||
/**
|
||||
* Constructs a {@code MetalToggleButtonUI}.
|
||||
*/
|
||||
public MetalToggleButtonUI() {}
|
||||
|
||||
/**
|
||||
* Constructs the {@code MetalToogleButtonUI}.
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user