Browse Source

formatting and code style.

pull/127/head
weisj 5 years ago
parent
commit
1760744807
  1. 3
      core/src/main/java/com/github/weisj/darklaf/DarkLaf.java
  2. 47
      core/src/main/java/com/github/weisj/darklaf/LafManager.java
  3. 6
      core/src/main/java/com/github/weisj/darklaf/color/ColorWrapper.java
  4. 24
      core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java
  5. 8
      core/src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java
  6. 4
      core/src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java
  7. 4
      core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java
  8. 4
      core/src/main/java/com/github/weisj/darklaf/components/border/DarkBorders.java
  9. 9
      core/src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java
  10. 8
      core/src/main/java/com/github/weisj/darklaf/components/border/WeakLineBorder.java
  11. 3
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java
  12. 7
      core/src/main/java/com/github/weisj/darklaf/components/text/LineHighlighter.java
  13. 7
      core/src/main/java/com/github/weisj/darklaf/components/text/NumberingPane.java
  14. 2
      core/src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java
  15. 8
      core/src/main/java/com/github/weisj/darklaf/components/text/TextFieldHistoryPopup.java
  16. 11
      core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java
  17. 3
      core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java
  18. 3
      core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java
  19. 44
      core/src/main/java/com/github/weisj/darklaf/theme/Theme.java
  20. 33
      core/src/main/java/com/github/weisj/darklaf/ui/BasicTransferable.java
  21. 3
      core/src/main/java/com/github/weisj/darklaf/ui/DragRecognitionSupport.java
  22. 24
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  23. 2
      core/src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java
  24. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPreviewComponent.java
  25. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheelImageProducer.java
  26. 3
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserPanel.java
  27. 7
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkSwatchesChooserPanel.java
  28. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/SlideComponent.java
  29. 16
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxBorder.java
  30. 2
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxListener.java
  31. 19
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java
  32. 65
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUIBridge.java
  33. 2
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePane.java
  34. 68
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePaneUIBridge.java
  35. 5
      core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameTitlePane.java
  36. 4
      core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java
  37. 2
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListCellFocusBorder.java
  38. 26
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java
  39. 2
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuBarBorder.java
  40. 12
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuItemUIBase.java
  41. 6
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java
  42. 9
      core/src/main/java/com/github/weisj/darklaf/ui/numberingpane/DarkNumberingPaneUI.java
  43. 5
      core/src/main/java/com/github/weisj/darklaf/ui/optionpane/DarkOptionPaneUI.java
  44. 3
      core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/DarkPopupMenuBorder.java
  45. 9
      core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarUI.java
  46. 2
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java
  47. 20
      core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarListener.java
  48. 10
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerBorder.java
  49. 14
      core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneDivider.java
  50. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkHandler.java
  51. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabPanel.java
  52. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java
  53. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabAreaButton.java
  54. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneLayout.java
  55. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java
  56. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUI.java
  57. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/MoreTabsButton.java
  58. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java
  59. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/ScrollableTabPanel.java
  60. 17
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneTransferHandler.java
  61. 6
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneUtil.java
  62. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java
  63. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameComponentPopupMenu.java
  64. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java
  65. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameUI.java
  66. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabDragListener.java
  67. 9
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameLayout.java
  68. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameTransferHandler.java
  69. 4
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableCellFocusBorder.java
  70. 4
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderCorner.java
  71. 3
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java
  72. 12
      core/src/main/java/com/github/weisj/darklaf/ui/table/TableUIBridge.java
  73. 2
      core/src/main/java/com/github/weisj/darklaf/ui/table/TextTableCellEditorBorder.java
  74. 4
      core/src/main/java/com/github/weisj/darklaf/ui/taskpane/DarkTaskPaneUI.java
  75. 4
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextAreaUI.java
  76. 24
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextBorder.java
  77. 12
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUIBridge.java
  78. 14
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java
  79. 8
      core/src/main/java/com/github/weisj/darklaf/ui/text/SelectLineAction.java
  80. 6
      core/src/main/java/com/github/weisj/darklaf/ui/text/SelectWordAction.java
  81. 3
      core/src/main/java/com/github/weisj/darklaf/ui/titledborder/DarkTitledBorder.java
  82. 12
      core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/ButtonGroupInfo.java
  83. 6
      core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarBorder.java
  84. 20
      core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarUI.java
  85. 64
      core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarUIBridge.java
  86. 14
      core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DropPreviewPanel.java
  87. 6
      core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipUI.java
  88. 12
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkDefaultTreeEditor.java
  89. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellBorder.java
  90. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRenderer.java
  91. 24
      core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java
  92. 5
      core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java
  93. 4
      core/src/main/java/com/github/weisj/darklaf/util/SwingXUtilities.java
  94. 10
      core/src/main/java/javax/swing/text/DefaultHighlighterDark/DarkHighlightPainter.java
  95. 6
      core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java
  96. 13
      core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java
  97. 2
      core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java
  98. 3
      core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java
  99. 1
      core/src/main/java/org/pbjar/jxlayer/repaint/WrappedRepaintManager.java
  100. 2
      core/src/test/java/defaults/SampleRenderer.java
  101. Some files were not shown because too many files have changed in this diff Show More

3
core/src/main/java/com/github/weisj/darklaf/DarkLaf.java

