Skip to content
Permalink
Browse files
8252722: More Swing plaf APIs that rely on default constructors
Reviewed-by: prr
  • Loading branch information
prsadhuk committed Sep 24, 2020
1 parent 3495c19 commit 527a30930e86531c53ba82483e9098a690b132ed
Showing with 468 additions and 4 deletions.
  1. +10 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicBorders.java
  2. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonUI.java
  3. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicCheckBoxMenuItemUI.java
  4. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicCheckBoxUI.java
  5. +10 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicColorChooserUI.java
  6. +4 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
  7. +4 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java
  8. +35 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java
  9. +39 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java
  10. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDesktopIconUI.java
  11. +20 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicDesktopPaneUI.java
  12. +16 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java
  13. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
  14. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicGraphicsUtils.java
  15. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicHTML.java
  16. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicIconFactory.java
  17. +14 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
  18. +29 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameUI.java
  19. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java
  20. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuUI.java
  21. +15 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
  22. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicScrollPaneUI.java
  23. +10 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneDivider.java
  24. +15 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java
  25. +29 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java
  26. +10 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java
  27. +20 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTableUI.java
  28. +12 −2 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java
  29. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToggleButtonUI.java
  30. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolBarSeparatorUI.java
  31. +25 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java
  32. +55 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java
  33. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/basic/BasicViewportUI.java
  34. +4 −0 src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
  35. +5 −0 src/java.desktop/share/classes/javax/swing/plaf/metal/MetalSliderUI.java
  36. +17 −2 src/java.desktop/share/classes/javax/swing/plaf/metal/MetalToolBarUI.java
@@ -47,6 +47,11 @@

public class BasicBorders {

/**
* Constructs a {@code BasicBorders}.
*/
public BasicBorders() {}

/**
* Returns a border instance for a {@code JButton}.
*
@@ -473,6 +478,11 @@ public Insets getBorderInsets(Component c, Insets insets) {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
public static class MarginBorder extends AbstractBorder implements UIResource {
/**
* Constructs a {@code MarginBorder}.
*/
public MarginBorder() {}

public Insets getBorderInsets(Component c, Insets insets) {
Insets margin = null;
//
@@ -76,6 +76,11 @@
// ********************************
// Create PLAF
// ********************************
/**
* Constructs a {@code BasicButtonUI}.
*/
public BasicButtonUI() {}

/**
* Returns an instance of {@code BasicButtonUI}.
*
@@ -39,6 +39,11 @@
*/
public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI {

/**
* Constructs a {@code BasicCheckBoxMenuItemUI}.
*/
public BasicCheckBoxMenuItemUI() {}

/**
* Constructs a new instance of {@code BasicCheckBoxMenuItemUI}.
*
@@ -60,6 +60,11 @@
// Create PLAF
// ********************************

/**
* Constructs a {@code BasicCheckBoxUI}.
*/
public BasicCheckBoxUI() {}

/**
* Returns an instance of {@code BasicCheckBoxUI}.
*
@@ -77,6 +77,11 @@
protected PropertyChangeListener propertyChangeListener;
private Handler handler;

/**
* Constructs a {@code BasicColorChooserUI}.
*/
public BasicColorChooserUI() {}

/**
* Returns a new instance of {@code BasicColorChooserUI}.
*
@@ -383,6 +388,11 @@ else if (prop == "componentOrientation") {
* Instantiate it only within subclasses of {@code BasicColorChooserUI}.
*/
public class PropertyHandler implements PropertyChangeListener {
/**
* Constructs a {@code PropertyHandler}.
*/
public PropertyHandler() {}

public void propertyChange(PropertyChangeEvent e) {
getHandler().propertyChange(e);
}
@@ -176,5 +176,9 @@ public void setBorder(Border b) {
@SuppressWarnings("serial") // Same-version serialization only
public static class UIResource extends BasicComboBoxEditor
implements javax.swing.plaf.UIResource {
/**
* Constructs a {@code UIResource}.
*/
public UIResource() {}
}
}
@@ -145,5 +145,9 @@ public Component getListCellRendererComponent(JList<?> list,
*/
@SuppressWarnings("serial") // Same-version serialization only
public static class UIResource extends BasicComboBoxRenderer implements javax.swing.plaf.UIResource {
/**
* Constructs a {@code UIResource}.
*/
public UIResource() {}
}
}
@@ -232,6 +232,11 @@
*/
protected Insets padding;

/**
* Constructs a {@code BasicComboBoxUI}.
*/
public BasicComboBoxUI() {}

// Used for calculating the default size.
private static ListCellRenderer<Object> getDefaultListCellRenderer() {
@SuppressWarnings("unchecked")
@@ -592,6 +597,11 @@ private Handler getHandler() {
* <code>BasicComboBoxUI</code>.
*/
public class KeyHandler extends KeyAdapter {
/**
* Constructs a {@code KeyHandler}.
*/
public KeyHandler() {}

@Override
public void keyPressed( KeyEvent e ) {
getHandler().keyPressed(e);
@@ -607,6 +617,11 @@ public void keyPressed( KeyEvent e ) {
* <code>BasicComboBoxUI</code>.
*/
public class FocusHandler implements FocusListener {
/**
* Constructs a {@code FocusHandler}.
*/
public FocusHandler() {}

public void focusGained( FocusEvent e ) {
getHandler().focusGained(e);
}
@@ -627,6 +642,11 @@ public void focusLost( FocusEvent e ) {
* @see #createListDataListener
*/
public class ListDataHandler implements ListDataListener {
/**
* Constructs a {@code ListDataHandler}.
*/
public ListDataHandler() {}

public void contentsChanged( ListDataEvent e ) {
getHandler().contentsChanged(e);
}
@@ -651,6 +671,11 @@ public void intervalRemoved( ListDataEvent e ) {
* @see #createItemListener
*/
public class ItemHandler implements ItemListener {
/**
* Constructs a {@code ItemHandler}.
*/
public ItemHandler() {}

// This class used to implement behavior which is now redundant.
public void itemStateChanged(ItemEvent e) {}
}
@@ -670,6 +695,11 @@ public void itemStateChanged(ItemEvent e) {}
* @see #createPropertyChangeListener
*/
public class PropertyChangeHandler implements PropertyChangeListener {
/**
* Constructs a {@code PropertyChangeHandler}.
*/
public PropertyChangeHandler() {}

public void propertyChange(PropertyChangeEvent e) {
getHandler().propertyChange(e);
}
@@ -697,6 +727,11 @@ private void updateToolTipTextForChildren() {
* <code>BasicComboBoxUI</code>.
*/
public class ComboBoxLayoutManager implements LayoutManager {
/**
* Constructs a {@code ComboBoxLayoutManager}.
*/
public ComboBoxLayoutManager() {}

public void addLayoutComponent(String name, Component comp) {}

public void removeLayoutComponent(Component comp) {}
@@ -733,6 +733,11 @@ public void actionPerformed(ActionEvent e){
* @see BasicComboPopup#createMouseListener
*/
protected class InvocationMouseHandler extends MouseAdapter {
/**
* Constructs an {@code InvocationMouseHandler}.
*/
protected InvocationMouseHandler() {}

/**
* Responds to mouse-pressed events on the combo box.
*
@@ -758,6 +763,11 @@ public void mouseReleased( MouseEvent e ) {
* list if it is dragging over the list.
*/
protected class InvocationMouseMotionHandler extends MouseMotionAdapter {
/**
* Constructs an {@code InvocationMouseMotionHandler}.
*/
protected InvocationMouseMotionHandler() {}

public void mouseDragged( MouseEvent e ) {
getHandler().mouseDragged(e);
}
@@ -771,6 +781,10 @@ public void mouseDragged( MouseEvent e ) {
* BasicComboBoxUI ActionMap/InputMap methods.
*/
public class InvocationKeyHandler extends KeyAdapter {
/**
* Constructs an {@code InvocationKeyHandler}.
*/
public InvocationKeyHandler() {}
public void keyReleased( KeyEvent e ) {}
}

@@ -780,6 +794,10 @@ public void keyReleased( KeyEvent e ) {}
* override.
*/
protected class ListSelectionHandler implements ListSelectionListener {
/**
* Constructs a {@code ListSelectionHandler}.
*/
protected ListSelectionHandler() {}
public void valueChanged( ListSelectionEvent e ) {}
}

@@ -793,6 +811,10 @@ public void valueChanged( ListSelectionEvent e ) {}
* @see #createItemListener
*/
public class ListDataHandler implements ListDataListener {
/**
* Constructs a {@code ListDataHandler}.
*/
public ListDataHandler() {}
public void contentsChanged( ListDataEvent e ) {}

public void intervalAdded( ListDataEvent e ) {
@@ -806,6 +828,10 @@ public void intervalRemoved( ListDataEvent e ) {
* This listener hides the popup when the mouse is released in the list.
*/
protected class ListMouseHandler extends MouseAdapter {
/**
* Constructs a {@code ListMouseHandler}.
*/
protected ListMouseHandler() {}
public void mousePressed( MouseEvent e ) {
}
public void mouseReleased(MouseEvent anEvent) {
@@ -818,6 +844,11 @@ public void mouseReleased(MouseEvent anEvent) {
* The selection change is not committed to the model, this is for user feedback only.
*/
protected class ListMouseMotionHandler extends MouseMotionAdapter {
/**
* Constructs a {@code ListMouseMotionHandler}.
*/
protected ListMouseMotionHandler() {}

public void mouseMoved( MouseEvent anEvent ) {
getHandler().mouseMoved(anEvent);
}
@@ -828,6 +859,10 @@ public void mouseMoved( MouseEvent anEvent ) {
* combo box.
*/
protected class ItemHandler implements ItemListener {
/**
* Constructs an {@code ItemHandler}.
*/
protected ItemHandler() {}
public void itemStateChanged( ItemEvent e ) {
getHandler().itemStateChanged(e);
}
@@ -844,6 +879,10 @@ public void itemStateChanged( ItemEvent e ) {
* @see #createPropertyChangeListener
*/
protected class PropertyChangeHandler implements PropertyChangeListener {
/**
* Constructs a {@code PropertyChangeHandler}.
*/
protected PropertyChangeHandler() {}
public void propertyChange( PropertyChangeEvent e ) {
getHandler().propertyChange(e);
}
@@ -243,6 +243,11 @@ public void deiconize() {
int __x, __y;
Rectangle startingBounds;

/**
* Constructs a {@code MouseInputHandler}.
*/
public MouseInputHandler() {}

public void mouseReleased(MouseEvent e) {
_x = 0;
_y = 0;
@@ -678,6 +678,10 @@ public boolean accept(Object sender) {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class OpenAction extends AbstractAction {
/**
* Constructs an {@code OpenAction}.
*/
protected OpenAction() {}
public void actionPerformed(ActionEvent evt) {
JDesktopPane dp = (JDesktopPane)evt.getSource();
SHARED_ACTION.setState(dp, Actions.RESTORE);
@@ -693,6 +697,10 @@ public boolean isEnabled() {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class CloseAction extends AbstractAction {
/**
* Constructs a {@code CloseAction}.
*/
protected CloseAction() {}
public void actionPerformed(ActionEvent evt) {
JDesktopPane dp = (JDesktopPane)evt.getSource();
SHARED_ACTION.setState(dp, Actions.CLOSE);
@@ -712,6 +720,10 @@ public boolean isEnabled() {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class MinimizeAction extends AbstractAction {
/**
* Constructs a {@code MinimizeAction}.
*/
protected MinimizeAction() {}
public void actionPerformed(ActionEvent evt) {
JDesktopPane dp = (JDesktopPane)evt.getSource();
SHARED_ACTION.setState(dp, Actions.MINIMIZE);
@@ -731,6 +743,10 @@ public boolean isEnabled() {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class MaximizeAction extends AbstractAction {
/**
* Constructs a {@code MaximizeAction}.
*/
protected MaximizeAction() {}
public void actionPerformed(ActionEvent evt) {
JDesktopPane dp = (JDesktopPane)evt.getSource();
SHARED_ACTION.setState(dp, Actions.MAXIMIZE);
@@ -750,6 +766,10 @@ public boolean isEnabled() {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class NavigateAction extends AbstractAction {
/**
* Constructs a {@code NavigateAction}.
*/
protected NavigateAction() {}
public void actionPerformed(ActionEvent evt) {
JDesktopPane dp = (JDesktopPane)evt.getSource();
dp.selectFrame(true);
@@ -757,6 +757,12 @@ public void mouseClicked(MouseEvent e) {
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.

/**
* Constructs a {@code SelectionListener}.
*/
protected SelectionListener() {}

/** {@inheritDoc} */
public void valueChanged(ListSelectionEvent e) {
getHandler().valueChanged(e);
@@ -1325,6 +1331,11 @@ public String getDescription() {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class CancelSelectionAction extends AbstractAction {
/**
* Constructs a {@code CancelSelectionAction}.
*/
protected CancelSelectionAction() {}

/** {@inheritDoc} */
public void actionPerformed(ActionEvent e) {
getFileChooser().cancelSelection();
@@ -1336,6 +1347,11 @@ public void actionPerformed(ActionEvent e) {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class UpdateAction extends AbstractAction {
/**
* Constructs an {@code UpdateAction}.
*/
protected UpdateAction() {}

/** {@inheritDoc} */
public void actionPerformed(ActionEvent e) {
JFileChooser fc = getFileChooser();

1 comment on commit 527a309

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 527a309 Sep 24, 2020

Please sign in to comment.