@ -244,7 +244,8 @@ public class DarkLaf extends BasicLookAndFeel {
private void loadSystemOverwrites(final Properties uiProps, final UIDefaults defaults) { private void loadSystemOverwrites(final Properties uiProps, final UIDefaults defaults) {
Properties overwrites = PropertyLoader.loadProperties(DarkLaf.class, "overwrites", "properties/"); Properties overwrites = PropertyLoader.loadProperties(DarkLaf.class, "overwrites", "properties/");
overwrites.values().removeIf(v -> System.getProperty(SYSTEM_PROPERTY_PREFIX + v.toString()) == null); overwrites.values().removeIf(v -> System.getProperty(SYSTEM_PROPERTY_PREFIX + v.toString()) == null);
overwrites.entrySet().forEach(e -> e.setValue(System.getProperty(SYSTEM_PROPERTY_PREFIX + e.getValue().toString()))); overwrites.entrySet().forEach(
e -> e.setValue(System.getProperty(SYSTEM_PROPERTY_PREFIX + e.getValue().toString())));
PropertyLoader.putProperties(overwrites, uiProps, defaults); PropertyLoader.putProperties(overwrites, uiProps, defaults);
} }

47
core/src/main/java/com/github/weisj/darklaf/LafManager.java

@ -33,6 +33,7 @@ import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.LogManager; import java.util.logging.LogManager;
@ -48,7 +49,7 @@ public final class LafManager {
private static Theme theme; private static Theme theme;
private static boolean logEnabled = false; private static boolean logEnabled = false;
private static boolean decorationsOverwrite = true; private static boolean decorationsOverwrite = true;
private static Properties properties = new Properties(); private static final Properties properties = new Properties();
static { static {
enableLogging(true); enableLogging(true);
@ -65,7 +66,8 @@ public final class LafManager {
LogManager.getLogManager().reset(); LogManager.getLogManager().reset();
} else { } else {
try (InputStream inputStream = DarkLaf.class.getClassLoader() try (InputStream inputStream = DarkLaf.class.getClassLoader()
.getResourceAsStream("com/github/weisj/darklaf/log/logging.properties")) { .getResourceAsStream(
"com/github/weisj/darklaf/log/logging.properties")) {
if (inputStream != null) { if (inputStream != null) {
Logger.getGlobal().fine("Loading logging configuration."); Logger.getGlobal().fine("Loading logging configuration.");
LogManager.getLogManager().readConfiguration(inputStream); LogManager.getLogManager().readConfiguration(inputStream);
@ -79,8 +81,8 @@ public final class LafManager {
} }
/** /**
* Returns whther custom decorations should be used. * Returns whther custom decorations should be used. If this returns true decorations still might not be used if the
* If this returns true decorations still might not be used if the theme or platform don't support them. * theme or platform don't support them.
* *
* @return true if decorations should be used. * @return true if decorations should be used.
*/ */
@ -89,9 +91,8 @@ public final class LafManager {
} }
/** /**
* Set globally whether decorations are enabled. By default this is true. * Set globally whether decorations are enabled. By default this is true. Decorations are used if this value is set
* Decorations are used if this value is set to true and the current platform and theme support * to true and the current platform and theme support custom decorations.
* custom decorations.
* *
* @param enabled true if decorations should be used if available. * @param enabled true if decorations should be used if available.
*/ */
@ -145,8 +146,11 @@ public final class LafManager {
*/ */
public static void reloadIconTheme() { public static void reloadIconTheme() {
try { try {
setTheme(getTheme().getClass().newInstance()); setTheme(getTheme().getClass().getDeclaredConstructor().newInstance());
} catch (InstantiationException | IllegalAccessException e) { } catch (InstantiationException
| IllegalAccessException
| NoSuchMethodException
| InvocationTargetException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -197,9 +201,8 @@ public final class LafManager {
/** /**
* Set a custom property. * Set a custom property.
* <p> * <p>
* Note: These properties are loaded * Note: These properties are loaded after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be
* after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be used to overwrite the values * used to overwrite the values specified in `[theme]_defaults.properties`.
* specified in `[theme]_defaults.properties`.
* *
* @param key the key. * @param key the key.
* @param value the value. * @param value the value.
@ -211,9 +214,8 @@ public final class LafManager {
/** /**
* Remove a custom property. * Remove a custom property.
* <p> * <p>
* Note: These properties are loaded * Note: These properties are loaded after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be
* after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be used to overwrite the values * used to overwrite the values specified in `[theme]_defaults.properties`.
* specified in `[theme]_defaults.properties`.
* *
* @param key the key. * @param key the key.
*/ */
@ -224,9 +226,8 @@ public final class LafManager {
/** /**
* Remove all custom properties. * Remove all custom properties.
* <p> * <p>
* Note: These properties are loaded * Note: These properties are loaded after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be
* after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be used to overwrite the values * used to overwrite the values specified in `[theme]_defaults.properties`.
* specified in `[theme]_defaults.properties`.
*/ */
public static void clearProperties() { public static void clearProperties() {
properties.clear(); properties.clear();
@ -235,9 +236,8 @@ public final class LafManager {
/** /**
* Get the custom properties. * Get the custom properties.
* <p> * <p>
* Note: These properties are loaded * Note: These properties are loaded after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be
* after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be used to overwrite the values * used to overwrite the values specified in `[theme]_defaults.properties`.
* specified in `[theme]_defaults.properties`.
*/ */
public static Properties getUserProperties() { public static Properties getUserProperties() {
return properties; return properties;
@ -246,9 +246,8 @@ public final class LafManager {
/** /**
* Remove a custom property. * Remove a custom property.
* <p> * <p>
* Note: These properties are loaded * Note: These properties are loaded after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be
* after {@link Theme#loadDefaults(Properties, UIDefaults)} and should only be used to overwrite the values * used to overwrite the values specified in `[theme]_defaults.properties`.
* specified in `[theme]_defaults.properties`.
* *
* @param key the key. * @param key the key.
* @return the value associated with `key`. * @return the value associated with `key`.

6
core/src/main/java/com/github/weisj/darklaf/color/ColorWrapper.java

@ -43,7 +43,11 @@ public class ColorWrapper extends Color {
} }
public void setColor(final Color color) { public void setColor(final Color color) {
if (color == null) { this.color = Color.BLACK; } else this.color = color; if (color == null) {
this.color = Color.BLACK;
} else {
this.color = color;
}
} }
@Override @Override

24
core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java

@ -55,7 +55,7 @@ public class ClosableTabComponent extends JPanel {
protected static class TabLabel extends JLabel { protected static class TabLabel extends JLabel {
private ClosableTabComponent tabComponent; private final ClosableTabComponent tabComponent;
protected TabLabel(final ClosableTabComponent tabComponent) { protected TabLabel(final ClosableTabComponent tabComponent) {
this.tabComponent = tabComponent; this.tabComponent = tabComponent;
@ -76,7 +76,17 @@ public class ClosableTabComponent extends JPanel {
protected static class TabButton extends JButton implements ActionListener { protected static class TabButton extends JButton implements ActionListener {
private final ClosableTabComponent tabComponent; private final ClosableTabComponent tabComponent;
private final MouseListener mouseListener = new MouseAdapter() {
protected TabButton(final ClosableTabComponent tabComponent) {
this.tabComponent = tabComponent;
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_ONLY_LABEL);
putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
setOpaque(false);
setRolloverEnabled(true);
setIcon(UIManager.getIcon("TabbedPane.tabCloseIcon"));
setRolloverIcon(UIManager.getIcon("TabbedPane.tabCloseHoverIcon"));
addActionListener(this);
MouseListener mouseListener = new MouseAdapter() {
@Override @Override
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
ComponentUI ui = tabComponent.pane.getUI(); ComponentUI ui = tabComponent.pane.getUI();
@ -89,16 +99,6 @@ public class ClosableTabComponent extends JPanel {
} }
} }
}; };
protected TabButton(final ClosableTabComponent tabComponent) {
this.tabComponent = tabComponent;
putClientProperty(DarkButtonUI.KEY_VARIANT, DarkButtonUI.VARIANT_ONLY_LABEL);
putClientProperty(DarkButtonUI.KEY_NO_SHADOW_OVERWRITE, true);
setOpaque(false);
setRolloverEnabled(true);
setIcon(UIManager.getIcon("TabbedPane.tabCloseIcon"));
setRolloverIcon(UIManager.getIcon("TabbedPane.tabCloseHoverIcon"));
addActionListener(this);
addMouseListener(mouseListener); addMouseListener(mouseListener);
} }

8
core/src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java

@ -30,11 +30,7 @@ import com.github.weisj.darklaf.util.TimerUtil;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.awt.event.FocusAdapter; import java.awt.event.*;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.geom.Ellipse2D; import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -47,7 +43,7 @@ public class DefaultColorPipette extends ColorPipetteBase {
private final Rectangle captureRect = new Rectangle(); private final Rectangle captureRect = new Rectangle();
private final Point previousLocation = new Point(); private final Point previousLocation = new Point();
private final Timer timer; private final Timer timer;
protected Color borderColor; protected final Color borderColor;
private Graphics2D zoomGraphics; private Graphics2D zoomGraphics;
private BufferedImage zoomImage; private BufferedImage zoomImage;

4
core/src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java

@ -49,15 +49,15 @@ public class JXPopupMenu extends JPopupMenu {
super(label); super(label);
} }
@SuppressWarnings("unchecked")
@Override @Override
public void show(final Component invoker, final int x, final int y) { public void show(final Component invoker, final int x, final int y) {
Point p = new Point(x, y); Point p = new Point(x, y);
if (invoker != null) { if (invoker != null) {
JXLayer layer = DarkUIUtil.getParentOfType(JXLayer.class, invoker); JXLayer<? extends JComponent> layer = DarkUIUtil.getParentOfType(JXLayer.class, invoker);
if (layer != null && layer.getUI() instanceof TransformUI) { if (layer != null && layer.getUI() instanceof TransformUI) {
TransformUI ui = (TransformUI) layer.getUI(); TransformUI ui = (TransformUI) layer.getUI();
p = SwingUtilities.convertPoint(invoker, p, layer); p = SwingUtilities.convertPoint(invoker, p, layer);
//noinspection unchecked
AffineTransform transform = ui.getPreferredTransform(layer.getSize(), layer); AffineTransform transform = ui.getPreferredTransform(layer.getSize(), layer);
transform.transform(p, p); transform.transform(p, p);
super.show(layer, p.x, p.y); super.show(layer, p.x, p.y);

4
core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java

@ -52,7 +52,7 @@ public class BubbleBorder extends AbstractBorder {
/** /**
* Create new TextBubbleBorder with given colour. * Create new TextBubbleBorder with given colour.
* *
* @param color color of border * @param color color of border.
*/ */
public BubbleBorder(final Color color) { public BubbleBorder(final Color color) {
this(color, 2, 4, 5); this(color, 2, 4, 5);
@ -66,7 +66,7 @@ public class BubbleBorder extends AbstractBorder {
* @param radius corner radius of border. * @param radius corner radius of border.
* @param pointerSize size of pointer. You can set this size to 0 to achieve no pointer, but it is not desirable. * @param pointerSize size of pointer. You can set this size to 0 to achieve no pointer, but it is not desirable.
* The appropriate method for this is to set using {@link BubbleBorder#setPointerSide(Alignment)} * The appropriate method for this is to set using {@link BubbleBorder#setPointerSide(Alignment)}
* to {@link Alignment#CENTER} * to. {@link Alignment#CENTER}
*/ */
public BubbleBorder(final Color color, final int thickness, public BubbleBorder(final Color color, final int thickness,
final int radius, final int pointerSize) { final int radius, final int pointerSize) {

4
core/src/main/java/com/github/weisj/darklaf/components/border/DarkBorders.java

@ -33,9 +33,9 @@ import java.util.WeakHashMap;
public final class DarkBorders { public final class DarkBorders {
private static Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineBorderMap = private static final Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineBorderMap =
Collections.synchronizedMap(new WeakHashMap<>()); Collections.synchronizedMap(new WeakHashMap<>());
private static Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineWidgetBorderMap = private static final Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineWidgetBorderMap =
Collections.synchronizedMap(new WeakHashMap<>()); Collections.synchronizedMap(new WeakHashMap<>());

9
core/src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java

@ -77,7 +77,8 @@ public class DropShadowBorder implements Border, Serializable {
public DropShadowBorder(final Color shadowColor, final int shadowSize, public DropShadowBorder(final Color shadowColor, final int shadowSize,
final float shadowOpacity, final int cornerSize, final boolean showTopShadow, final float shadowOpacity, final int cornerSize, final boolean showTopShadow,
final boolean showLeftShadow, final boolean showBottomShadow, final boolean showRightShadow) { final boolean showLeftShadow, final boolean showBottomShadow,
final boolean showRightShadow) {
setShadowColor(shadowColor); setShadowColor(shadowColor);
setShadowSize(shadowSize); setShadowSize(shadowSize);
setShadowOpacity(shadowOpacity); setShadowOpacity(shadowOpacity);
@ -210,11 +211,13 @@ public class DropShadowBorder implements Border, Serializable {
} }
if (showLeftShadow || showBottomShadow) { if (showLeftShadow || showBottomShadow) {
assert bottomLeftShadowPoint != null; assert bottomLeftShadowPoint != null;
g2.drawImage(images[Position.BOTTOM_LEFT.ordinal()], bottomLeftShadowPoint.x, bottomLeftShadowPoint.y, null); g2.drawImage(images[Position.BOTTOM_LEFT.ordinal()], bottomLeftShadowPoint.x, bottomLeftShadowPoint.y,
null);
} }
if (showRightShadow || showBottomShadow) { if (showRightShadow || showBottomShadow) {
assert bottomRightShadowPoint != null; assert bottomRightShadowPoint != null;
g2.drawImage(images[Position.BOTTOM_RIGHT.ordinal()], bottomRightShadowPoint.x, bottomRightShadowPoint.y, null); g2.drawImage(images[Position.BOTTOM_RIGHT.ordinal()], bottomRightShadowPoint.x,
bottomRightShadowPoint.y, null);
} }
if (showRightShadow || showTopShadow) { if (showRightShadow || showTopShadow) {
assert topRightShadowPoint != null; assert topRightShadowPoint != null;

8
core/src/main/java/com/github/weisj/darklaf/components/border/WeakLineBorder.java

@ -25,10 +25,10 @@ package com.github.weisj.darklaf.components.border;
class WeakLineBorder extends MutableLineBorder { class WeakLineBorder extends MutableLineBorder {
private int left; private final int left;
private int top; private final int top;
private int bottom; private final int bottom;
private int right; private final int right;
public WeakLineBorder(final int top, final int left, final int bottom, final int right) { public WeakLineBorder(final int top, final int left, final int bottom, final int right) {
super(top, left, bottom, right, null); super(top, left, bottom, right, null);

3
core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java

@ -539,7 +539,8 @@ public class JTabFrame extends JComponent {
getPopupComponentAt(a).doLayout(); getPopupComponentAt(a).doLayout();
getPopupComponentAt(a).requestFocus(); getPopupComponentAt(a).requestFocus();
} }
firePropertyChange(TabFramePopup.KEY_VISIBLE_TAB, new TabFramePosition(a, oldIndex), new TabFramePosition(a, index)); firePropertyChange(TabFramePopup.KEY_VISIBLE_TAB, new TabFramePosition(a, oldIndex),
new TabFramePosition(a, index));
} }
/** /**

7
core/src/main/java/com/github/weisj/darklaf/components/text/LineHighlighter.java

@ -64,7 +64,9 @@ public class LineHighlighter implements Highlighter.HighlightPainter, ChangeList
g.setColor(color); g.setColor(color);
g.fillRect(0, r.y, c.getWidth(), r.height); g.fillRect(0, r.y, c.getWidth(), r.height);
if (lastView == null) { lastView = r; } if (lastView == null) {
lastView = r;
}
} catch (BadLocationException ble) { } catch (BadLocationException ble) {
ble.printStackTrace(); ble.printStackTrace();
} }
@ -99,7 +101,8 @@ public class LineHighlighter implements Highlighter.HighlightPainter, ChangeList
component.repaint(0, lastView.y, component.getWidth(), lastView.height); component.repaint(0, lastView.y, component.getWidth(), lastView.height);
lastView = currentView; lastView = currentView;
} }
} catch (BadLocationException ignored) {} } catch (BadLocationException ignored) {
}
}); });
} }
} }

7
core/src/main/java/com/github/weisj/darklaf/components/text/NumberingPane.java

@ -36,8 +36,8 @@ public class NumberingPane extends JComponent {
public static final String KEY_ICONS = "icons"; public static final String KEY_ICONS = "icons";
public static final String KEY_MIN_ICON_WIDTH = "minimumIconWidth"; public static final String KEY_MIN_ICON_WIDTH = "minimumIconWidth";
private JTextComponent textComponent; private JTextComponent textComponent;
private Map<Position, Icon> iconMap; private final Map<Position, Icon> iconMap;
private Map<Position, List<IconListener>> listenerMap; private final Map<Position, List<IconListener>> listenerMap;
private int width; private int width;
public NumberingPane() { public NumberingPane() {
@ -83,7 +83,8 @@ public class NumberingPane extends JComponent {
return addIconAtLine(lineIndex, icon, true); return addIconAtLine(lineIndex, icon, true);
} }
public Position addIconAtLine(final int lineIndex, final Icon icon, final boolean atTextStart) throws BadLocationException { public Position addIconAtLine(final int lineIndex, final Icon icon, final boolean atTextStart)
throws BadLocationException {
int offset = textComponent.getDocument().getDefaultRootElement().getElement(lineIndex).getStartOffset(); int offset = textComponent.getDocument().getDefaultRootElement().getElement(lineIndex).getStartOffset();
if (atTextStart) { if (atTextStart) {
Document doc = textComponent.getDocument(); Document doc = textComponent.getDocument();

2
core/src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java

@ -33,7 +33,7 @@ import java.util.List;
*/ */
public class SearchTextFieldWithHistory extends SearchTextField { public class SearchTextFieldWithHistory extends SearchTextField {
protected TextFieldHistoryPopup history; protected final TextFieldHistoryPopup history;
/** /**
* Constructs a new <code>TextField</code>. A default model is created, the initial string is <code>null</code>, * Constructs a new <code>TextField</code>. A default model is created, the initial string is <code>null</code>,

8
core/src/main/java/com/github/weisj/darklaf/components/text/TextFieldHistoryPopup.java

@ -29,14 +29,8 @@ import com.github.weisj.darklaf.util.StringUtil;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.*;
import java.util.Set;
/** /**
* @author Jannis Weis * @author Jannis Weis

11
core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java

@ -224,9 +224,9 @@ public class ToolTipContext {
* *
* <p>Default will be {@link AlignmentStrategy#COMPONENT_BOTH}. * <p>Default will be {@link AlignmentStrategy#COMPONENT_BOTH}.
* *
* @see AlignmentStrategy
* @param alignmentStrategy the alignment strategy. * @param alignmentStrategy the alignment strategy.
* @return this * @return this
* @see AlignmentStrategy
*/ */
public ToolTipContext setAlignmentStrategy(final AlignmentStrategy alignmentStrategy) { public ToolTipContext setAlignmentStrategy(final AlignmentStrategy alignmentStrategy) {
this.alignmentStrategy = alignmentStrategy; this.alignmentStrategy = alignmentStrategy;
@ -282,7 +282,8 @@ public class ToolTipContext {
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)} * @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
*/ */
public ToolTipContext(final JComponent target, final Alignment alignment, final AlignmentStrategy alignmentStrategy) { public ToolTipContext(final JComponent target, final Alignment alignment,
final AlignmentStrategy alignmentStrategy) {
this(target, alignment, null, alignmentStrategy, true, null); this(target, alignment, null, alignmentStrategy, true, null);
} }
@ -392,9 +393,9 @@ public class ToolTipContext {
} }
/** /**
* @see #setInsideArea(Area)
* @param insideRect the rectangle to check. * @param insideRect the rectangle to check.
* @return this * @return this
* @see #setInsideArea(Area)
*/ */
public ToolTipContext setInsideArea(final Rectangle insideRect) { public ToolTipContext setInsideArea(final Rectangle insideRect) {
this.hotSpotArea = new Area(insideRect); this.hotSpotArea = new Area(insideRect);
@ -418,8 +419,8 @@ public class ToolTipContext {
} }
/** /**
* Sets whether the border should be ignored when aligning outside. If true the tooltip is aligned w.r.t. to * Sets whether the border should be ignored when aligning outside. If true the tooltip is aligned w.r.t. to the
* the content rect and not the component bounds. * content rect and not the component bounds.
* *
* @param ignoreBorder true if border insets should be ignored. * @param ignoreBorder true if border insets should be ignored.
* @return this. * @return this.

3
core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java

@ -60,8 +60,7 @@ public class TristateCheckBoxMenuItem extends JCheckBoxMenuItem {
} }
/** /**
* Creates a menu item whose properties are taken from the * Creates a menu item whose properties are taken from the Action supplied.
* Action supplied.
* *
* @param a the action of the {@code JCheckBoxMenuItem} * @param a the action of the {@code JCheckBoxMenuItem}
* @since 1.3 * @since 1.3

3
core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java

@ -60,7 +60,8 @@ public final class Decorations {
} }
} }
public static CustomTitlePane createTitlePane(final JRootPane rootPane, final int decorationStyle, final Window window) { public static CustomTitlePane createTitlePane(final JRootPane rootPane, final int decorationStyle,
final Window window) {
return decorationsProvider.createTitlePane(rootPane, decorationStyle, window); return decorationsProvider.createTitlePane(rootPane, decorationStyle, window);
} }

44
core/src/main/java/com/github/weisj/darklaf/theme/Theme.java

@ -74,9 +74,9 @@ public abstract class Theme {
/** /**
* Load the theme defaults. * Load the theme defaults.
* <p> * <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} * Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* to return the class of the theme you are overwriting. In this case you should use * you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}. * #load(String)}.
* *
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
@ -89,9 +89,9 @@ public abstract class Theme {
/** /**
* Load the global values. * Load the global values.
* <p> * <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} * Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* to return the class of the theme you are overwriting. In this case you should use * you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}. * #load(String)}.
* *
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
@ -104,9 +104,9 @@ public abstract class Theme {
/** /**
* Load the icon defaults. * Load the icon defaults.
* <p> * <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} * Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* to return the class of the theme you are overwriting. In this case you should use * you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}. * #load(String)}.
* *
* @param properties the properties to load the value into. * @param properties the properties to load the value into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
@ -122,9 +122,9 @@ public abstract class Theme {
/** /**
* Load the general properties file for the icon themes. * Load the general properties file for the icon themes.
* <p> * <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} * Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* to return the class of the theme you are overwriting. In this case you should use * you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}. * #load(String)}.
* *
* @param properties the properties to load the value into. * @param properties the properties to load the value into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
@ -149,8 +149,8 @@ public abstract class Theme {
/** /**
* Load the platform defaults. * Load the platform defaults.
* <p> * <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} * Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* instead of {@link #load(String)}. * #load(String)}.
* *
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
@ -167,8 +167,8 @@ public abstract class Theme {
/** /**
* Load the ui defaults. * Load the ui defaults.
* <p> * <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} * Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* instead of {@link #load(String)}. * #load(String)}.
* *
* @param properties the properties to load the values into. * @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults. * @param currentDefaults the current ui defaults.
@ -191,8 +191,8 @@ public abstract class Theme {
* Load custom properties that are located under {@link #getResourcePath()}, with the name {@link * Load custom properties that are located under {@link #getResourcePath()}, with the name {@link
* #getName()}_{propertySuffix}.properties * #getName()}_{propertySuffix}.properties
* <p> * <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} * Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* instead of {@link #load(String)}. * #load(String)}.
* *
* @param propertySuffix the property suffix. * @param propertySuffix the property suffix.
* @param properties the properties to load into. * @param properties the properties to load into.
@ -207,8 +207,7 @@ public abstract class Theme {
/** /**
* Load a .properties file using {@link #getLoaderClass()}} to resolve the file path. * Load a .properties file using {@link #getLoaderClass()}} to resolve the file path.
* <p> * <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} * Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead.
* instead.
* *
* @param name the properties file to load. * @param name the properties file to load.
* @return the properties. * @return the properties.
@ -251,9 +250,8 @@ public abstract class Theme {
public abstract String getName(); public abstract String getName();
/** /**
* The class used to determine the runtime location of resources. * The class used to determine the runtime location of resources. It is advised to explicitly return the class
* It is advised to explicitly return the class instead of using {@link #getClass()} to protect * instead of using {@link #getClass()} to protect against extending the theme.
* against extending the theme.
* *
* @return the loader class. * @return the loader class.
*/ */

33
core/src/main/java/com/github/weisj/darklaf/ui/BasicTransferable.java

@ -28,7 +28,10 @@ import javax.swing.plaf.UIResource;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.*; import java.io.InputStream;
import java.io.Reader;
import java.io.StringBufferInputStream;
import java.io.StringReader;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
@ -77,7 +80,7 @@ public class BasicTransferable implements Transferable, UIResource {
* Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be * Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be
* ordered according to preference for providing the data (from most richly descriptive to least descriptive). * ordered according to preference for providing the data (from most richly descriptive to least descriptive).
* *
* @return an array of data flavors in which this data can be transferred * @return an array of data flavors in which this data can be transferred.
*/ */
public DataFlavor[] getTransferDataFlavors() { public DataFlavor[] getTransferDataFlavors() {
DataFlavor[] richerFlavors = getRicherFlavors(); DataFlavor[] richerFlavors = getRicherFlavors();
@ -110,15 +113,15 @@ public class BasicTransferable implements Transferable, UIResource {
} }
/** /**
* Returns whether or not the specified data flavor is supported for this object. * Returns whether the specified data flavor is supported for this object.
* *
* @param flavor the requested flavor for the data * @param flavor the requested flavor for the data
* @return boolean indicating whether or not the data flavor is supported * @return boolean indicating whether the data flavor is supported.
*/ */
public boolean isDataFlavorSupported(final DataFlavor flavor) { public boolean isDataFlavorSupported(final DataFlavor flavor) {
DataFlavor[] flavors = getTransferDataFlavors(); DataFlavor[] flavors = getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) { for (DataFlavor dataFlavor : flavors) {
if (flavors[i].equals(flavor)) { if (dataFlavor.equals(flavor)) {
return true; return true;
} }
} }
@ -130,12 +133,10 @@ public class BasicTransferable implements Transferable, UIResource {
* the representation class of the flavor. * the representation class of the flavor.
* *
* @param flavor the requested flavor for the data * @param flavor the requested flavor for the data
* @throws IOException if the data is no longer available in the requested flavor.
* @throws UnsupportedFlavorException if the requested data flavor is not supported. * @throws UnsupportedFlavorException if the requested data flavor is not supported.
* @see DataFlavor#getRepresentationClass * @see DataFlavor#getRepresentationClass
*/ */
public Object getTransferData(final DataFlavor flavor) throws UnsupportedFlavorException, IOException { public Object getTransferData(final DataFlavor flavor) throws UnsupportedFlavorException {
DataFlavor[] richerFlavors = getRicherFlavors();
if (isRicherFlavor(flavor)) { if (isRicherFlavor(flavor)) {
return getRicherData(flavor); return getRicherData(flavor);
} else if (isHTMLFlavor(flavor)) { } else if (isHTMLFlavor(flavor)) {
@ -192,7 +193,7 @@ public class BasicTransferable implements Transferable, UIResource {
return null; return null;
} }
protected Object getRicherData(final DataFlavor flavor) throws UnsupportedFlavorException { protected Object getRicherData(final DataFlavor flavor) {
return null; return null;
} }
@ -206,8 +207,8 @@ public class BasicTransferable implements Transferable, UIResource {
*/ */
protected boolean isHTMLFlavor(final DataFlavor flavor) { protected boolean isHTMLFlavor(final DataFlavor flavor) {
DataFlavor[] flavors = htmlFlavors; DataFlavor[] flavors = htmlFlavors;
for (int i = 0; i < flavors.length; i++) { for (DataFlavor dataFlavor : flavors) {
if (flavors[i].equals(flavor)) { if (dataFlavor.equals(flavor)) {
return true; return true;
} }
} }
@ -243,8 +244,8 @@ public class BasicTransferable implements Transferable, UIResource {
*/ */
protected boolean isPlainFlavor(final DataFlavor flavor) { protected boolean isPlainFlavor(final DataFlavor flavor) {
DataFlavor[] flavors = plainFlavors; DataFlavor[] flavors = plainFlavors;
for (int i = 0; i < flavors.length; i++) { for (DataFlavor dataFlavor : flavors) {
if (flavors[i].equals(flavor)) { if (dataFlavor.equals(flavor)) {
return true; return true;
} }
} }
@ -280,8 +281,8 @@ public class BasicTransferable implements Transferable, UIResource {
*/ */
protected boolean isStringFlavor(final DataFlavor flavor) { protected boolean isStringFlavor(final DataFlavor flavor) {
DataFlavor[] flavors = stringFlavors; DataFlavor[] flavors = stringFlavors;
for (int i = 0; i < flavors.length; i++) { for (DataFlavor dataFlavor : flavors) {
if (flavors[i].equals(flavor)) { if (dataFlavor.equals(flavor)) {
return true; return true;
} }
} }

3
core/src/main/java/com/github/weisj/darklaf/ui/DragRecognitionSupport.java

@ -37,7 +37,8 @@ import java.awt.event.MouseEvent;
* press followed by movement by <code>DragSource.getDragThreshold()</code> pixels. An instance of this class is * press followed by movement by <code>DragSource.getDragThreshold()</code> pixels. An instance of this class is
* maintained per AppContext, and the public static methods call into the appropriate instance. * maintained per AppContext, and the public static methods call into the appropriate instance.
* *
* <p>This is a c and p of core (package private) needed for BasicXListUI. It differs from core in that references to sun * <p>This is a c and p of core (package private) needed for BasicXListUI. It differs from core in that references to
* sun
* packages have been replaced. * packages have been replaced.
* <ul> * <ul>
* <li> a static method of SunDragSourceContextPeer has been copied into SwingXUtilities * <li> a static method of SunDragSourceContextPeer has been copied into SwingXUtilities

24
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java

@ -41,19 +41,19 @@ import java.awt.geom.RoundRectangle2D;
*/ */
public class DarkButtonBorder implements Border, UIResource { public class DarkButtonBorder implements Border, UIResource {
private Color shadowColor; private final Color shadowColor;
private Color focusBorderColor; private final Color focusBorderColor;
private Color defaultBorderColor; private final Color defaultBorderColor;
private Color borderColor; private final Color borderColor;
private Color inactiveBorderColor; private final Color inactiveBorderColor;
private int arc; private final int arc;
private int focusArc; private final int focusArc;
private int squareFocusArc; private final int squareFocusArc;
private int squareArc; private final int squareArc;
private int minimumArc; private final int minimumArc;
private int borderSize; private final int borderSize;
private int shadowSize; private final int shadowSize;
private Insets insets; private Insets insets;
private Insets thinInsets; private Insets thinInsets;
private Insets squareInsets; private Insets squareInsets;

2
core/src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java

@ -25,9 +25,9 @@ package com.github.weisj.darklaf.ui.cell;
import com.github.weisj.darklaf.components.SelectableTreeNode; import com.github.weisj.darklaf.components.SelectableTreeNode;
import com.github.weisj.darklaf.decorators.CellRenderer; import com.github.weisj.darklaf.decorators.CellRenderer;
import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonUI;
import com.github.weisj.darklaf.ui.table.DarkTableCellFocusBorder; import com.github.weisj.darklaf.ui.table.DarkTableCellFocusBorder;
import com.github.weisj.darklaf.ui.table.DarkTableUI; import com.github.weisj.darklaf.ui.table.DarkTableUI;
import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonUI;
import com.github.weisj.darklaf.ui.tree.DarkTreeCellRenderer; import com.github.weisj.darklaf.ui.tree.DarkTreeCellRenderer;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;

2
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPreviewComponent.java

@ -30,7 +30,7 @@ import java.awt.*;
* @author Jannis Weis * @author Jannis Weis
*/ */
final class ColorPreviewComponent extends JComponent { final class ColorPreviewComponent extends JComponent {
protected Color borderColor; protected final Color borderColor;
private Color myColor; private Color myColor;
ColorPreviewComponent() { ColorPreviewComponent() {

2
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheelImageProducer.java

@ -36,7 +36,7 @@ public class ColorWheelImageProducer extends MemoryImageSource {
private final int[] myPixels; private final int[] myPixels;
private final int myWidth; private final int myWidth;
private final int myHeight; private final int myHeight;
private float myBrightness; private final float myBrightness;
private float[] myHues; private float[] myHues;
private float[] mySat; private float[] mySat;

3
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserPanel.java

@ -280,7 +280,8 @@ public class DarkColorChooserPanel extends AbstractColorChooserPanel implements
Integer.valueOf(hexStr.substring(4, 6), 16), Integer.valueOf(hexStr.substring(4, 6), 16),
alpha); alpha);
colorWheelPanel.setColor(c, textHex); colorWheelPanel.setColor(c, textHex);
} catch (NumberFormatException | IndexOutOfBoundsException ignore) {} } catch (NumberFormatException | IndexOutOfBoundsException ignore) {
}
} }
}); });
} }

7
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkSwatchesChooserPanel.java

@ -31,12 +31,7 @@ import javax.swing.border.LineBorder;
import javax.swing.colorchooser.AbstractColorChooserPanel; import javax.swing.colorchooser.AbstractColorChooserPanel;
import javax.swing.colorchooser.ColorSelectionModel; import javax.swing.colorchooser.ColorSelectionModel;
import java.awt.*; import java.awt.*;
import java.awt.event.KeyAdapter; import java.awt.event.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.Serializable; import java.io.Serializable;
/** /**

2
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/SlideComponent.java

@ -53,7 +53,7 @@ class SlideComponent extends JComponent implements ColorListener {
protected Color borderColor; protected Color borderColor;
protected Color shadowColor; protected Color shadowColor;
protected Color knobFill; protected Color knobFill;
private boolean isOpacity; private final boolean isOpacity;
private int pointerValue = 0; private int pointerValue = 0;
private int value = 0; private int value = 0;
private Unit unitType = Unit.LEVEL; private Unit unitType = Unit.LEVEL;

16
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxBorder.java

@ -39,14 +39,14 @@ public class DarkComboBoxBorder implements Border, UIResource {
protected final DarkComboBoxUI ui; protected final DarkComboBoxUI ui;
protected Insets boxPadding; protected Insets boxPadding;
protected Insets cellPadding; protected Insets cellPadding;
protected int borderSize; protected final int borderSize;
protected int arcSize; protected final int arcSize;
protected Color focusBorderColor; protected final Color focusBorderColor;
protected Color inactiveBackground; protected final Color inactiveBackground;
protected Color arrowBackground; protected final Color arrowBackground;
protected Color background; protected final Color background;
protected Color borderColor; protected final Color borderColor;
protected Color inactiveBorderColor; protected final Color inactiveBorderColor;
public DarkComboBoxBorder(final DarkComboBoxUI ui) { public DarkComboBoxBorder(final DarkComboBoxUI ui) {
this.ui = ui; this.ui = ui;

2
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxListener.java

@ -33,7 +33,7 @@ import java.beans.PropertyChangeListener;
public class DarkComboBoxListener extends MouseAdapter implements PropertyChangeListener, ComboBoxConstants { public class DarkComboBoxListener extends MouseAdapter implements PropertyChangeListener, ComboBoxConstants {
protected JComboBox<?> comboBox; protected final JComboBox<?> comboBox;
public DarkComboBoxListener(final JComboBox<?> comboBox) { public DarkComboBoxListener(final JComboBox<?> comboBox) {
this.comboBox = comboBox; this.comboBox = comboBox;

19
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java

@ -58,7 +58,7 @@ public class DarkComboPopup extends BasicComboPopup {
* *
* @param combo an instance of {@code JComboBox} * @param combo an instance of {@code JComboBox}
*/ */
public DarkComboPopup(final JComboBox combo) { public DarkComboPopup(final JComboBox<Object> combo) {
super(combo); super(combo);
} }
@ -114,11 +114,6 @@ public class DarkComboPopup extends BasicComboPopup {
setFocusable(false); setFocusable(false);
} }
@Override
protected void configureList() {
super.configureList();
}
@Override @Override
protected void togglePopup() { protected void togglePopup() {
if (comboBox.getItemCount() == 0) return; if (comboBox.getItemCount() == 0) return;
@ -131,18 +126,6 @@ public class DarkComboPopup extends BasicComboPopup {
} }
} }
@Override
public void show() {
super.show();
}
@Override
public void hide() {
super.hide();
}
protected void reset() { protected void reset() {
lastEvent = 0; lastEvent = 0;
if (visible) { if (visible) {

65
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUIBridge.java

@ -68,18 +68,18 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
protected static final Dimension vstrut5 = new Dimension(1, 5); protected static final Dimension vstrut5 = new Dimension(1, 5);
static final int space = 10; static final int space = 10;
// Preferred and Minimum sizes for the dialog box // Preferred and Minimum sizes for the dialog box
protected static int PREF_WIDTH = 500; protected static final int PREF_WIDTH = 500;
protected static int PREF_HEIGHT = 326; protected static final int PREF_HEIGHT = 326;
protected static Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT); protected static final Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
protected static int MIN_WIDTH = 500; protected static final int MIN_WIDTH = 500;
protected static int MIN_HEIGHT = 326; protected static final int MIN_HEIGHT = 326;
protected static int LIST_PREF_WIDTH = 405; protected static final int LIST_PREF_WIDTH = 405;
protected static int LIST_PREF_HEIGHT = 135; protected static final int LIST_PREF_HEIGHT = 135;
protected static Dimension LIST_PREF_SIZE = new Dimension(LIST_PREF_WIDTH, LIST_PREF_HEIGHT); protected static final Dimension LIST_PREF_SIZE = new Dimension(LIST_PREF_WIDTH, LIST_PREF_HEIGHT);
protected JLabel lookInLabel; protected JLabel lookInLabel;
protected JComboBox<Object> directoryComboBox; protected JComboBox<Object> directoryComboBox;
protected DirectoryComboBoxModel directoryComboBoxModel; protected DirectoryComboBoxModel directoryComboBoxModel;
protected Action directoryComboBoxAction = new DirectoryComboBoxAction(); protected final Action directoryComboBoxAction = new DirectoryComboBoxAction();
protected FilterComboBoxModel filterComboBoxModel; protected FilterComboBoxModel filterComboBoxModel;
protected JTextField fileNameTextField; protected JTextField fileNameTextField;
protected DarkFilePaneUIBridge filePane; protected DarkFilePaneUIBridge filePane;
@ -592,8 +592,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
} }
protected static void groupLabels(final AlignedLabel[] group) { protected static void groupLabels(final AlignedLabel[] group) {
for (int i = 0; i < group.length; i++) { for (AlignedLabel alignedLabel : group) {
group[i].group = group; alignedLabel.group = group;
} }
} }
@ -631,8 +631,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
int prefWidth = PREF_SIZE.width; int prefWidth = PREF_SIZE.width;
Dimension d = c.getLayout().preferredLayoutSize(c); Dimension d = c.getLayout().preferredLayoutSize(c);
if (d != null) { if (d != null) {
return new Dimension(d.width < prefWidth ? prefWidth : d.width, return new Dimension(Math.max(d.width, prefWidth),
d.height < PREF_SIZE.height ? PREF_SIZE.height : d.height); Math.max(d.height, PREF_SIZE.height));
} else { } else {
return new Dimension(prefWidth, PREF_SIZE.height); return new Dimension(prefWidth, PREF_SIZE.height);
} }
@ -699,7 +699,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
* right, flushed right. The widths of all components will be set to the largest preferred size width. * right, flushed right. The widths of all components will be set to the largest preferred size width.
*/ */
protected static class ButtonAreaLayout implements LayoutManager { protected static class ButtonAreaLayout implements LayoutManager {
protected int hGap = 5; protected final int hGap = 5;
protected int topMargin = 17; protected int topMargin = 17;
public void addLayoutComponent(final String string, final Component comp) { public void addLayoutComponent(final String string, final Component comp) {
@ -724,8 +724,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
int extraWidth = cInsets.left + cInsets.right; int extraWidth = cInsets.left + cInsets.right;
int maxWidth = 0; int maxWidth = 0;
for (int counter = 0; counter < numChildren; counter++) { for (Component child : children) {
Dimension aSize = children[counter].getPreferredSize(); Dimension aSize = child.getPreferredSize();
height = Math.max(height, aSize.height); height = Math.max(height, aSize.height);
maxWidth = Math.max(maxWidth, aSize.width); maxWidth = Math.max(maxWidth, aSize.width);
} }
@ -820,7 +820,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
* *
* @deprecated As of JDK version 9. Obsolete class. * @deprecated As of JDK version 9. Obsolete class.
*/ */
protected class SingleClickListener extends MouseAdapter { protected static class SingleClickListener extends MouseAdapter {
/** /**
* Constructs an instance of {@code SingleClickListener}. * Constructs an instance of {@code SingleClickListener}.
* *
@ -836,7 +836,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
* @deprecated As of JDK version 9. Obsolete class. * @deprecated As of JDK version 9. Obsolete class.
*/ */
@SuppressWarnings("serial") // Superclass is not serializable across versions @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class FileRenderer extends DefaultListCellRenderer { protected static class FileRenderer extends DefaultListCellRenderer {
} }
// //
@ -845,7 +845,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
@SuppressWarnings("serial") @SuppressWarnings("serial")
// Superclass is not serializable across versions // Superclass is not serializable across versions
class DirectoryComboBoxRenderer extends DefaultListCellRenderer { class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
IndentIcon ii = new IndentIcon(); final IndentIcon ii = new IndentIcon();
public Component getListCellRendererComponent(final JList<?> list, final Object value, public Component getListCellRendererComponent(final JList<?> list, final Object value,
final int index, final boolean isSelected, final int index, final boolean isSelected,
@ -859,8 +859,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
} }
File directory = (File) value; File directory = (File) value;
setText(getFileChooser().getName(directory)); setText(getFileChooser().getName(directory));
Icon icon = getFileChooser().getIcon(directory); ii.icon = getFileChooser().getIcon(directory);
ii.icon = icon;
ii.depth = directoryComboBoxModel.getDepth(index); ii.depth = directoryComboBoxModel.getDepth(index);
setIcon(ii); setIcon(ii);
@ -868,7 +867,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
} }
} }
class IndentIcon implements Icon { static class IndentIcon implements Icon {
Icon icon = null; Icon icon = null;
int depth = 0; int depth = 0;
@ -896,11 +895,11 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
*/ */
@SuppressWarnings("serial") // Superclass is not serializable across versions @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object> { protected class DirectoryComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object> {
Vector<File> directories = new Vector<File>(); final Vector<File> directories = new Vector<>();
int[] depths = null; int[] depths = null;
File selectedDirectory = null; File selectedDirectory = null;
JFileChooser chooser = getFileChooser(); final JFileChooser chooser = getFileChooser();
FileSystemView fsv = chooser.getFileSystemView(); final FileSystemView fsv = chooser.getFileSystemView();
/** /**
* Constructs an instance of {@code DirectoryComboBoxModel}. * Constructs an instance of {@code DirectoryComboBoxModel}.
@ -951,7 +950,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
File sf = useShellFolder ? ShellFolder.getShellFolder(canonical) File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
: canonical; : canonical;
File f = sf; File f = sf;
Vector<File> path = new Vector<File>(10); Vector<File> path = new Vector<>(10);
do { do {
path.addElement(f); path.addElement(f);
} while ((f = f.getParentFile()) != null); } while ((f = f.getParentFile()) != null);
@ -1027,7 +1026,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
* Data model for a type-face selection combo-box. * Data model for a type-face selection combo-box.
*/ */
@SuppressWarnings("serial") // Same-version serialization only @SuppressWarnings("serial") // Same-version serialization only
protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener { protected class FilterComboBoxModel extends AbstractListModel<Object>
implements ComboBoxModel<Object>, PropertyChangeListener {
/** /**
* An array of file filters. * An array of file filters.
@ -1071,6 +1071,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
for (FileFilter filter : filters) { for (FileFilter filter : filters) {
if (filter == currentFilter) { if (filter == currentFilter) {
found = true; found = true;
break;
} }
} }
if (!found) { if (!found) {
@ -1124,7 +1125,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
} }
@SuppressWarnings("serial") // Superclass is not serializable across versions @SuppressWarnings("serial") // Superclass is not serializable across versions
protected class AlignedLabel extends JLabel { protected static class AlignedLabel extends JLabel {
protected AlignedLabel[] group; protected AlignedLabel[] group;
protected int maxWidth = 0; protected int maxWidth = 0;
@ -1148,11 +1149,11 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
protected int getMaxWidth() { protected int getMaxWidth() {
if (maxWidth == 0 && group != null) { if (maxWidth == 0 && group != null) {
int max = 0; int max = 0;
for (int i = 0; i < group.length; i++) { for (AlignedLabel label : group) {
max = Math.max(group[i].getSuperPreferredWidth(), max); max = Math.max(label.getSuperPreferredWidth(), max);
} }
for (int i = 0; i < group.length; i++) { for (AlignedLabel alignedLabel : group) {
group[i].maxWidth = max; alignedLabel.maxWidth = max;
} }
} }
return maxWidth; return maxWidth;

2
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePane.java

@ -301,7 +301,7 @@ public class DarkFilePane extends DarkFilePaneUIBridge {
int editX = icon == null ? 20 : icon.getIconWidth() + 4; int editX = icon == null ? 20 : icon.getIconWidth() + 4;
int gap = 0; int gap = 0;
ListCellRenderer renderer = list.getCellRenderer(); ListCellRenderer<?> renderer = list.getCellRenderer();
if (renderer instanceof JLabel) { if (renderer instanceof JLabel) {
gap = ((JLabel) renderer).getIconTextGap() - 1; gap = ((JLabel) renderer).getIconTextGap() - 1;
} }

68
core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePaneUIBridge.java

@ -83,7 +83,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
protected static final int COLUMN_FILENAME = 0; protected static final int COLUMN_FILENAME = 0;
protected static final int COLUMN_SIZE = 1; protected static final int COLUMN_SIZE = 1;
protected static FocusListener repaintListener = new FocusListener() { protected static final FocusListener repaintListener = new FocusListener() {
public void focusGained(final FocusEvent fe) { public void focusGained(final FocusEvent fe) {
repaintSelection(fe.getSource()); repaintSelection(fe.getSource());
} }
@ -94,7 +94,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
protected void repaintSelection(final Object source) { protected void repaintSelection(final Object source) {
if (source instanceof JList) { if (source instanceof JList) {
repaintListSelection((JList) source); repaintListSelection((JList<?>) source);
} else if (source instanceof JTable) { } else if (source instanceof JTable) {
repaintTableSelection((JTable) source); repaintTableSelection((JTable) source);
} }
@ -125,7 +125,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
}; };
protected Action[] actions; protected Action[] actions;
protected int viewType = -1; protected int viewType = -1;
protected JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT]; protected final JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT];
protected JPanel currentViewPanel; protected JPanel currentViewPanel;
protected String[] viewTypeActionNames; protected String[] viewTypeActionNames;
protected String filesListAccessibleName = null; protected String filesListAccessibleName = null;
@ -141,7 +141,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
protected String renameErrorTitleText; protected String renameErrorTitleText;
protected String renameErrorText; protected String renameErrorText;
protected String renameErrorFileExistsText; protected String renameErrorFileExistsText;
protected boolean smallIconsView = false; protected final boolean smallIconsView = false;
protected Border listViewBorder; protected Border listViewBorder;
protected Color listViewBackground; protected Color listViewBackground;
protected boolean listViewWindowsStyle; protected boolean listViewWindowsStyle;
@ -155,7 +155,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// be selected when it appears in the model. // be selected when it appears in the model.
protected File newFolderFile; protected File newFolderFile;
// Used for accessing methods in the corresponding UI class // Used for accessing methods in the corresponding UI class
protected FileChooserUIAccessor fileChooserUIAccessor; protected final FileChooserUIAccessor fileChooserUIAccessor;
protected DetailsTableModel detailsTableModel; protected DetailsTableModel detailsTableModel;
protected DetailsTableRowSorter rowSorter; protected DetailsTableRowSorter rowSorter;
protected final KeyListener detailsKeyListener = new KeyAdapter() { protected final KeyListener detailsKeyListener = new KeyAdapter() {
@ -240,7 +240,9 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
if (index >= 0) { if (index >= 0) {
detailsTable.getSelectionModel().setSelectionInterval(index, index); detailsTable.getSelectionModel().setSelectionInterval(index, index);
Rectangle cellRect = detailsTable.getCellRect(index, detailsTable.convertColumnIndexToView(COLUMN_FILENAME), false); Rectangle cellRect = detailsTable.getCellRect(index,
detailsTable.convertColumnIndexToView(COLUMN_FILENAME),
false);
detailsTable.scrollRectToVisible(cellRect); detailsTable.scrollRectToVisible(cellRect);
} }
} }
@ -272,7 +274,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
int lastIndex = -1; int lastIndex = -1;
File editFile = null; File editFile = null;
JTextField editCell = null; JTextField editCell = null;
protected FocusListener editorFocusListener = new FocusAdapter() { protected final FocusListener editorFocusListener = new FocusAdapter() {
public void focusLost(final FocusEvent e) { public void focusLost(final FocusEvent e) {
if (!e.isTemporary()) { if (!e.isTemporary()) {
applyEdit(); applyEdit();
@ -348,7 +350,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
Boolean prop = (Boolean) chooser.getClientProperty("FileChooser.useShellFolder"); Boolean prop = (Boolean) chooser.getClientProperty("FileChooser.useShellFolder");
return prop == null ? chooser.getFileSystemView().equals(FileSystemView.getFileSystemView()) return prop == null ? chooser.getFileSystemView().equals(FileSystemView.getFileSystemView())
: prop.booleanValue(); : prop;
} }
public void uninstallUI() { public void uninstallUI() {
@ -926,23 +928,32 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
} }
String s = e.getPropertyName(); String s = e.getPropertyName();
if (s.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { switch (s) {
case JFileChooser.SELECTED_FILE_CHANGED_PROPERTY:
doSelectedFileChanged(e); doSelectedFileChanged(e);
} else if (s.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) { break;
case JFileChooser.SELECTED_FILES_CHANGED_PROPERTY:
doSelectedFilesChanged(e); doSelectedFilesChanged(e);
} else if (s.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) { break;
case JFileChooser.DIRECTORY_CHANGED_PROPERTY:
doDirectoryChanged(e); doDirectoryChanged(e);
} else if (s.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) { break;
case JFileChooser.FILE_FILTER_CHANGED_PROPERTY:
doFilterChanged(e); doFilterChanged(e);
} else if (s.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) { break;
case JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY:
doFileSelectionModeChanged(e); doFileSelectionModeChanged(e);
} else if (s.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) { break;
case JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY:
doMultiSelectionChanged(e); doMultiSelectionChanged(e);
} else if (s.equals(JFileChooser.CANCEL_SELECTION)) { break;
case JFileChooser.CANCEL_SELECTION:
applyEdit(); applyEdit();
} else if (s.equals("busy")) { break;
case "busy":
setCursor((Boolean) e.getNewValue() ? waitCursor : null); setCursor((Boolean) e.getNewValue() ? waitCursor : null);
} else if (s.equals(PropertyKey.COMPONENT_ORIENTATION)) { break;
case PropertyKey.COMPONENT_ORIENTATION:
ComponentOrientation o = (ComponentOrientation) e.getNewValue(); ComponentOrientation o = (ComponentOrientation) e.getNewValue();
JFileChooser cc = (JFileChooser) e.getSource(); JFileChooser cc = (JFileChooser) e.getSource();
if (o != e.getOldValue()) { if (o != e.getOldValue()) {
@ -952,6 +963,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
detailsTable.setComponentOrientation(o); detailsTable.setComponentOrientation(o);
detailsTable.getParent().getParent().setComponentOrientation(o); detailsTable.getParent().getParent().setComponentOrientation(o);
} }
break;
} }
} }
@ -1076,7 +1088,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
@SuppressWarnings("serial") @SuppressWarnings("serial")
// JDK-implementation class // JDK-implementation class
protected class ViewTypeAction extends AbstractAction { protected class ViewTypeAction extends AbstractAction {
protected int viewType; protected final int viewType;
ViewTypeAction(final int viewType) { ViewTypeAction(final int viewType) {
super(viewTypeActionNames[viewType]); super(viewTypeActionNames[viewType]);
@ -1134,8 +1146,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
@SuppressWarnings("serial") @SuppressWarnings("serial")
// JDK-implementation class // JDK-implementation class
class DetailsTableModel extends AbstractTableModel implements ListDataListener { class DetailsTableModel extends AbstractTableModel implements ListDataListener {
JFileChooser chooser; final JFileChooser chooser;
BasicDirectoryModel directoryModel; final BasicDirectoryModel directoryModel;
ShellFolderColumnInfo[] columns; ShellFolderColumnInfo[] columns;
int[] columnMap; int[] columnMap;
@ -1242,7 +1254,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
final File f2 = fsv.createFileObject(f.getParentFile(), newFileName); final File f2 = fsv.createFileObject(f.getParentFile(), newFileName);
if (f2.exists()) { if (f2.exists()) {
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText, JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText,
oldFileName), renameErrorTitleText, oldFileName),
renameErrorTitleText,
JOptionPane.ERROR_MESSAGE); JOptionPane.ERROR_MESSAGE);
} else { } else {
if (DarkFilePaneUIBridge.this.getModel().renameFile(f, f2)) { if (DarkFilePaneUIBridge.this.getModel().renameFile(f, f2)) {
@ -1262,7 +1275,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// chooser.setSelectedFile(null); // chooser.setSelectedFile(null);
} }
} else { } else {
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorText, oldFileName), JOptionPane.showMessageDialog(chooser,
MessageFormat.format(renameErrorText, oldFileName),
renameErrorTitleText, JOptionPane.ERROR_MESSAGE); renameErrorTitleText, JOptionPane.ERROR_MESSAGE);
} }
} }
@ -1367,8 +1381,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
* comparator. * comparator.
*/ */
protected class DirectoriesFirstComparatorWrapper implements Comparator<File> { protected class DirectoriesFirstComparatorWrapper implements Comparator<File> {
protected Comparator<Object> comparator; protected final Comparator<Object> comparator;
protected int column; protected final int column;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public DirectoriesFirstComparatorWrapper(final int column, final Comparator<?> comparator) { public DirectoriesFirstComparatorWrapper(final int column, final Comparator<?> comparator) {
@ -1427,8 +1441,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
@SuppressWarnings("serial") @SuppressWarnings("serial")
// JDK-implementation class // JDK-implementation class
public class DetailsTableCellRenderer extends DarkTableCellRenderer { public class DetailsTableCellRenderer extends DarkTableCellRenderer {
JFileChooser chooser; final JFileChooser chooser;
DateFormat df; final DateFormat df;
public DetailsTableCellRenderer(final JFileChooser chooser) { public DetailsTableCellRenderer(final JFileChooser chooser) {
this.chooser = chooser; this.chooser = chooser;
@ -1502,7 +1516,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
} }
protected class AlignableTableHeaderRenderer implements TableCellRenderer { protected class AlignableTableHeaderRenderer implements TableCellRenderer {
TableCellRenderer wrappedRenderer; final TableCellRenderer wrappedRenderer;
public AlignableTableHeaderRenderer(final TableCellRenderer wrappedRenderer) { public AlignableTableHeaderRenderer(final TableCellRenderer wrappedRenderer) {
this.wrappedRenderer = wrappedRenderer; this.wrappedRenderer = wrappedRenderer;

5
core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameTitlePane.java

@ -66,11 +66,6 @@ public class DarkInternalFrameTitlePane extends BasicInternalFrameTitlePane {
super(f); super(f);
} }
@Override
protected void installTitlePane() {
super.installTitlePane();
}
@Override @Override
protected void addSubComponents() { protected void addSubComponents() {
super.addSubComponents(); super.addSubComponents();

4
core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java

@ -47,8 +47,8 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener
private Color inactiveForeground; private Color inactiveForeground;
private Color cellForegroundNoFocus; private Color cellForegroundNoFocus;
protected Rectangle paintIconR = new Rectangle(); protected final Rectangle paintIconR = new Rectangle();
protected Rectangle paintTextR = new Rectangle(); protected final Rectangle paintTextR = new Rectangle();
public DarkLabelUI() { public DarkLabelUI() {
installUI(null); installUI(null);

2
core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListCellFocusBorder.java

@ -31,7 +31,7 @@ import java.awt.*;
public class DarkListCellFocusBorder extends DarkCellBorder { public class DarkListCellFocusBorder extends DarkCellBorder {
protected Color borderColor; protected final Color borderColor;
public DarkListCellFocusBorder() { public DarkListCellFocusBorder() {
borderColor = UIManager.getColor("List.focusBorderColor"); borderColor = UIManager.getColor("List.focusBorderColor");

26
core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java

@ -295,8 +295,7 @@ public class DarkListUIBridge extends BasicListUI {
* @param leadIndex a lead index * @param leadIndex a lead index
* @see #paint * @see #paint
*/ */
protected void paintCell( protected void paintCell(final Graphics g,
final Graphics g,
final int row, final int row,
final Rectangle rowBounds, final Rectangle rowBounds,
final ListCellRenderer cellRenderer, final ListCellRenderer cellRenderer,
@ -359,8 +358,7 @@ public class DarkListUIBridge extends BasicListUI {
BASELINE_COMPONENT_KEY); BASELINE_COMPONENT_KEY);
if (renderer == null) { if (renderer == null) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ListCellRenderer<Object> lcr = (ListCellRenderer) UIManager.get( ListCellRenderer<Object> lcr = (ListCellRenderer<Object>) UIManager.get("List.cellRenderer");
"List.cellRenderer");
// fix for 6711072 some LAFs like Nimbus do not provide this // fix for 6711072 some LAFs like Nimbus do not provide this
// UIManager key and we should not through a NPE here because of it // UIManager key and we should not through a NPE here because of it
@ -652,7 +650,7 @@ public class DarkListUIBridge extends BasicListUI {
if (list.getCellRenderer() == null) { if (list.getCellRenderer() == null) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ListCellRenderer<Object> tmp = (ListCellRenderer) (UIManager.get("List.cellRenderer")); ListCellRenderer<Object> tmp = (ListCellRenderer<Object>) (UIManager.get("List.cellRenderer"));
list.setCellRenderer(tmp); list.setCellRenderer(tmp);
} }
@ -716,7 +714,7 @@ public class DarkListUIBridge extends BasicListUI {
*/ */
public void installUI(final JComponent c) { public void installUI(final JComponent c) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
JList<Object> tmp = (JList) c; JList<Object> tmp = (JList<Object>) c;
list = tmp; list = tmp;
layoutOrientation = list.getLayoutOrientation(); layoutOrientation = list.getLayoutOrientation();
@ -1434,9 +1432,6 @@ public class DarkListUIBridge extends BasicListUI {
(column == 0 && columnCount == 1)) { (column == 0 && columnCount == 1)) {
return list.getModel().getSize(); return list.getModel().getSize();
} }
if (column >= columnCount) {
return -1;
}
if (layoutOrientation == JList.VERTICAL_WRAP) { if (layoutOrientation == JList.VERTICAL_WRAP) {
if (column < (columnCount - 1)) { if (column < (columnCount - 1)) {
return rowsPerColumn; return rowsPerColumn;
@ -1742,7 +1737,7 @@ public class DarkListUIBridge extends BasicListUI {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
protected Transferable createTransferable(final JComponent c) { protected Transferable createTransferable(final JComponent c) {
if (c instanceof JList) { if (c instanceof JList) {
JList<?> list = (JList) c; JList<?> list = (JList<Object>) c;
Object[] values = list.getSelectedValues(); Object[] values = list.getSelectedValues();
if (values == null || values.length == 0) { if (values == null || values.length == 0) {
@ -1754,8 +1749,7 @@ public class DarkListUIBridge extends BasicListUI {
htmlStr.append("<html>\n<body>\n<ul>\n"); htmlStr.append("<html>\n<body>\n<ul>\n");
for (int i = 0; i < values.length; i++) { for (Object obj : values) {
Object obj = values[i];
String val = ((obj == null) ? "" : obj.toString()); String val = ((obj == null) ? "" : obj.toString());
plainStr.append(val).append('\n'); plainStr.append(val).append('\n');
htmlStr.append(" <li>").append(val).append('\n'); htmlStr.append(" <li>").append(val).append('\n');
@ -2369,7 +2363,7 @@ public class DarkListUIBridge extends BasicListUI {
// discontinuous selection actions are only enabled for // discontinuous selection actions are only enabled for
// DefaultListSelectionModel // DefaultListSelectionModel
return c != null && ((JList) c).getSelectionModel() return c != null && ((JList<Object>) c).getSelectionModel()
instanceof DefaultListSelectionModel; instanceof DefaultListSelectionModel;
} }
@ -2562,7 +2556,7 @@ public class DarkListUIBridge extends BasicListUI {
* letters followed by first typed another letter. * letters followed by first typed another letter.
*/ */
public void keyTyped(final KeyEvent e) { public void keyTyped(final KeyEvent e) {
JList<?> src = (JList) e.getSource(); JList<?> src = (JList<?>) e.getSource();
ListModel<?> model = src.getModel(); ListModel<?> model = src.getModel();
if (model.getSize() == 0 || e.isAltDown() || if (model.getSize() == 0 || e.isAltDown() ||
@ -2657,8 +2651,8 @@ public class DarkListUIBridge extends BasicListUI {
* listDataListener from the old model and add it to the new one. * listDataListener from the old model and add it to the new one.
*/ */
if (Objects.equals(propertyName, "model")) { if (Objects.equals(propertyName, "model")) {
ListModel<?> oldModel = (ListModel) e.getOldValue(); ListModel<?> oldModel = (ListModel<?>) e.getOldValue();
ListModel<?> newModel = (ListModel) e.getNewValue(); ListModel<?> newModel = (ListModel<?>) e.getNewValue();
if (oldModel != null) { if (oldModel != null) {
oldModel.removeListDataListener(listDataListener); oldModel.removeListDataListener(listDataListener);
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuBarBorder.java

@ -34,7 +34,7 @@ import java.awt.*;
*/ */
public class DarkMenuBarBorder implements Border, UIResource { public class DarkMenuBarBorder implements Border, UIResource {
protected Color borderColor; protected final Color borderColor;
public DarkMenuBarBorder() { public DarkMenuBarBorder() {
borderColor = UIManager.getColor("MenuBar.borderColor"); borderColor = UIManager.getColor("MenuBar.borderColor");

12
core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuItemUIBase.java

@ -23,11 +23,7 @@
*/ */
package com.github.weisj.darklaf.ui.menu; package com.github.weisj.darklaf.ui.menu;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.*;
import com.github.weisj.darklaf.util.GraphicsContext;
import com.github.weisj.darklaf.util.GraphicsUtil;
import com.github.weisj.darklaf.util.LazyActionMap;
import com.github.weisj.darklaf.util.StringUtil;
import sun.swing.MenuItemLayoutHelper; import sun.swing.MenuItemLayoutHelper;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
import sun.swing.UIAction; import sun.swing.UIAction;
@ -98,9 +94,11 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
DarkUIUtil.applyInsets(viewRect, mi.getInsets()); DarkUIUtil.applyInsets(viewRect, mi.getInsets());
MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon, MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon,
arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, arrowIcon, viewRect, defaultTextIconGap,
acceleratorDelimiter,
mi.getComponentOrientation().isLeftToRight(), mi.getFont(), mi.getComponentOrientation().isLeftToRight(), mi.getFont(),
acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem), acceleratorFont,
MenuItemLayoutHelper.useCheckAndArrow(menuItem),
getPropertyPrefix()); getPropertyPrefix());
MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();

6
core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java

@ -156,9 +156,11 @@ public class DarkMenuUI extends BasicMenuUI {
DarkUIUtil.applyInsets(viewRect, mi.getInsets()); DarkUIUtil.applyInsets(viewRect, mi.getInsets());
MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon, MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon,
arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter, arrowIcon, viewRect, defaultTextIconGap,
acceleratorDelimiter,
mi.getComponentOrientation().isLeftToRight(), mi.getFont(), mi.getComponentOrientation().isLeftToRight(), mi.getFont(),
acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem), acceleratorFont,
MenuItemLayoutHelper.useCheckAndArrow(menuItem),
getPropertyPrefix()); getPropertyPrefix());
MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem(); MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();

9
core/src/main/java/com/github/weisj/darklaf/ui/numberingpane/DarkNumberingPaneUI.java

@ -202,13 +202,15 @@ public class DarkNumberingPaneUI extends ComponentUI {
g.setColor(lineRect.y == yCur ? foregroundHighlight : numberingPane.getForeground()); g.setColor(lineRect.y == yCur ? foregroundHighlight : numberingPane.getForeground());
g.drawString(String.format("%1$" + digits + "d", i), OUTER_PAD, g.drawString(String.format("%1$" + digits + "d", i), OUTER_PAD,
lineRect.y + lineRect.height - descent); lineRect.y + lineRect.height - descent);
} catch (BadLocationException ignored) { } } catch (BadLocationException ignored) {
}
} }
config.restore(); config.restore();
} }
protected void paintIcons(final Graphics g, final int startLine, final int endLine, final Element root) { protected void paintIcons(final Graphics g, final int startLine, final int endLine, final Element root) {
List<Map.Entry<Position, Icon>> icons = numberingPane.getIconsInRange(root.getElement(startLine).getStartOffset(), List<Map.Entry<Position, Icon>> icons = numberingPane.getIconsInRange(
root.getElement(startLine).getStartOffset(),
root.getElement(endLine).getEndOffset()); root.getElement(endLine).getEndOffset());
for (Map.Entry<Position, Icon> icon : icons) { for (Map.Entry<Position, Icon> icon : icons) {
Rectangle lineRect; Rectangle lineRect;
@ -264,7 +266,8 @@ public class DarkNumberingPaneUI extends ComponentUI {
listener.iconClicked(e); listener.iconClicked(e);
} }
} }
} catch (BadLocationException ignored) { } } catch (BadLocationException ignored) {
}
} }
IndexListener[] list = numberingPane.getIndexListeners(); IndexListener[] list = numberingPane.getIndexListeners();
for (IndexListener listener : list) { for (IndexListener listener : list) {

5
core/src/main/java/com/github/weisj/darklaf/ui/optionpane/DarkOptionPaneUI.java

@ -38,11 +38,6 @@ public class DarkOptionPaneUI extends BasicOptionPaneUI {
return new DarkOptionPaneUI(); return new DarkOptionPaneUI();
} }
@Override
protected LayoutManager createLayoutManager() {
return super.createLayoutManager();
}
@Override @Override
protected Container createButtonArea() { protected Container createButtonArea() {
JPanel bottom = new JPanel(); JPanel bottom = new JPanel();

3
core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/DarkPopupMenuBorder.java

@ -40,7 +40,8 @@ public class DarkPopupMenuBorder extends MutableLineBorder implements UIResource
} }
@Override @Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width,
final int height) {
setColor(UIManager.getDefaults().getColor("PopupMenu.borderColor")); setColor(UIManager.getDefaults().getColor("PopupMenu.borderColor"));
super.paintBorder(c, g, x, y, width, height); super.paintBorder(c, g, x, y, width, height);
} }

9
core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarUI.java

@ -146,13 +146,15 @@ public class DarkProgressBarUI extends BasicProgressBarUI implements PropertyCha
shape = getShapedRect(r.x, yOffset, r.width, pHeight, pHeight); shape = getShapedRect(r.x, yOffset, r.width, pHeight, pHeight);
yOffset = r.y + pHeight / 2; yOffset = r.y + pHeight / 2;
g2.setPaint(new GradientPaint(r.x + getAnimationIndex() * step * 2, yOffset, startColor, g2.setPaint(new GradientPaint(r.x + getAnimationIndex() * step * 2, yOffset, startColor,
r.x + getFrameCount() * step + getAnimationIndex() * step * 2, yOffset, r.x + getFrameCount() * step + getAnimationIndex() * step * 2,
yOffset,
endColor, true)); endColor, true));
} else { } else {
shape = getShapedRect(xOffset, r.y, pWidth, r.height, pWidth); shape = getShapedRect(xOffset, r.y, pWidth, r.height, pWidth);
xOffset = r.x + pWidth / 2; xOffset = r.x + pWidth / 2;
g2.setPaint(new GradientPaint(xOffset, r.y + getAnimationIndex() * step * 2, startColor, g2.setPaint(new GradientPaint(xOffset, r.y + getAnimationIndex() * step * 2, startColor,
xOffset, r.y + getFrameCount() * step + getAnimationIndex() * step * 2, xOffset,
r.y + getFrameCount() * step + getAnimationIndex() * step * 2,
endColor, true)); endColor, true));
} }
g2.fill(shape); g2.fill(shape);
@ -180,7 +182,8 @@ public class DarkProgressBarUI extends BasicProgressBarUI implements PropertyCha
@Override @Override
protected void installDefaults() { protected void installDefaults() {
super.installDefaults(); super.installDefaults();
UIManager.put("ProgressBar.repaintInterval", isSimplified() ? REPAINT_INTERVAL_SIMPLIFIED : REPAINT_INTERVAL_DEFAULT); UIManager.put("ProgressBar.repaintInterval",
isSimplified() ? REPAINT_INTERVAL_SIMPLIFIED : REPAINT_INTERVAL_DEFAULT);
UIManager.put("ProgressBar.cycleTime", isSimplified() ? CYCLE_TIME_SIMPLIFIED : CYCLE_TIME_DEFAULT); UIManager.put("ProgressBar.cycleTime", isSimplified() ? CYCLE_TIME_SIMPLIFIED : CYCLE_TIME_DEFAULT);
trackColor = UIManager.getColor("ProgressBar.trackColor"); trackColor = UIManager.getColor("ProgressBar.trackColor");
progressColor = UIManager.getColor("ProgressBar.progressColor"); progressColor = UIManager.getColor("ProgressBar.progressColor");

2
core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java

@ -55,7 +55,7 @@ public class DarkRootPaneUI extends BasicRootPaneUI implements HierarchyListener
private LayoutManager layoutManager; private LayoutManager layoutManager;
private LayoutManager oldLayout; private LayoutManager oldLayout;
private JRootPane rootPane; private JRootPane rootPane;
private DisposeListener disposeListener = new DisposeListener(); private final DisposeListener disposeListener = new DisposeListener();
private boolean decorationStyleLock = false; private boolean decorationStyleLock = false;
private int windowDecorationsStyle = -1; private int windowDecorationsStyle = -1;

20
core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarListener.java

@ -43,10 +43,10 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected final JScrollBar scrollbar; protected final JScrollBar scrollbar;
private final DarkScrollBarUI ui; private final DarkScrollBarUI ui;
private Animator trackFadeoutAnimator; private final Animator trackFadeoutAnimator;
private Animator trackFadeinAnimator; private final Animator trackFadeinAnimator;
private Animator thumbFadeoutAnimator; private final Animator thumbFadeoutAnimator;
private Animator thumbFadeinAnimator; private final Animator thumbFadeinAnimator;
protected boolean mouseOverThumb = false; protected boolean mouseOverThumb = false;
protected boolean mouseOverTrack = false; protected boolean mouseOverTrack = false;
@ -221,7 +221,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class TrackFadeOutAnimator extends Animator { protected class TrackFadeOutAnimator extends Animator {
public TrackFadeOutAnimator() { public TrackFadeOutAnimator() {
super("Track fadeout", DarkScrollBarListener.FADEOUT_FRAMES_COUNT, DarkScrollBarListener.FADEOUT_FRAMES_COUNT * DarkScrollBarListener.FADEOUT_FRAME_COUNT_FACTOR, false); super("Track fadeout", DarkScrollBarListener.FADEOUT_FRAMES_COUNT,
DarkScrollBarListener.FADEOUT_FRAMES_COUNT * DarkScrollBarListener.FADEOUT_FRAME_COUNT_FACTOR, false);
} }
public void paintNow(final int frame, final int totalFrames, final int cycle) { public void paintNow(final int frame, final int totalFrames, final int cycle) {
@ -245,7 +246,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class ThumbFadeInAnimator extends Animator { protected class ThumbFadeInAnimator extends Animator {
public ThumbFadeInAnimator() { public ThumbFadeInAnimator() {
super("Thumb fadein", DarkScrollBarListener.FADEIN_FRAMES_COUNT / 2, DarkScrollBarListener.FADEIN_FRAMES_COUNT * DarkScrollBarListener.FADEIN_FRAME_COUNT_FACTOR, false); super("Thumb fadein", DarkScrollBarListener.FADEIN_FRAMES_COUNT / 2,
DarkScrollBarListener.FADEIN_FRAMES_COUNT * DarkScrollBarListener.FADEIN_FRAME_COUNT_FACTOR, false);
} }
@Override @Override
@ -273,7 +275,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class TrackFadeInAnimator extends Animator { protected class TrackFadeInAnimator extends Animator {
public TrackFadeInAnimator() { public TrackFadeInAnimator() {
super("Track fadein", DarkScrollBarListener.FADEIN_FRAMES_COUNT, DarkScrollBarListener.FADEIN_FRAMES_COUNT * DarkScrollBarListener.FADEIN_FRAME_COUNT_FACTOR, false); super("Track fadein", DarkScrollBarListener.FADEIN_FRAMES_COUNT,
DarkScrollBarListener.FADEIN_FRAMES_COUNT * DarkScrollBarListener.FADEIN_FRAME_COUNT_FACTOR, false);
} }
public void paintNow(final int frame, final int totalFrames, final int cycle) { public void paintNow(final int frame, final int totalFrames, final int cycle) {
@ -294,7 +297,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class ThumbFadeOutAnimator extends Animator { protected class ThumbFadeOutAnimator extends Animator {
public ThumbFadeOutAnimator() { public ThumbFadeOutAnimator() {
super("Adjustment fadeout", DarkScrollBarListener.FADEOUT_FRAMES_COUNT, DarkScrollBarListener.FADEOUT_FRAMES_COUNT * DarkScrollBarListener.FADEOUT_FRAME_COUNT_FACTOR, false); super("Adjustment fadeout", DarkScrollBarListener.FADEOUT_FRAMES_COUNT,
DarkScrollBarListener.FADEOUT_FRAMES_COUNT * DarkScrollBarListener.FADEOUT_FRAME_COUNT_FACTOR, false);
} }
@Override @Override

10
core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerBorder.java

@ -38,11 +38,11 @@ import java.awt.*;
*/ */
public class DarkSpinnerBorder implements Border, UIResource { public class DarkSpinnerBorder implements Border, UIResource {
protected Color focusBorderColor; protected final Color focusBorderColor;
protected Color borderColor; protected final Color borderColor;
protected Color inactiveBorderColor; protected final Color inactiveBorderColor;
protected int arc; protected final int arc;
protected int borderSize; protected final int borderSize;
protected Insets insets; protected Insets insets;
protected Insets cellInsets; protected Insets cellInsets;

14
core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneDivider.java

@ -37,13 +37,13 @@ import java.awt.*;
*/ */
public class DarkSplitPaneDivider extends BasicSplitPaneDivider { public class DarkSplitPaneDivider extends BasicSplitPaneDivider {
protected Icon leftOneTouch; protected final Icon leftOneTouch;
protected Icon rightOneTouch; protected final Icon rightOneTouch;
protected Icon topOneTouch; protected final Icon topOneTouch;
protected Icon bottomOneTouch; protected final Icon bottomOneTouch;
protected Icon verticalSplit; protected final Icon verticalSplit;
protected Icon horizontalSplit; protected final Icon horizontalSplit;
protected Color borderColor; protected final Color borderColor;
public DarkSplitPaneDivider(final BasicSplitPaneUI ui) { public DarkSplitPaneDivider(final BasicSplitPaneUI ui) {
super(ui); super(ui);

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkHandler.java

@ -36,7 +36,7 @@ import java.beans.PropertyChangeEvent;
public class DarkHandler extends TabbedPaneHandler { public class DarkHandler extends TabbedPaneHandler {
protected DarkTabbedPaneUI ui; protected final DarkTabbedPaneUI ui;
protected Point origin; protected Point origin;
protected Point tabOrigin; protected Point tabOrigin;

5
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabPanel.java

@ -29,7 +29,7 @@ class DarkScrollableTabPanel extends ScrollableTabPanel {
protected final Rectangle iconRect = new Rectangle(); protected final Rectangle iconRect = new Rectangle();
protected final Rectangle textRect = new Rectangle(); protected final Rectangle textRect = new Rectangle();
private DarkTabbedPaneUI ui; private final DarkTabbedPaneUI ui;
public DarkScrollableTabPanel(final DarkTabbedPaneUI ui) { public DarkScrollableTabPanel(final DarkTabbedPaneUI ui) {
super(ui); super(ui);
@ -79,7 +79,8 @@ class DarkScrollableTabPanel extends ScrollableTabPanel {
public void paint(final Graphics g) { public void paint(final Graphics g) {
super.paint(g); super.paint(g);
if (ui.dragging && ui.tabPane.getTabCount() > 0) { if (ui.dragging && ui.tabPane.getTabCount() > 0) {
ui.paintTab(g, ui.tabPane.getTabPlacement(), ui.dragRect, ui.tabPane.getSelectedIndex(), iconRect, textRect); ui.paintTab(g, ui.tabPane.getTabPlacement(), ui.dragRect, ui.tabPane.getSelectedIndex(), iconRect,
textRect);
Component comp = ui.tabPane.getTabComponentAt(ui.dropSourceIndex); Component comp = ui.tabPane.getTabComponentAt(ui.dropSourceIndex);
if (comp != null) { if (comp != null) {
g.translate(comp.getX(), comp.getY()); g.translate(comp.getX(), comp.getY());

5
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java

@ -43,7 +43,7 @@ public class DarkScrollableTabSupport extends ScrollableTabSupport implements Mo
protected final JComponent newTabButton; protected final JComponent newTabButton;
protected final Timer timer; protected final Timer timer;
protected long lastClickEvent; protected long lastClickEvent;
private DarkTabbedPaneUI ui; private final DarkTabbedPaneUI ui;
public DarkScrollableTabSupport(final DarkTabbedPaneUI ui, final int tabPlacement) { public DarkScrollableTabSupport(final DarkTabbedPaneUI ui, final int tabPlacement) {
super(ui); super(ui);
@ -59,7 +59,8 @@ public class DarkScrollableTabSupport extends ScrollableTabSupport implements Mo
moreTabsButton.addActionListener(this); moreTabsButton.addActionListener(this);
newTabButton = ui.createNewTabButton(); newTabButton = ui.createNewTabButton();
newTabButton.setVisible(Boolean.TRUE.equals(ui.tabPane.getClientProperty(DarkTabbedPaneUI.KEY_SHOW_NEW_TAB_BUTTON))); newTabButton.setVisible(
Boolean.TRUE.equals(ui.tabPane.getClientProperty(DarkTabbedPaneUI.KEY_SHOW_NEW_TAB_BUTTON)));
scrollPopupMenu = new ScrollPopupMenu(UIManager.getInt(DarkTabbedPaneUI.KEY_MAX_POPUP_HEIGHT)); scrollPopupMenu = new ScrollPopupMenu(UIManager.getInt(DarkTabbedPaneUI.KEY_MAX_POPUP_HEIGHT));
PopupMenuListener popupMenuListener = new PopupMenuAdapter() { PopupMenuListener popupMenuListener = new PopupMenuAdapter() {

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabAreaButton.java

@ -29,7 +29,7 @@ import java.awt.*;
public class DarkTabAreaButton extends JButton implements UIResource { public class DarkTabAreaButton extends JButton implements UIResource {
private DarkTabbedPaneUI ui; private final DarkTabbedPaneUI ui;
public DarkTabAreaButton(final DarkTabbedPaneUI ui) { public DarkTabAreaButton(final DarkTabbedPaneUI ui) {
this.ui = ui; this.ui = ui;

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneLayout.java

@ -28,7 +28,7 @@ import java.awt.*;
public class DarkTabbedPaneLayout extends TabbedPaneLayout { public class DarkTabbedPaneLayout extends TabbedPaneLayout {
private DarkTabbedPaneUI ui; private final DarkTabbedPaneUI ui;
public DarkTabbedPaneLayout(final DarkTabbedPaneUI ui) { public DarkTabbedPaneLayout(final DarkTabbedPaneUI ui) {
super(ui); super(ui);

5
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java

@ -29,7 +29,7 @@ import java.util.function.Function;
public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout { public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
private DarkTabbedPaneUI ui; private final DarkTabbedPaneUI ui;
public DarkTabbedPaneScrollLayout(final DarkTabbedPaneUI ui) { public DarkTabbedPaneScrollLayout(final DarkTabbedPaneUI ui) {
super(ui); super(ui);
@ -570,7 +570,8 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
protected void restoreHiddenTabsY(final int minY, final int maxY, final int tabCount) { protected void restoreHiddenTabsY(final int minY, final int maxY, final int tabCount) {
if (ui.maxVisible < 0 || ui.maxVisible >= tabCount) return; if (ui.maxVisible < 0 || ui.maxVisible >= tabCount) return;
int space = Math.max(maxY - ui.rects[ui.maxVisible].y - ui.rects[ui.maxVisible].height - ui.currentShiftYTmp, 0); int space = Math.max(maxY - ui.rects[ui.maxVisible].y - ui.rects[ui.maxVisible].height - ui.currentShiftYTmp,
0);
int shift = Math.min(minY - ui.rects[0].y - ui.currentShiftYTmp, space); int shift = Math.min(minY - ui.rects[0].y - ui.currentShiftYTmp, space);
shiftTabsY(shift, minY, maxY, tabCount, true); shiftTabsY(shift, minY, maxY, tabCount, true);
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUI.java

@ -101,7 +101,7 @@ public class DarkTabbedPaneUI extends DarkTabbedPaneUIBridge {
protected int focusSize; protected int focusSize;
protected boolean dragging; protected boolean dragging;
protected Rectangle dragRect = new Rectangle(); protected final Rectangle dragRect = new Rectangle();
protected Color dragBorderColor; protected Color dragBorderColor;
protected Color dropBackground; protected Color dropBackground;

5
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/MoreTabsButton.java

@ -35,7 +35,7 @@ public class MoreTabsButton extends DarkTabAreaButton {
protected final static String INFINITY = "\u221e"; protected final static String INFINITY = "\u221e";
protected final Icon icon; protected final Icon icon;
protected DarkTabbedPaneUI ui; protected final DarkTabbedPaneUI ui;
protected final int pad; protected final int pad;
public MoreTabsButton(final DarkTabbedPaneUI ui) { public MoreTabsButton(final DarkTabbedPaneUI ui) {
@ -87,7 +87,8 @@ public class MoreTabsButton extends DarkTabAreaButton {
protected String getLabelString() { protected String getLabelString() {
int invisible = Math.min(ui.minVisible - 1 + ui.tabPane.getTabCount() - ui.maxVisible, ui.tabPane.getTabCount()); int invisible = Math.min(ui.minVisible - 1 + ui.tabPane.getTabCount() - ui.maxVisible,
ui.tabPane.getTabCount());
return invisible >= 100 ? INFINITY : String.valueOf(invisible); return invisible >= 100 ? INFINITY : String.valueOf(invisible);
} }

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java

@ -33,7 +33,7 @@ import java.awt.*;
public class NewTabButton extends JPanel implements UIResource { public class NewTabButton extends JPanel implements UIResource {
protected final JButton button; protected final JButton button;
protected DarkTabbedPaneUI ui; protected final DarkTabbedPaneUI ui;
protected NewTabButton(final DarkTabbedPaneUI ui) { protected NewTabButton(final DarkTabbedPaneUI ui) {
this.ui = ui; this.ui = ui;

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/ScrollableTabPanel.java

@ -28,7 +28,7 @@ import javax.swing.plaf.UIResource;
import java.awt.*; import java.awt.*;
public class ScrollableTabPanel extends JPanel implements UIResource { public class ScrollableTabPanel extends JPanel implements UIResource {
private DarkTabbedPaneUIBridge ui; private final DarkTabbedPaneUIBridge ui;
public ScrollableTabPanel(final DarkTabbedPaneUIBridge ui) { public ScrollableTabPanel(final DarkTabbedPaneUIBridge ui) {
super(null); super(null);

17
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneTransferHandler.java

@ -31,19 +31,7 @@ import java.awt.*;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DragGestureEvent; import java.awt.dnd.*;
import java.awt.dnd.DragGestureListener;
import java.awt.dnd.DragGestureRecognizer;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceContext;
import java.awt.dnd.DragSourceDragEvent;
import java.awt.dnd.DragSourceDropEvent;
import java.awt.dnd.DragSourceEvent;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.awt.dnd.DropTargetListener;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@ -260,7 +248,8 @@ public class TabbedPaneTransferHandler extends TransferHandler implements DropTa
} }
Rectangle dropRect = TabbedPaneUtil.getDropRect(supportsIndicator(destTabbedPane), destTabbedPane, Rectangle dropRect = TabbedPaneUtil.getDropRect(supportsIndicator(destTabbedPane), destTabbedPane,
t.transferData.sourceTabbedPane, mouseLocation, t.transferData.sourceTabbedPane, mouseLocation,
t.getTabBounds(), tab, t.transferData.tabIndex, lastTab); t.getTabBounds(), tab, t.transferData.tabIndex,
lastTab);
ui.setDnDIndicatorRect(dropRect.x, dropRect.y, dropRect.width, dropRect.height, ui.setDnDIndicatorRect(dropRect.x, dropRect.y, dropRect.width, dropRect.height,
tab, t.transferData.sourceTabbedPane == destTabbedPane); tab, t.transferData.sourceTabbedPane == destTabbedPane);
lastTab = tab; lastTab = tab;

6
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneUtil.java

@ -124,14 +124,16 @@ public class TabbedPaneUtil implements SwingConstants {
calculateDropRectScrollLayout(destTabbedPane, source, tabBounds, tab, sourceIndex, calculateDropRectScrollLayout(destTabbedPane, source, tabBounds, tab, sourceIndex,
lastTab, tabPlacement, destRect); lastTab, tabPlacement, destRect);
} else { } else {
calculateDropRectWrapLayout(ui, destTabbedPane, source, mouseLocation, tabBounds, tab, sourceIndex, destRect); calculateDropRectWrapLayout(ui, destTabbedPane, source, mouseLocation, tabBounds, tab, sourceIndex,
destRect);
} }
return tabBounds; return tabBounds;
} }
private static void calculateDropRectScrollLayout(final JTabbedPane destTabbedPane, final JTabbedPane source, private static void calculateDropRectScrollLayout(final JTabbedPane destTabbedPane, final JTabbedPane source,
final Rectangle tabBounds, final int tab, final int sourceIndex, final Rectangle tabBounds, final int tab, final int sourceIndex,
final int lastTab, final int tabPlacement, final Rectangle destRect) { final int lastTab, final int tabPlacement,
final Rectangle destRect) {
boolean lastInSource = false; boolean lastInSource = false;
if (destTabbedPane == source && (tab == sourceIndex || (sourceIndex == source.getTabCount() - 1 if (destTabbedPane == source && (tab == sourceIndex || (sourceIndex == source.getTabCount() - 1
&& tab == source.getTabCount()))) { && tab == source.getTabCount()))) {

3
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java

@ -357,7 +357,8 @@ public class DarkPanelPopupUI extends DarkPanelUI implements PropertyChangeListe
if (focusOwner instanceof JRootPane) return; if (focusOwner instanceof JRootPane) return;
boolean focus = DarkUIUtil.hasFocus(popupComponent); boolean focus = DarkUIUtil.hasFocus(popupComponent);
if (popupComponent.getTabFrame() != null) { if (popupComponent.getTabFrame() != null) {
Container container = popupComponent.getTabFrame().getContentPane().getContainer(popupComponent.getAlignment()); Container container = popupComponent.getTabFrame().getContentPane().getContainer(
popupComponent.getAlignment());
focus = focus || DarkUIUtil.hasFocus(container); focus = focus || DarkUIUtil.hasFocus(container);
} }
setHeaderBackground(focus); setHeaderBackground(focus);

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameComponentPopupMenu.java

@ -37,7 +37,7 @@ import java.beans.PropertyChangeListener;
public class DarkTabFrameComponentPopupMenu extends JXPopupMenu implements PropertyChangeListener, UIResource { public class DarkTabFrameComponentPopupMenu extends JXPopupMenu implements PropertyChangeListener, UIResource {
private final TabFrameTab tab; private final TabFrameTab tab;
private JMenuItem[] actions; private final JMenuItem[] actions;
private int disabled = -1; private int disabled = -1;
public DarkTabFrameComponentPopupMenu(final TabFrameTab tab) { public DarkTabFrameComponentPopupMenu(final TabFrameTab tab) {

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java

@ -66,7 +66,7 @@ public class DarkTabFrameTabLabelUI extends DarkLabelUI implements PropertyChang
private Color selectedFontColor; private Color selectedFontColor;
private Color selectedColor; private Color selectedColor;
private Color hoverColor; private Color hoverColor;
private RotatableIcon rotatableIcon = new RotatableIcon(); private final RotatableIcon rotatableIcon = new RotatableIcon();
private boolean printing; private boolean printing;

2
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameUI.java

@ -67,7 +67,7 @@ public class DarkTabFrameUI extends TabFrameUI implements AWTEventListener {
private TabFrameLayout layout; private TabFrameLayout layout;
private int tabHeight; private int tabHeight;
private Color dragBorderColor; private Color dragBorderColor;
private Dimension dropSize = new Dimension(); private final Dimension dropSize = new Dimension();
private Alignment sourceAlign; private Alignment sourceAlign;
private int sourceIndex; private int sourceIndex;
private Alignment destAlign; private Alignment destAlign;

4
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabDragListener.java

@ -52,6 +52,7 @@ public class TabDragListener extends MouseAdapter {
origin = null; origin = null;
} }
@SuppressWarnings("unchecked")
@Override @Override
public void mouseDragged(final MouseEvent e) { public void mouseDragged(final MouseEvent e) {
if (origin == null) origin = e.getPoint(); if (origin == null) origin = e.getPoint();
@ -60,7 +61,8 @@ public class TabDragListener extends MouseAdapter {
if (th != null && tabComponent.getTabFrame().isDndEnabled()) { if (th != null && tabComponent.getTabFrame().isDndEnabled()) {
Point p = e.getPoint(); Point p = e.getPoint();
p = SwingXUtilities.convertPointToParent(tabComponent.getComponent(), p); p = SwingXUtilities.convertPointToParent(tabComponent.getComponent(), p);
JXLayer layer = DarkUIUtil.getParentOfType(JXLayer.class, tabComponent.getComponent()); JXLayer<? extends JComponent> layer = DarkUIUtil.getParentOfType(JXLayer.class,
tabComponent.getComponent());
p = SwingUtilities.convertPoint(layer != null ? layer : tabComponent.getComponent().getParent(), p = SwingUtilities.convertPoint(layer != null ? layer : tabComponent.getComponent().getParent(),
p, tabComponent.getTabFrame()); p, tabComponent.getTabFrame());
tabComponent.getTabFrame().initTransfer(tabComponent.getOrientation(), tabComponent.getIndex()); tabComponent.getTabFrame().initTransfer(tabComponent.getOrientation(), tabComponent.getIndex());

9
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameLayout.java

@ -37,9 +37,9 @@ import java.util.Arrays;
public class TabFrameLayout implements LayoutManager { public class TabFrameLayout implements LayoutManager {
private final JTabFrame tabFrame; private final JTabFrame tabFrame;
private DarkTabFrameUI ui; private final DarkTabFrameUI ui;
private int[] shift; private final int[] shift;
private boolean[] draggedOver; private final boolean[] draggedOver;
private int topHeight; private int topHeight;
private int leftHeight; private int leftHeight;
private int rightHeight; private int rightHeight;
@ -230,7 +230,8 @@ public class TabFrameLayout implements LayoutManager {
int size = rightSize > 0 ? rightHeight : tabFrame.getTabSize(); int size = rightSize > 0 ? rightHeight : tabFrame.getTabSize();
int height = dim.height - topPane.getHeight() - bottomPane.getHeight(); int height = dim.height - topPane.getHeight() - bottomPane.getHeight();
rightPane.setBounds(dim.width - rightHeight, topPane.getHeight(), size, height + (height % 2)); rightPane.setBounds(dim.width - rightHeight, topPane.getHeight(), size, height + (height % 2));
tabFrame.getRightTabContainer().setPreferredSize(new Dimension(rightPane.getHeight(), rightPane.getWidth())); tabFrame.getRightTabContainer().setPreferredSize(
new Dimension(rightPane.getHeight(), rightPane.getWidth()));
tabFrame.getRightTabContainer().setSize(tabFrame.getRightTabContainer().getPreferredSize()); tabFrame.getRightTabContainer().setSize(tabFrame.getRightTabContainer().getPreferredSize());
if (rightSize > 0) { if (rightSize > 0) {
Point start = new Point(0, 0); Point start = new Point(0, 0);

3
core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameTransferHandler.java

@ -70,7 +70,8 @@ public class TabFrameTransferHandler extends TransferHandler implements DropTarg
if (lastTabFrame != null) { if (lastTabFrame != null) {
Point p = MouseInfo.getPointerInfo().getLocation(); Point p = MouseInfo.getPointerInfo().getLocation();
SwingUtilities.convertPointFromScreen(p, lastTabFrame); SwingUtilities.convertPointFromScreen(p, lastTabFrame);
DropTargetDragEvent evt = new DropTargetDragEvent(lastTabFrame.getDropTarget().getDropTargetContext(), p, MOVE, MOVE); DropTargetDragEvent evt = new DropTargetDragEvent(lastTabFrame.getDropTarget().getDropTargetContext(),
p, MOVE, MOVE);
dragOver(evt); dragOver(evt);
} }
}); });

4
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableCellFocusBorder.java

@ -34,8 +34,8 @@ import java.awt.*;
*/ */
public class DarkTableCellFocusBorder extends DarkCellBorder { public class DarkTableCellFocusBorder extends DarkCellBorder {
protected Color rowBorderColor; protected final Color rowBorderColor;
protected Color borderColor; protected final Color borderColor;
public DarkTableCellFocusBorder() { public DarkTableCellFocusBorder() {
rowBorderColor = UIManager.getColor("Table.focusRowBorderColor"); rowBorderColor = UIManager.getColor("Table.focusRowBorderColor");

4
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderCorner.java

@ -32,8 +32,8 @@ import java.awt.*;
*/ */
public class DarkTableHeaderCorner extends JComponent implements UIResource { public class DarkTableHeaderCorner extends JComponent implements UIResource {
protected Color borderColor; protected final Color borderColor;
protected Color background; protected final Color background;
public DarkTableHeaderCorner() { public DarkTableHeaderCorner() {
background = UIManager.getColor("TableHeader.background"); background = UIManager.getColor("TableHeader.background");

3
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

@ -434,7 +434,8 @@ public class DarkTableUI extends DarkTableUIBridge implements FocusListener {
} }
if (table == null) return false; if (table == null) return false;
KeyStroke stroke = KeyStroke.getKeyStroke(event.getExtendedKeyCode(), event.getModifiersEx()); KeyStroke stroke = KeyStroke.getKeyStroke(event.getExtendedKeyCode(), event.getModifiersEx());
String actionName = String.valueOf(table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(stroke)); String actionName = String.valueOf(
table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(stroke));
if ("null".equals(actionName)) actionName = null; if ("null".equals(actionName)) actionName = null;
String cutActionName = String.valueOf(TransferHandler.getCutAction().getValue(Action.NAME)); String cutActionName = String.valueOf(TransferHandler.getCutAction().getValue(Action.NAME));
String copyActionName = String.valueOf(TransferHandler.getCopyAction().getValue(Action.NAME)); String copyActionName = String.valueOf(TransferHandler.getCopyAction().getValue(Action.NAME));

12
core/src/main/java/com/github/weisj/darklaf/ui/table/TableUIBridge.java

@ -1014,7 +1014,8 @@ public abstract class TableUIBridge extends TableUI {
* @param draggedColumn the dragged column * @param draggedColumn the dragged column
* @param distance the distance * @param distance the distance
*/ */
protected void paintDraggedArea(final Graphics g, final int rMin, final int rMax, final TableColumn draggedColumn, final int distance) { protected void paintDraggedArea(final Graphics g, final int rMin, final int rMax, final TableColumn draggedColumn,
final int distance) {
int draggedColumnIndex = viewIndexForColumn(draggedColumn); int draggedColumnIndex = viewIndexForColumn(draggedColumn);
Rectangle minCell = table.getCellRect(rMin, draggedColumnIndex, true); Rectangle minCell = table.getCellRect(rMin, draggedColumnIndex, true);
@ -1546,7 +1547,8 @@ public abstract class TableUIBridge extends TableUI {
if (Objects.equals(key, NEXT_ROW_CHANGE_LEAD) || Objects.equals(key, PREVIOUS_ROW_CHANGE_LEAD)) { if (Objects.equals(key, NEXT_ROW_CHANGE_LEAD) || Objects.equals(key, PREVIOUS_ROW_CHANGE_LEAD)) {
changeLead = (rsm.getSelectionMode() changeLead = (rsm.getSelectionMode()
== ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); == ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
} else if (Objects.equals(key, NEXT_COLUMN_CHANGE_LEAD) || Objects.equals(key, PREVIOUS_COLUMN_CHANGE_LEAD)) { } else if (Objects.equals(key, NEXT_COLUMN_CHANGE_LEAD) || Objects.equals(key,
PREVIOUS_COLUMN_CHANGE_LEAD)) {
changeLead = (csm.getSelectionMode() changeLead = (csm.getSelectionMode()
== ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); == ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
} }
@ -1990,10 +1992,10 @@ public abstract class TableUIBridge extends TableUI {
htmlStr.append("<html>\n<body>\n<table>\n"); htmlStr.append("<html>\n<body>\n<table>\n");
for (int row = 0; row < rows.length; row++) { for (int value : rows) {
htmlStr.append("<tr>\n"); htmlStr.append("<tr>\n");
for (int col = 0; col < cols.length; col++) { for (int i : cols) {
Object obj = table.getValueAt(rows[row], cols[col]); Object obj = table.getValueAt(value, i);
String val = ((obj == null) ? "" : obj.toString()); String val = ((obj == null) ? "" : obj.toString());
plainStr.append(val).append('\t'); plainStr.append(val).append('\t');
htmlStr.append(" <td>").append(val).append("</td>\n"); htmlStr.append(" <td>").append(val).append("</td>\n");

2
core/src/main/java/com/github/weisj/darklaf/ui/table/TextTableCellEditorBorder.java

@ -34,7 +34,7 @@ import java.awt.*;
*/ */
public class TextTableCellEditorBorder extends DarkTableCellBorder { public class TextTableCellEditorBorder extends DarkTableCellBorder {
protected Color borderColor; protected final Color borderColor;
public TextTableCellEditorBorder() { public TextTableCellEditorBorder() {
borderColor = UIManager.getColor("TextField.border.enabled"); borderColor = UIManager.getColor("TextField.border.enabled");

4
core/src/main/java/com/github/weisj/darklaf/ui/taskpane/DarkTaskPaneUI.java

@ -95,8 +95,8 @@ public class DarkTaskPaneUI extends MetalTaskPaneUI {
} }
protected static class DarkContentPaneBorder implements Border, UIResource { protected static class DarkContentPaneBorder implements Border, UIResource {
protected Color color; protected final Color color;
protected int arc; protected final int arc;
public DarkContentPaneBorder(final Color color, final int arc) { public DarkContentPaneBorder(final Color color, final int arc) {

4
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextAreaUI.java

@ -317,7 +317,9 @@ public class DarkTextAreaUI extends DarkTextUI {
} }
public float getPreferredSpan(final int axis) { public float getPreferredSpan(final int axis) {
if (getViewCount() != 1) { throw new Error("One child view is assumed."); } if (getViewCount() != 1) {
throw new Error("One child view is assumed.");
}
View v = getView(0); View v = getView(0);
return v.getPreferredSpan(axis); return v.getPreferredSpan(axis);

24
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextBorder.java

@ -41,19 +41,19 @@ import java.awt.*;
public class DarkTextBorder implements Border, UIResource { public class DarkTextBorder implements Border, UIResource {
private static final Border editorBorder = new TextTableCellEditorBorder(); private static final Border editorBorder = new TextTableCellEditorBorder();
protected Color errorBorderColor; protected final Color errorBorderColor;
protected Color focusErrorBorderColor; protected final Color focusErrorBorderColor;
protected Color focusBorderColor; protected final Color focusBorderColor;
protected Color borderColor; protected final Color borderColor;
protected Color inactiveBorderColor; protected final Color inactiveBorderColor;
protected int borderSize; protected final int borderSize;
protected int arc; protected final int arc;
protected int searchArc; protected final int searchArc;
protected int focusArc; protected final int focusArc;
protected int searchFocusArc; protected final int searchFocusArc;
protected Insets padding; protected Insets padding;
protected Icon showIcon; protected final Icon showIcon;
public DarkTextBorder() { public DarkTextBorder() {
focusErrorBorderColor = UIManager.getColor("TextField.border.focusError"); focusErrorBorderColor = UIManager.getColor("TextField.border.focusError");

12
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUIBridge.java

@ -28,17 +28,7 @@ import com.github.weisj.darklaf.ui.html.DarkHTML;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.plaf.basic.BasicTextFieldUI; import javax.swing.plaf.basic.BasicTextFieldUI;
import javax.swing.text.AbstractDocument; import javax.swing.text.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.FieldView;
import javax.swing.text.GlyphView;
import javax.swing.text.JTextComponent;
import javax.swing.text.ParagraphView;
import javax.swing.text.Position;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import java.awt.*; import java.awt.*;
/** /**

14
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

@ -94,7 +94,8 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
// OpenJDK BorderlessTextField has a bug with its setBorder implementation // OpenJDK BorderlessTextField has a bug with its setBorder implementation
// so we reset the border // so we reset the border
// See https://mail.openjdk.java.net/pipermail/swing-dev/2020-March/010226.html // See https://mail.openjdk.java.net/pipermail/swing-dev/2020-March/010226.html
if (editor != null && "javax.swing.plaf.basic.BasicComboBoxEditor$BorderlessTextField".equals(editor.getClass().getName())) { if (editor != null && "javax.swing.plaf.basic.BasicComboBoxEditor$BorderlessTextField".equals(
editor.getClass().getName())) {
editor.setBorder(null); editor.setBorder(null);
} }
editor.putClientProperty(KEY_ROUNDED_SELECTION, UIManager.getBoolean("TextComponent.roundedSelection")); editor.putClientProperty(KEY_ROUNDED_SELECTION, UIManager.getBoolean("TextComponent.roundedSelection"));
@ -317,7 +318,8 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
km.clear(); km.clear();
if (accelerator != '\0') { if (accelerator != '\0') {
km.put(KeyStroke.getKeyStroke(accelerator, getFocusAcceleratorKeyMask()), "requestFocus"); km.put(KeyStroke.getKeyStroke(accelerator, getFocusAcceleratorKeyMask()), "requestFocus");
km.put(KeyStroke.getKeyStroke(accelerator, DarkSwingUtil.setAltGraphMask(getFocusAcceleratorKeyMask())), km.put(KeyStroke
.getKeyStroke(accelerator, DarkSwingUtil.setAltGraphMask(getFocusAcceleratorKeyMask())),
"requestFocus"); "requestFocus");
} }
} }
@ -363,8 +365,10 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
*/ */
EditorKit editorKit = getEditorKit(editor); EditorKit editorKit = getEditorKit(editor);
if (editorKit instanceof DefaultEditorKit) { if (editorKit instanceof DefaultEditorKit) {
Set<AWTKeyStroke> storedForwardTraversalKeys = editor.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS); Set<AWTKeyStroke> storedForwardTraversalKeys = editor.getFocusTraversalKeys(
Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS); KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.getFocusTraversalKeys(
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> forwardTraversalKeys = new HashSet<>(storedForwardTraversalKeys); Set<AWTKeyStroke> forwardTraversalKeys = new HashSet<>(storedForwardTraversalKeys);
Set<AWTKeyStroke> backwardTraversalKeys = new HashSet<>(storedBackwardTraversalKeys); Set<AWTKeyStroke> backwardTraversalKeys = new HashSet<>(storedBackwardTraversalKeys);
if (editor.isEditable()) { if (editor.isEditable()) {
@ -394,7 +398,7 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
* Wrapper for text actions to return isEnabled false in case editor is non editable * Wrapper for text actions to return isEnabled false in case editor is non editable
*/ */
public class TextActionWrapper extends TextAction { public class TextActionWrapper extends TextAction {
TextAction action; final TextAction action;
public TextActionWrapper(final TextAction action) { public TextActionWrapper(final TextAction action) {
super((String) action.getValue(Action.NAME)); super((String) action.getValue(Action.NAME));

8
core/src/main/java/com/github/weisj/darklaf/ui/text/SelectLineAction.java

@ -24,13 +24,7 @@
package com.github.weisj.darklaf.ui.text; package com.github.weisj.darklaf.ui.text;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.BadLocationException; import javax.swing.text.*;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
import javax.swing.text.Segment;
import javax.swing.text.TextAction;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
/** /**

6
core/src/main/java/com/github/weisj/darklaf/ui/text/SelectWordAction.java

@ -24,11 +24,7 @@
package com.github.weisj.darklaf.ui.text; package com.github.weisj.darklaf.ui.text;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.BadLocationException; import javax.swing.text.*;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.JTextComponent;
import javax.swing.text.TextAction;
import javax.swing.text.Utilities;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
/** /**

3
core/src/main/java/com/github/weisj/darklaf/ui/titledborder/DarkTitledBorder.java

@ -39,7 +39,8 @@ public class DarkTitledBorder extends MutableLineBorder implements UIResource {
} }
@Override @Override
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) { public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width,
final int height) {
checkInsets(c); checkInsets(c);
super.paintBorder(c, g, x, y, width, height); super.paintBorder(c, g, x, y, width, height);
} }

12
core/src/main/java/com/github/weisj/darklaf/ui/togglebutton/ButtonGroupInfo.java

@ -29,7 +29,7 @@ import java.util.Enumeration;
import java.util.HashSet; import java.util.HashSet;
public class ButtonGroupInfo { public class ButtonGroupInfo {
protected AbstractButton activeButton; protected final AbstractButton activeButton;
protected AbstractButton firstButton = null; protected AbstractButton firstButton = null;
protected AbstractButton lastButton = null; protected AbstractButton lastButton = null;
@ -37,7 +37,7 @@ public class ButtonGroupInfo {
protected AbstractButton previousButton = null; protected AbstractButton previousButton = null;
protected AbstractButton nextButton = null; protected AbstractButton nextButton = null;
protected HashSet<AbstractButton> buttonsInGroup; protected final HashSet<AbstractButton> buttonsInGroup;
protected boolean sourceFound = false; protected boolean sourceFound = false;
public ButtonGroupInfo(final AbstractButton btn) { public ButtonGroupInfo(final AbstractButton btn) {
@ -120,8 +120,7 @@ public class ButtonGroupInfo {
} }
/** /**
* Find the new radio button that focus needs to be * Find the new radio button that focus needs to be moved to in the group, select the button
* moved to in the group, select the button
* *
* @param next, indicate if it's arrow up/left or down/right * @param next, indicate if it's arrow up/left or down/right
*/ */
@ -149,9 +148,8 @@ public class ButtonGroupInfo {
} }
/** /**
* Find the button group the passed in AbstractButton belongs to, and * Find the button group the passed in AbstractButton belongs to, and move focus to next component of the last
* move focus to next component of the last button in the group * button in the group or previous component of first button
* or previous component of first button
* *
* @param next, indicate if jump to next component or previous * @param next, indicate if jump to next component or previous
*/ */

6
core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarBorder.java

@ -34,9 +34,9 @@ import java.awt.*;
*/ */
public class DarkToolBarBorder extends AbstractBorder implements UIResource, SwingConstants { public class DarkToolBarBorder extends AbstractBorder implements UIResource, SwingConstants {
protected Icon horizontalGrip; protected final Icon horizontalGrip;
protected Icon verticalGrip; protected final Icon verticalGrip;
protected Color borderColor; protected final Color borderColor;
public DarkToolBarBorder() { public DarkToolBarBorder() {
horizontalGrip = UIManager.getIcon("ToolBar.horizontalGrip.icon"); horizontalGrip = UIManager.getIcon("ToolBar.horizontalGrip.icon");

20
core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarUI.java

@ -46,7 +46,7 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
protected Color background; protected Color background;
private Dimension verticalDim = new Dimension(0, 0); private Dimension verticalDim = new Dimension(0, 0);
private Dimension horizontalDim = new Dimension(0, 0); private Dimension horizontalDim = new Dimension(0, 0);
private Timer timer = new Timer(5, e -> dragTo()); private final Timer timer = new Timer(5, e -> dragTo());
public static ComponentUI createUI(final JComponent c) { public static ComponentUI createUI(final JComponent c) {
@ -84,11 +84,6 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
} }
} }
@Override
protected void uninstallListeners() {
super.uninstallListeners();
}
@Override @Override
public void setFloating(final boolean b, final Point p) { public void setFloating(final boolean b, final Point p) {
if (toolBar.isFloatable()) { if (toolBar.isFloatable()) {
@ -151,11 +146,6 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
background = UIManager.getColor("ToolBar.background"); background = UIManager.getColor("ToolBar.background");
} }
@Override
protected void installListeners() {
super.installListeners();
}
protected void setBorderToNonRollover(final Component c) { protected void setBorderToNonRollover(final Component c) {
} }
@ -171,7 +161,9 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
frame = (Window) p; frame = (Window) p;
} }
} }
if (floatingToolBar instanceof Window) { frame = (Window) floatingToolBar; } if (floatingToolBar instanceof Window) {
frame = (Window) floatingToolBar;
}
return new DarkDragWindow(frame); return new DarkDragWindow(frame);
} }
@ -249,7 +241,9 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
protected void updateDockingSource() { protected void updateDockingSource() {
dockingSource.invalidate(); dockingSource.invalidate();
Container dockingSourceParent = dockingSource.getParent(); Container dockingSourceParent = dockingSource.getParent();
if (dockingSourceParent != null) { dockingSourceParent.validate(); } if (dockingSourceParent != null) {
dockingSourceParent.validate();
}
dockingSource.repaint(); dockingSource.repaint();
} }

64
core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DarkToolBarUIBridge.java

@ -54,11 +54,11 @@ import java.util.Objects;
*/ */
public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingConstants { public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingConstants {
// Rollover button implementation. // Rollover button implementation.
protected static String IS_ROLLOVER = "JToolBar.isRollover"; protected static final String IS_ROLLOVER = "JToolBar.isRollover";
protected static Border rolloverBorder; protected static Border rolloverBorder;
protected static Border nonRolloverBorder; protected static Border nonRolloverBorder;
protected static Border nonRolloverToggleBorder; protected static Border nonRolloverToggleBorder;
protected static String FOCUSED_COMP_INDEX = "JToolBar.focusedCompIndex"; protected static final String FOCUSED_COMP_INDEX = "JToolBar.focusedCompIndex";
/** /**
* The instance of {@code JToolBar}. * The instance of {@code JToolBar}.
*/ */
@ -115,8 +115,8 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
*/ */
protected String constraintBeforeFloating = BorderLayout.NORTH; protected String constraintBeforeFloating = BorderLayout.NORTH;
protected boolean rolloverBorders = false; protected boolean rolloverBorders = false;
protected HashMap<AbstractButton, Border> borderTable = new HashMap<>(); protected final HashMap<AbstractButton, Border> borderTable = new HashMap<>();
protected Hashtable<AbstractButton, Boolean> rolloverTable = new Hashtable<>(); protected final Hashtable<AbstractButton, Boolean> rolloverTable = new Hashtable<>();
/** /**
* As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by * As of Java 2 platform v1.3 this previously undocumented field is no longer used. Key bindings are now defined by
* the LookAndFeel, please refer to the key bindings specification for further details. * the LookAndFeel, please refer to the key bindings specification for further details.
@ -189,7 +189,9 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
uninstallKeyboardActions(); uninstallKeyboardActions();
// Clear instance vars // Clear instance vars
if (isFloating()) { setFloating(false, null); } if (isFloating()) {
setFloating(false, null);
}
floatingToolBar = null; floatingToolBar = null;
dragWindow = null; dragWindow = null;
@ -421,7 +423,9 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
public void setOrientation(final int orientation) { public void setOrientation(final int orientation) {
toolBar.setOrientation(orientation); toolBar.setOrientation(orientation);
if (dragWindow != null) { dragWindow.setOrientation(orientation); } if (dragWindow != null) {
dragWindow.setOrientation(orientation);
}
} }
/** /**
@ -703,10 +707,14 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
switch (direction) { switch (direction) {
case EAST: case EAST:
case SOUTH: case SOUTH:
if (focusedCompIndex < 0 || focusedCompIndex >= nComp) { break; } if (focusedCompIndex < 0 || focusedCompIndex >= nComp) {
break;
}
j = focusedCompIndex + 1; j = focusedCompIndex + 1;
while (j != focusedCompIndex) { while (j != focusedCompIndex) {
if (j >= nComp) { j = 0; } if (j >= nComp) {
j = 0;
}
Component comp = toolBar.getComponentAtIndex(j++); Component comp = toolBar.getComponentAtIndex(j++);
if (comp != null && comp.isFocusTraversable() && comp.isEnabled()) { if (comp != null && comp.isFocusTraversable() && comp.isEnabled()) {
comp.requestFocus(); comp.requestFocus();
@ -716,10 +724,14 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
break; break;
case WEST: case WEST:
case NORTH: case NORTH:
if (focusedCompIndex < 0 || focusedCompIndex >= nComp) { break; } if (focusedCompIndex < 0 || focusedCompIndex >= nComp) {
break;
}
j = focusedCompIndex - 1; j = focusedCompIndex - 1;
while (j != focusedCompIndex) { while (j != focusedCompIndex) {
if (j < 0) { j = nComp - 1; } if (j < 0) {
j = nComp - 1;
}
Component comp = toolBar.getComponentAtIndex(j--); Component comp = toolBar.getComponentAtIndex(j--);
if (comp != null && comp.isFocusTraversable() && comp.isEnabled()) { if (comp != null && comp.isFocusTraversable() && comp.isEnabled()) {
@ -1073,10 +1085,16 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
protected class FrameListener extends WindowAdapter { protected class FrameListener extends WindowAdapter {
public void windowClosing(final WindowEvent w) { public void windowClosing(final WindowEvent w) {
if (toolBar.isFloatable()) { if (toolBar.isFloatable()) {
if (dragWindow != null) { dragWindow.setVisible(false); } if (dragWindow != null) {
dragWindow.setVisible(false);
}
floating = false; floating = false;
if (floatingToolBar == null) { floatingToolBar = createFloatingWindow(toolBar); } if (floatingToolBar == null) {
if (floatingToolBar instanceof Window) { ((Window) floatingToolBar).setVisible(false); } floatingToolBar = createFloatingWindow(toolBar);
}
if (floatingToolBar instanceof Window) {
((Window) floatingToolBar).setVisible(false);
}
floatingToolBar.getContentPane().remove(toolBar); floatingToolBar.getContentPane().remove(toolBar);
String constraint = constraintBeforeFloating; String constraint = constraintBeforeFloating;
if (toolBar.getOrientation() == JToolBar.HORIZONTAL) { if (toolBar.getOrientation() == JToolBar.HORIZONTAL) {
@ -1088,12 +1106,18 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
constraint = "West"; constraint = "West";
} }
} }
if (dockingSource == null) { dockingSource = toolBar.getParent(); } if (dockingSource == null) {
if (propertyListener != null) { UIManager.removePropertyChangeListener(propertyListener); } dockingSource = toolBar.getParent();
}
if (propertyListener != null) {
UIManager.removePropertyChangeListener(propertyListener);
}
dockingSource.add(toolBar, constraint); dockingSource.add(toolBar, constraint);
dockingSource.invalidate(); dockingSource.invalidate();
Container dockingSourceParent = dockingSource.getParent(); Container dockingSourceParent = dockingSource.getParent();
if (dockingSourceParent != null) { dockingSourceParent.validate(); } if (dockingSourceParent != null) {
dockingSourceParent.validate();
}
dockingSource.repaint(); dockingSource.repaint();
} }
} }
@ -1120,7 +1144,9 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
*/ */
public void setOrientation(final int o) { public void setOrientation(final int o) {
if (isShowing()) { if (isShowing()) {
if (o == this.orientation) { return; } if (o == this.orientation) {
return;
}
this.orientation = o; this.orientation = o;
Dimension size = getSize(); Dimension size = getSize();
setSize(new Dimension(size.height, size.width)); setSize(new Dimension(size.height, size.width));
@ -1170,7 +1196,9 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
* @param c the new border color * @param c the new border color
*/ */
public void setBorderColor(final Color c) { public void setBorderColor(final Color c) {
if (this.borderColor == c) { return; } if (this.borderColor == c) {
return;
}
this.borderColor = c; this.borderColor = c;
repaint(); repaint();
} }

14
core/src/main/java/com/github/weisj/darklaf/ui/toolbar/DropPreviewPanel.java

@ -32,7 +32,7 @@ import java.awt.*;
public class DropPreviewPanel extends JComponent { public class DropPreviewPanel extends JComponent {
private JToolBar toolBar; private JToolBar toolBar;
private Color dropBackground; private final Color dropBackground;
public DropPreviewPanel() { public DropPreviewPanel() {
dropBackground = UIManager.getColor("ToolBar.dropColor"); dropBackground = UIManager.getColor("ToolBar.dropColor");
@ -62,19 +62,25 @@ public class DropPreviewPanel extends JComponent {
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
if (toolBar != null) { return toolBar.getPreferredSize(); } if (toolBar != null) {
return toolBar.getPreferredSize();
}
return super.getPreferredSize(); return super.getPreferredSize();
} }
@Override @Override
public Dimension getMaximumSize() { public Dimension getMaximumSize() {
if (toolBar != null) { return toolBar.getMaximumSize(); } if (toolBar != null) {
return toolBar.getMaximumSize();
}
return super.getMinimumSize(); return super.getMinimumSize();
} }
@Override @Override
public Dimension getMinimumSize() { public Dimension getMinimumSize() {
if (toolBar != null) { return toolBar.getMinimumSize(); } if (toolBar != null) {
return toolBar.getMinimumSize();
}
return super.getMinimumSize(); return super.getMinimumSize();
} }
} }

6
core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipUI.java

@ -52,7 +52,7 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe
protected JRootPane lastRootPane; protected JRootPane lastRootPane;
protected ToolTipStyle style; protected ToolTipStyle style;
protected boolean isTipTextChanging; protected boolean isTipTextChanging;
protected MouseListener exitListener = new MouseAdapter() { protected final MouseListener exitListener = new MouseAdapter() {
@Override @Override
public void mouseExited(final MouseEvent e) { public void mouseExited(final MouseEvent e) {
boolean inside = isInside(e); boolean inside = isInside(e);
@ -64,7 +64,7 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe
} }
} }
}; };
protected MouseListener mouseListener = new MouseAdapter() { protected final MouseListener mouseListener = new MouseAdapter() {
@Override @Override
public void mouseEntered(final MouseEvent e) { public void mouseEntered(final MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) return; if (e.getButton() == MouseEvent.BUTTON1) return;
@ -90,7 +90,7 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe
exitListener.mouseExited(e); exitListener.mouseExited(e);
} }
}; };
protected PropertyChangeListener componentPropertyChaneListener = e -> { protected final PropertyChangeListener componentPropertyChaneListener = e -> {
if (KEY_STYLE.equals(e.getPropertyName())) { if (KEY_STYLE.equals(e.getPropertyName())) {
updateStyle(); updateStyle();
} }

12
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkDefaultTreeEditor.java

@ -98,16 +98,6 @@ public class DarkDefaultTreeEditor extends DefaultTreeCellEditor {
&& DarkTreeCellRenderer.unwrapBooleanIfPossible(path.getLastPathComponent()) instanceof Boolean; && DarkTreeCellRenderer.unwrapBooleanIfPossible(path.getLastPathComponent()) instanceof Boolean;
} }
@Override
public Object getCellEditorValue() {
return super.getCellEditorValue();
}
@Override
public boolean stopCellEditing() {
return super.stopCellEditing();
}
@Override @Override
protected boolean canEditImmediately(final EventObject event) { protected boolean canEditImmediately(final EventObject event) {
if (event != null && event.getSource() instanceof JTree) { if (event != null && event.getSource() instanceof JTree) {
@ -120,7 +110,7 @@ public class DarkDefaultTreeEditor extends DefaultTreeCellEditor {
Rectangle bounds = tree.getRowBounds(row); Rectangle bounds = tree.getRowBounds(row);
if (bounds != null) { if (bounds != null) {
DarkTreeCellRenderer rend = (DarkTreeCellRenderer) renderer; DarkTreeCellRenderer rend = (DarkTreeCellRenderer) renderer;
DarkCellRendererToggleButton booleanRend = rend.getBooleanRenderer(tree); DarkCellRendererToggleButton<?> booleanRend = rend.getBooleanRenderer(tree);
JToggleButton button = booleanRend.getButton(); JToggleButton button = booleanRend.getButton();
p.x -= bounds.x + button.getX(); p.x -= bounds.x + button.getX();

2
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellBorder.java

@ -36,7 +36,7 @@ import java.awt.*;
*/ */
public class DarkTreeCellBorder implements Border, UIResource { public class DarkTreeCellBorder implements Border, UIResource {
protected Color borderColor; protected final Color borderColor;
protected Insets insets; protected Insets insets;
public DarkTreeCellBorder() { public DarkTreeCellBorder() {

4
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeCellRenderer.java

@ -41,7 +41,7 @@ public class DarkTreeCellRenderer extends DefaultTreeCellRenderer implements Tre
new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorCheckBox(false)); new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorCheckBox(false));
private final DarkCellRendererToggleButton<DarkCellRendererToggleButton.CellEditorRadioButton> radioRenderer = private final DarkCellRendererToggleButton<DarkCellRendererToggleButton.CellEditorRadioButton> radioRenderer =
new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorRadioButton(false)); new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorRadioButton(false));
private TreeRendererComponent rendererComponent = new TreeRendererComponent(); private final TreeRendererComponent rendererComponent = new TreeRendererComponent();
@Override @Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel,
@ -83,7 +83,7 @@ public class DarkTreeCellRenderer extends DefaultTreeCellRenderer implements Tre
return Boolean.TRUE.equals(tree.getClientProperty(DarkTreeUI.KEY_RENDER_BOOLEAN_AS_CHECKBOX)); return Boolean.TRUE.equals(tree.getClientProperty(DarkTreeUI.KEY_RENDER_BOOLEAN_AS_CHECKBOX));
} }
protected DarkCellRendererToggleButton getBooleanRenderer(final JTree table) { protected DarkCellRendererToggleButton<?> getBooleanRenderer(final JTree table) {
if (DarkTreeUI.RENDER_TYPE_RADIOBUTTON.equals(table.getClientProperty(DarkTreeUI.KEY_BOOLEAN_RENDER_TYPE))) { if (DarkTreeUI.RENDER_TYPE_RADIOBUTTON.equals(table.getClientProperty(DarkTreeUI.KEY_BOOLEAN_RENDER_TYPE))) {
return radioRenderer; return radioRenderer;
} }

24
core/src/main/java/com/github/weisj/darklaf/ui/tree/DarkTreeUI.java

@ -236,7 +236,8 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
TreePath selectionPath = tree.getPathForRow(selectionRow); TreePath selectionPath = tree.getPathForRow(selectionRow);
if (selectionPath == null) return; if (selectionPath == null) return;
if (tree.getModel().isLeaf(selectionPath.getLastPathComponent()) || tree.isCollapsed(selectionRow)) { if (tree.getModel().isLeaf(selectionPath.getLastPathComponent()) || tree.isCollapsed(
selectionRow)) {
final TreePath parentPath = tree.getPathForRow(selectionRow).getParentPath(); final TreePath parentPath = tree.getPathForRow(selectionRow).getParentPath();
if (parentPath != null) { if (parentPath != null) {
if (parentPath.getParentPath() != null || tree.isRootVisible()) { if (parentPath.getParentPath() != null || tree.isRootVisible()) {
@ -339,9 +340,11 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
} }
boolean treeEditor = owner instanceof JComponent boolean treeEditor = owner instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) owner).getClientProperty(DarkToggleButtonUI.KEY_IS_TREE_EDITOR)); && Boolean.TRUE.equals(
((JComponent) owner).getClientProperty(DarkToggleButtonUI.KEY_IS_TREE_EDITOR));
boolean treeRenderer = owner instanceof JComponent boolean treeRenderer = owner instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) owner).getClientProperty(DarkToggleButtonUI.KEY_IS_TREE_RENDER)); && Boolean.TRUE.equals(
((JComponent) owner).getClientProperty(DarkToggleButtonUI.KEY_IS_TREE_RENDER));
return treeEditor || treeRenderer; return treeEditor || treeRenderer;
} }
return true; return true;
@ -437,7 +440,9 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
path = (TreePath) paintingEnumerator.nextElement(); path = (TreePath) paintingEnumerator.nextElement();
if (path != null) { if (path != null) {
isLeaf = treeModel.isLeaf(path.getLastPathComponent()); isLeaf = treeModel.isLeaf(path.getLastPathComponent());
if (isLeaf) { isExpanded = hasBeenExpanded = false; } else { if (isLeaf) {
isExpanded = hasBeenExpanded = false;
} else {
isExpanded = treeState.getExpandedState(path); isExpanded = treeState.getExpandedState(path);
hasBeenExpanded = tree.hasBeenExpanded(path); hasBeenExpanded = tree.hasBeenExpanded(path);
} }
@ -447,7 +452,9 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
// from under us (usually in another thread). // from under us (usually in another thread).
// Swing isn't multithreaded, but I'll put this // Swing isn't multithreaded, but I'll put this
// check in anyway. // check in anyway.
{ return; } {
return;
}
// See if the vertical line to the parent has been drawn. // See if the vertical line to the parent has been drawn.
parentPath = path.getParentPath(); parentPath = path.getParentPath();
@ -467,7 +474,9 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
hasBeenExpanded, isLeaf); hasBeenExpanded, isLeaf);
} }
paintRow(g, paintBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); paintRow(g, paintBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf);
if ((bounds.y + bounds.height) >= endY) { done = true; } if ((bounds.y + bounds.height) >= endY) {
done = true;
}
} else { } else {
done = true; done = true;
} }
@ -666,7 +675,8 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
} }
//Descend to deepest last child. //Descend to deepest last child.
TreePath lastChildPath = path.pathByAddingChild(treeModel.getChild(path.getLastPathComponent(), childCount - 1)); TreePath lastChildPath = path.pathByAddingChild(
treeModel.getChild(path.getLastPathComponent(), childCount - 1));
while (tree.isExpanded(lastChildPath)) { while (tree.isExpanded(lastChildPath)) {
int count = treeModel.getChildCount(lastChildPath.getLastPathComponent()); int count = treeModel.getChildCount(lastChildPath.getLastPathComponent());
lastChildPath = lastChildPath.pathByAddingChild(treeModel.getChild(lastChildPath.getLastPathComponent(), lastChildPath = lastChildPath.pathByAddingChild(treeModel.getChild(lastChildPath.getLastPathComponent(),

5
core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java

@ -52,7 +52,8 @@ public final class DarkUIUtil {
public final static AlphaComposite GLOW_ALPHA = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f); public final static AlphaComposite GLOW_ALPHA = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f);
public final static AlphaComposite DROP_ALPHA = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f); public final static AlphaComposite DROP_ALPHA = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
public final static AlphaComposite SHADOW_COMPOSITE = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f); public final static AlphaComposite SHADOW_COMPOSITE = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.1f);
public static final boolean USE_QUARTZ = PropertyValue.TRUE.equals(System.getProperty("apple.awt.graphics.UseQuartz")); public static final boolean USE_QUARTZ = PropertyValue.TRUE.equals(
System.getProperty("apple.awt.graphics.UseQuartz"));
private static final Rectangle iconRect = new Rectangle(); private static final Rectangle iconRect = new Rectangle();
private static final Rectangle textRect = new Rectangle(); private static final Rectangle textRect = new Rectangle();
@ -332,7 +333,7 @@ public final class DarkUIUtil {
g.fillRect(x, y + height - thickness, width, thickness); g.fillRect(x, y + height - thickness, width, thickness);
} }
public static boolean isOverText(final MouseEvent e, final int index, final JList list) { public static boolean isOverText(final MouseEvent e, final int index, final JList<?> list) {
Rectangle bounds = list.getCellBounds(index, index); Rectangle bounds = list.getCellBounds(index, index);
if (!bounds.contains(e.getPoint())) return false; if (!bounds.contains(e.getPoint())) return false;
//noinspection unchecked //noinspection unchecked

4
core/src/main/java/com/github/weisj/darklaf/util/SwingXUtilities.java

@ -33,12 +33,12 @@ import java.awt.geom.AffineTransform;
public class SwingXUtilities { public class SwingXUtilities {
@SuppressWarnings("unchecked")
public static Point convertPointToParent(final Component source, final Point p) { public static Point convertPointToParent(final Component source, final Point p) {
JXLayer layer = DarkUIUtil.getParentOfType(JXLayer.class, source); JXLayer<? extends JComponent> layer = DarkUIUtil.getParentOfType(JXLayer.class, source);
if (layer != null && layer.getUI() instanceof TransformUI) { if (layer != null && layer.getUI() instanceof TransformUI) {
TransformUI ui = (TransformUI) layer.getUI(); TransformUI ui = (TransformUI) layer.getUI();
Point pos = SwingUtilities.convertPoint(source, p, layer); Point pos = SwingUtilities.convertPoint(source, p, layer);
//noinspection unchecked
AffineTransform transform = ui.getPreferredTransform(layer.getSize(), layer); AffineTransform transform = ui.getPreferredTransform(layer.getSize(), layer);
transform.transform(pos, pos); transform.transform(pos, pos);
return pos; return pos;

10
core/src/main/java/javax/swing/text/DefaultHighlighterDark/DarkHighlightPainter.java

@ -50,14 +50,14 @@ public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPai
private static final boolean DEBUG_COLOR = false; private static final boolean DEBUG_COLOR = false;
private Paint paint; private Paint paint;
private Color color; private Color color;
private ColorWrapper wrapper; private final ColorWrapper wrapper;
private boolean roundedEdges; private boolean roundedEdges;
private AlphaComposite alphaComposite; private AlphaComposite alphaComposite;
private float alpha; private float alpha;
private int selectionStart = -1; private int selectionStart = -1;
private int selectionEnd = -1; private int selectionEnd = -1;
private int repaintCount = 0; private int repaintCount = 0;
private int arcSize; private final int arcSize;
private boolean suppressRounded = false; private boolean suppressRounded = false;
private boolean enabled; private boolean enabled;
@ -402,7 +402,8 @@ public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPai
boolean roundLeftBottom = !isFirstLine && !extendToStart; boolean roundLeftBottom = !isFirstLine && !extendToStart;
boolean roundLeftTop = isSecondLine && !extendToStart && posStart.x >= r.x + arcSize; boolean roundLeftTop = isSecondLine && !extendToStart && posStart.x >= r.x + arcSize;
paintRoundRect(g2d, r, arcSize, roundLeftTop, roundRightTop, roundLeftBottom, !extendToEnd); paintRoundRect(g2d, r, arcSize, roundLeftTop, roundRightTop, roundLeftBottom, !extendToEnd);
boolean drawCorner = !extendToEnd && !roundRightTop && r.x + r.width <= c.getWidth() - margin.right - arcSize; boolean drawCorner = !extendToEnd && !roundRightTop
&& r.x + r.width <= c.getWidth() - margin.right - arcSize;
if (drawCorner) { if (drawCorner) {
paintEndArc(g2d, r); paintEndArc(g2d, r);
r.width += arcSize; r.width += arcSize;
@ -435,7 +436,8 @@ public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPai
start = Math.min(start, c.getWidth() - ins.right - w); start = Math.min(start, c.getWidth() - ins.right - w);
if (rounded) { if (rounded) {
boolean roundTop = isFirstLine || selectionStart; boolean roundTop = isFirstLine || selectionStart;
boolean roundBottom = isLastLine || (isSecondLastLine && posEnd.x + posEnd.width <= start + w - arcSize); boolean roundBottom = isLastLine || (isSecondLastLine
&& posEnd.x + posEnd.width <= start + w - arcSize);
boolean roundLeftTop = isFirstLine && start == ins.left; boolean roundLeftTop = isFirstLine && start == ins.left;
paintRoundRect(g2d, new Rectangle(start, r.y, w, r.height), arcSize, paintRoundRect(g2d, new Rectangle(start, r.y, w, r.height), arcSize,
roundLeftTop, roundTop, false, roundBottom); roundLeftTop, roundTop, false, roundBottom);

6
core/src/main/java/org/pbjar/jxlayer/plaf/ext/MouseEventUI.java

@ -254,7 +254,8 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> {
} }
private void generateEnterExitEvents(final JXLayer<? extends V> layer, private void generateEnterExitEvents(final JXLayer<? extends V> layer,
final MouseEvent originalEvent, final Component newTarget, final Point realPoint) { final MouseEvent originalEvent, final Component newTarget,
final Point realPoint) {
if (lastEnteredTarget != newTarget) { if (lastEnteredTarget != newTarget) {
dispatchMouseEvent(transformMouseEvent(layer, originalEvent, dispatchMouseEvent(transformMouseEvent(layer, originalEvent,
lastEnteredTarget, realPoint, MouseEvent.MOUSE_EXITED)); lastEnteredTarget, realPoint, MouseEvent.MOUSE_EXITED));
@ -419,7 +420,8 @@ public class MouseEventUI<V extends JComponent> extends AbstractLayerUI<V> {
private MouseEvent transformMouseEvent(final JXLayer<? extends V> layer, private MouseEvent transformMouseEvent(final JXLayer<? extends V> layer,
final MouseEvent mouseEvent, final Component target, final Point targetPoint, final int id) { final MouseEvent mouseEvent, final Component target, final Point targetPoint,
final int id) {
if (target == null) { if (target == null) {
return null; return null;
} else { } else {

13
core/src/main/java/org/pbjar/jxlayer/plaf/ext/TransformUI.java

@ -36,12 +36,7 @@ import org.jdesktop.jxlayer.JXLayer;
import org.jdesktop.jxlayer.plaf.AbstractBufferedLayerUI; import org.jdesktop.jxlayer.plaf.AbstractBufferedLayerUI;
import org.jdesktop.jxlayer.plaf.LayerUI; import org.jdesktop.jxlayer.plaf.LayerUI;
import org.jdesktop.swingx.ForwardingRepaintManager; import org.jdesktop.swingx.ForwardingRepaintManager;
import org.pbjar.jxlayer.plaf.ext.transform.DefaultTransformModel; import org.pbjar.jxlayer.plaf.ext.transform.*;
import org.pbjar.jxlayer.plaf.ext.transform.TransformLayout;
import org.pbjar.jxlayer.plaf.ext.transform.TransformModel;
import org.pbjar.jxlayer.plaf.ext.transform.TransformRPMAnnotation;
import org.pbjar.jxlayer.plaf.ext.transform.TransformRPMFallBack;
import org.pbjar.jxlayer.plaf.ext.transform.TransformRPMSwingX;
import org.pbjar.jxlayer.repaint.RepaintManagerProvider; import org.pbjar.jxlayer.repaint.RepaintManagerProvider;
import org.pbjar.jxlayer.repaint.RepaintManagerUtils; import org.pbjar.jxlayer.repaint.RepaintManagerUtils;
import org.pbjar.jxlayer.repaint.WrappedRepaintManager; import org.pbjar.jxlayer.repaint.WrappedRepaintManager;
@ -56,11 +51,7 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import java.util.HashMap; import java.util.*;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.logging.ConsoleHandler; import java.util.logging.ConsoleHandler;
import java.util.logging.Logger; import java.util.logging.Logger;

2
core/src/main/java/org/pbjar/jxlayer/plaf/ext/transform/TransformRPMImpl.java

@ -59,7 +59,7 @@ public final class TransformRPMImpl {
* *
* @see #hackInitialization(RepaintManager, RepaintManager) * @see #hackInitialization(RepaintManager, RepaintManager)
*/ */
public static boolean hack = false; public static final boolean hack = false;
static { static {
LOGGER.setUseParentHandlers(false); LOGGER.setUseParentHandlers(false);

3
core/src/main/java/org/pbjar/jxlayer/repaint/RepaintManagerUtils.java

@ -128,8 +128,7 @@ public final class RepaintManagerUtils {
private static RepaintManager createManager( private static RepaintManager createManager(
final Class<? extends RepaintManager> clazz, final RepaintManager delegate) { final Class<? extends RepaintManager> clazz, final RepaintManager delegate) {
try { try {
RepaintManager newManager = clazz.getConstructor(RepaintManager.class).newInstance(delegate); return clazz.getConstructor(RepaintManager.class).newInstance(delegate);
return newManager;
} catch (Throwable t) { } catch (Throwable t) {
throw new RuntimeException("Cannot instantiate " + clazz.getName(), t); throw new RuntimeException("Cannot instantiate " + clazz.getName(), t);
} }

1
core/src/main/java/org/pbjar/jxlayer/repaint/WrappedRepaintManager.java

@ -213,7 +213,6 @@ public class WrappedRepaintManager extends RepaintManager {
} }
/** /**
* Just delegates. {@inheritDoc} * Just delegates. {@inheritDoc}
*/ */

2
core/src/test/java/defaults/SampleRenderer.java

@ -12,7 +12,7 @@ import java.awt.*;
*/ */
public class SampleRenderer extends JLabel implements TableCellRenderer { public class SampleRenderer extends JLabel implements TableCellRenderer {
private final DarkCellRendererToggleButton booleanRenderer = private final DarkCellRendererToggleButton<?> booleanRenderer =
new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorCheckBox(true)); new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorCheckBox(true));
public SampleRenderer() { public SampleRenderer() {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save