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) {
Properties overwrites = PropertyLoader.loadProperties(DarkLaf.class, "overwrites", "properties/");
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);
}

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

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

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 java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
@ -47,7 +43,7 @@ public class DefaultColorPipette extends ColorPipetteBase {
private final Rectangle captureRect = new Rectangle();
private final Point previousLocation = new Point();
private final Timer timer;
protected Color borderColor;
protected final Color borderColor;
private Graphics2D zoomGraphics;
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);
}
@SuppressWarnings("unchecked")
@Override
public void show(final Component invoker, final int x, final int y) {
Point p = new Point(x, y);
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) {
TransformUI ui = (TransformUI) layer.getUI();
p = SwingUtilities.convertPoint(invoker, p, layer);
//noinspection unchecked
AffineTransform transform = ui.getPreferredTransform(layer.getSize(), layer);
transform.transform(p, p);
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.
*
* @param color color of border
* @param color color of border.
*/
public BubbleBorder(final Color color) {
this(color, 2, 4, 5);
@ -66,7 +66,7 @@ public class BubbleBorder extends AbstractBorder {
* @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.
* 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,
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 {
private static Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineBorderMap =
private static final Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineBorderMap =
Collections.synchronizedMap(new WeakHashMap<>());
private static Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineWidgetBorderMap =
private static final Map<WeakLineBorder, WeakReference<WeakLineBorder>> lineWidgetBorderMap =
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,
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);
setShadowSize(shadowSize);
setShadowOpacity(shadowOpacity);
@ -210,11 +211,13 @@ public class DropShadowBorder implements Border, Serializable {
}
if (showLeftShadow || showBottomShadow) {
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) {
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) {
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 {
private int left;
private int top;
private int bottom;
private int right;
private final int left;
private final int top;
private final int bottom;
private final int right;
public WeakLineBorder(final int top, final int left, final int bottom, final int right) {
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).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.fillRect(0, r.y, c.getWidth(), r.height);
if (lastView == null) { lastView = r; }
if (lastView == null) {
lastView = r;
}
} catch (BadLocationException ble) {
ble.printStackTrace();
}
@ -99,7 +101,8 @@ public class LineHighlighter implements Highlighter.HighlightPainter, ChangeList
component.repaint(0, lastView.y, component.getWidth(), lastView.height);
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_MIN_ICON_WIDTH = "minimumIconWidth";
private JTextComponent textComponent;
private Map<Position, Icon> iconMap;
private Map<Position, List<IconListener>> listenerMap;
private final Map<Position, Icon> iconMap;
private final Map<Position, List<IconListener>> listenerMap;
private int width;
public NumberingPane() {
@ -83,7 +83,8 @@ public class NumberingPane extends JComponent {
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();
if (atTextStart) {
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 {
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>,

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 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.Map;
import java.util.Set;
import java.util.*;
/**
* @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}.
*
* @see AlignmentStrategy
* @param alignmentStrategy the alignment strategy.
* @return this
* @see AlignmentStrategy
*/
public ToolTipContext setAlignmentStrategy(final AlignmentStrategy alignmentStrategy) {
this.alignmentStrategy = alignmentStrategy;
@ -282,7 +282,8 @@ public class ToolTipContext {
* @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);
}
@ -392,9 +393,9 @@ public class ToolTipContext {
}
/**
* @see #setInsideArea(Area)
* @param insideRect the rectangle to check.
* @return this
* @see #setInsideArea(Area)
*/
public ToolTipContext setInsideArea(final Rectangle 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
* the content rect and not the component bounds.
* Sets whether the border should be ignored when aligning outside. If true the tooltip is aligned w.r.t. to the
* content rect and not the component bounds.
*
* @param ignoreBorder true if border insets should be ignored.
* @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
* Action supplied.
* Creates a menu item whose properties are taken from the Action supplied.
*
* @param a the action of the {@code JCheckBoxMenuItem}
* @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);
}

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

@ -74,9 +74,9 @@ public abstract class Theme {
/**
* Load the theme defaults.
* <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()}
* to return the class of the theme you are overwriting. In this case you should use
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}.
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
@ -89,9 +89,9 @@ public abstract class Theme {
/**
* Load the global values.
* <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()}
* to return the class of the theme you are overwriting. In this case you should use
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}.
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
@ -104,9 +104,9 @@ public abstract class Theme {
/**
* Load the icon defaults.
* <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()}
* to return the class of the theme you are overwriting. In this case you should use
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}.
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param properties the properties to load the value into.
* @param currentDefaults the current ui defaults.
@ -122,9 +122,9 @@ public abstract class Theme {
/**
* Load the general properties file for the icon themes.
* <p>
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()}
* to return the class of the theme you are overwriting. In this case you should use
* {@link #loadWithClass(String, Class)} instead of {@link #load(String)}.
* Note: When overwriting a theme you also have overwrite {@link #getLoaderClass()} to return the class of the theme
* you are overwriting. In this case you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param properties the properties to load the value into.
* @param currentDefaults the current ui defaults.
@ -149,8 +149,8 @@ public abstract class Theme {
/**
* Load the platform defaults.
* <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)}
* instead of {@link #load(String)}.
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param properties the properties to load the values into.
* @param currentDefaults the current ui defaults.
@ -167,8 +167,8 @@ public abstract class Theme {
/**
* Load the ui defaults.
* <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)}
* instead of {@link #load(String)}.
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param properties the properties to load the values into.
* @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
* #getName()}_{propertySuffix}.properties
* <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)}
* instead of {@link #load(String)}.
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead of {@link
* #load(String)}.
*
* @param propertySuffix the property suffix.
* @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.
* <p>
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)}
* instead.
* Note: When overwriting a theme you should use {@link #loadWithClass(String, Class)} instead.
*
* @param name the properties file to load.
* @return the properties.
@ -251,9 +250,8 @@ public abstract class Theme {
public abstract String getName();
/**
* The class used to determine the runtime location of resources.
* It is advised to explicitly return the class instead of using {@link #getClass()} to protect
* against extending the theme.
* The class used to determine the runtime location of resources. It is advised to explicitly return the class
* instead of using {@link #getClass()} to protect against extending the theme.
*
* @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.Transferable;
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;
/**
@ -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
* 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() {
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
* @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) {
DataFlavor[] flavors = getTransferDataFlavors();
for (int i = 0; i < flavors.length; i++) {
if (flavors[i].equals(flavor)) {
for (DataFlavor dataFlavor : flavors) {
if (dataFlavor.equals(flavor)) {
return true;
}
}
@ -130,12 +133,10 @@ public class BasicTransferable implements Transferable, UIResource {
* the representation class of the flavor.
*
* @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.
* @see DataFlavor#getRepresentationClass
*/
public Object getTransferData(final DataFlavor flavor) throws UnsupportedFlavorException, IOException {
DataFlavor[] richerFlavors = getRicherFlavors();
public Object getTransferData(final DataFlavor flavor) throws UnsupportedFlavorException {
if (isRicherFlavor(flavor)) {
return getRicherData(flavor);
} else if (isHTMLFlavor(flavor)) {
@ -192,7 +193,7 @@ public class BasicTransferable implements Transferable, UIResource {
return null;
}
protected Object getRicherData(final DataFlavor flavor) throws UnsupportedFlavorException {
protected Object getRicherData(final DataFlavor flavor) {
return null;
}
@ -206,8 +207,8 @@ public class BasicTransferable implements Transferable, UIResource {
*/
protected boolean isHTMLFlavor(final DataFlavor flavor) {
DataFlavor[] flavors = htmlFlavors;
for (int i = 0; i < flavors.length; i++) {
if (flavors[i].equals(flavor)) {
for (DataFlavor dataFlavor : flavors) {
if (dataFlavor.equals(flavor)) {
return true;
}
}
@ -243,8 +244,8 @@ public class BasicTransferable implements Transferable, UIResource {
*/
protected boolean isPlainFlavor(final DataFlavor flavor) {
DataFlavor[] flavors = plainFlavors;
for (int i = 0; i < flavors.length; i++) {
if (flavors[i].equals(flavor)) {
for (DataFlavor dataFlavor : flavors) {
if (dataFlavor.equals(flavor)) {
return true;
}
}
@ -280,8 +281,8 @@ public class BasicTransferable implements Transferable, UIResource {
*/
protected boolean isStringFlavor(final DataFlavor flavor) {
DataFlavor[] flavors = stringFlavors;
for (int i = 0; i < flavors.length; i++) {
if (flavors[i].equals(flavor)) {
for (DataFlavor dataFlavor : flavors) {
if (dataFlavor.equals(flavor)) {
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
* 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.
* <ul>
* <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 {
private Color shadowColor;
private Color focusBorderColor;
private Color defaultBorderColor;
private Color borderColor;
private Color inactiveBorderColor;
private final Color shadowColor;
private final Color focusBorderColor;
private final Color defaultBorderColor;
private final Color borderColor;
private final Color inactiveBorderColor;
private int arc;
private int focusArc;
private int squareFocusArc;
private int squareArc;
private int minimumArc;
private int borderSize;
private int shadowSize;
private final int arc;
private final int focusArc;
private final int squareFocusArc;
private final int squareArc;
private final int minimumArc;
private final int borderSize;
private final int shadowSize;
private Insets insets;
private Insets thinInsets;
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.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.DarkTableUI;
import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonUI;
import com.github.weisj.darklaf.ui.tree.DarkTreeCellRenderer;
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
*/
final class ColorPreviewComponent extends JComponent {
protected Color borderColor;
protected final Color borderColor;
private Color myColor;
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 myWidth;
private final int myHeight;
private float myBrightness;
private final float myBrightness;
private float[] myHues;
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),
alpha);
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.ColorSelectionModel;
import java.awt.*;
import java.awt.event.KeyAdapter;
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.awt.event.*;
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 shadowColor;
protected Color knobFill;
private boolean isOpacity;
private final boolean isOpacity;
private int pointerValue = 0;
private int value = 0;
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 Insets boxPadding;
protected Insets cellPadding;
protected int borderSize;
protected int arcSize;
protected Color focusBorderColor;
protected Color inactiveBackground;
protected Color arrowBackground;
protected Color background;
protected Color borderColor;
protected Color inactiveBorderColor;
protected final int borderSize;
protected final int arcSize;
protected final Color focusBorderColor;
protected final Color inactiveBackground;
protected final Color arrowBackground;
protected final Color background;
protected final Color borderColor;
protected final Color inactiveBorderColor;
public DarkComboBoxBorder(final DarkComboBoxUI 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 {
protected JComboBox<?> comboBox;
protected final JComboBox<?> comboBox;
public DarkComboBoxListener(final JComboBox<?> 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}
*/
public DarkComboPopup(final JComboBox combo) {
public DarkComboPopup(final JComboBox<Object> combo) {
super(combo);
}
@ -114,11 +114,6 @@ public class DarkComboPopup extends BasicComboPopup {
setFocusable(false);
}
@Override
protected void configureList() {
super.configureList();
}
@Override
protected void togglePopup() {
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() {
lastEvent = 0;
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);
static final int space = 10;
// Preferred and Minimum sizes for the dialog box
protected static int PREF_WIDTH = 500;
protected static int PREF_HEIGHT = 326;
protected static Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
protected static int MIN_WIDTH = 500;
protected static int MIN_HEIGHT = 326;
protected static int LIST_PREF_WIDTH = 405;
protected static int LIST_PREF_HEIGHT = 135;
protected static Dimension LIST_PREF_SIZE = new Dimension(LIST_PREF_WIDTH, LIST_PREF_HEIGHT);
protected static final int PREF_WIDTH = 500;
protected static final int PREF_HEIGHT = 326;
protected static final Dimension PREF_SIZE = new Dimension(PREF_WIDTH, PREF_HEIGHT);
protected static final int MIN_WIDTH = 500;
protected static final int MIN_HEIGHT = 326;
protected static final int LIST_PREF_WIDTH = 405;
protected static final int LIST_PREF_HEIGHT = 135;
protected static final Dimension LIST_PREF_SIZE = new Dimension(LIST_PREF_WIDTH, LIST_PREF_HEIGHT);
protected JLabel lookInLabel;
protected JComboBox<Object> directoryComboBox;
protected DirectoryComboBoxModel directoryComboBoxModel;
protected Action directoryComboBoxAction = new DirectoryComboBoxAction();
protected final Action directoryComboBoxAction = new DirectoryComboBoxAction();
protected FilterComboBoxModel filterComboBoxModel;
protected JTextField fileNameTextField;
protected DarkFilePaneUIBridge filePane;
@ -592,8 +592,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
}
protected static void groupLabels(final AlignedLabel[] group) {
for (int i = 0; i < group.length; i++) {
group[i].group = group;
for (AlignedLabel alignedLabel : group) {
alignedLabel.group = group;
}
}
@ -631,8 +631,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
int prefWidth = PREF_SIZE.width;
Dimension d = c.getLayout().preferredLayoutSize(c);
if (d != null) {
return new Dimension(d.width < prefWidth ? prefWidth : d.width,
d.height < PREF_SIZE.height ? PREF_SIZE.height : d.height);
return new Dimension(Math.max(d.width, prefWidth),
Math.max(d.height, PREF_SIZE.height));
} else {
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.
*/
protected static class ButtonAreaLayout implements LayoutManager {
protected int hGap = 5;
protected final int hGap = 5;
protected int topMargin = 17;
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 maxWidth = 0;
for (int counter = 0; counter < numChildren; counter++) {
Dimension aSize = children[counter].getPreferredSize();
for (Component child : children) {
Dimension aSize = child.getPreferredSize();
height = Math.max(height, aSize.height);
maxWidth = Math.max(maxWidth, aSize.width);
}
@ -820,7 +820,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
*
* @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}.
*
@ -836,7 +836,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
* @deprecated As of JDK version 9. Obsolete class.
*/
@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")
// Superclass is not serializable across versions
class DirectoryComboBoxRenderer extends DefaultListCellRenderer {
IndentIcon ii = new IndentIcon();
final IndentIcon ii = new IndentIcon();
public Component getListCellRendererComponent(final JList<?> list, final Object value,
final int index, final boolean isSelected,
@ -859,8 +859,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
}
File directory = (File) value;
setText(getFileChooser().getName(directory));
Icon icon = getFileChooser().getIcon(directory);
ii.icon = icon;
ii.icon = getFileChooser().getIcon(directory);
ii.depth = directoryComboBoxModel.getDepth(index);
setIcon(ii);
@ -868,7 +867,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
}
}
class IndentIcon implements Icon {
static class IndentIcon implements Icon {
Icon icon = null;
int depth = 0;
@ -896,11 +895,11 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
*/
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class DirectoryComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object> {
Vector<File> directories = new Vector<File>();
final Vector<File> directories = new Vector<>();
int[] depths = null;
File selectedDirectory = null;
JFileChooser chooser = getFileChooser();
FileSystemView fsv = chooser.getFileSystemView();
final JFileChooser chooser = getFileChooser();
final FileSystemView fsv = chooser.getFileSystemView();
/**
* Constructs an instance of {@code DirectoryComboBoxModel}.
@ -951,7 +950,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
: canonical;
File f = sf;
Vector<File> path = new Vector<File>(10);
Vector<File> path = new Vector<>(10);
do {
path.addElement(f);
} while ((f = f.getParentFile()) != null);
@ -1027,7 +1026,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
* Data model for a type-face selection combo-box.
*/
@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.
@ -1071,6 +1071,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
for (FileFilter filter : filters) {
if (filter == currentFilter) {
found = true;
break;
}
}
if (!found) {
@ -1124,7 +1125,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
}
@SuppressWarnings("serial") // Superclass is not serializable across versions
protected class AlignedLabel extends JLabel {
protected static class AlignedLabel extends JLabel {
protected AlignedLabel[] group;
protected int maxWidth = 0;
@ -1148,11 +1149,11 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
protected int getMaxWidth() {
if (maxWidth == 0 && group != null) {
int max = 0;
for (int i = 0; i < group.length; i++) {
max = Math.max(group[i].getSuperPreferredWidth(), max);
for (AlignedLabel label : group) {
max = Math.max(label.getSuperPreferredWidth(), max);
}
for (int i = 0; i < group.length; i++) {
group[i].maxWidth = max;
for (AlignedLabel alignedLabel : group) {
alignedLabel.maxWidth = max;
}
}
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 gap = 0;
ListCellRenderer renderer = list.getCellRenderer();
ListCellRenderer<?> renderer = list.getCellRenderer();
if (renderer instanceof JLabel) {
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);
protected static final int COLUMN_FILENAME = 0;
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) {
repaintSelection(fe.getSource());
}
@ -94,7 +94,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
protected void repaintSelection(final Object source) {
if (source instanceof JList) {
repaintListSelection((JList) source);
repaintListSelection((JList<?>) source);
} else if (source instanceof JTable) {
repaintTableSelection((JTable) source);
}
@ -125,7 +125,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
};
protected Action[] actions;
protected int viewType = -1;
protected JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT];
protected final JPanel[] viewPanels = new JPanel[VIEWTYPE_COUNT];
protected JPanel currentViewPanel;
protected String[] viewTypeActionNames;
protected String filesListAccessibleName = null;
@ -141,7 +141,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
protected String renameErrorTitleText;
protected String renameErrorText;
protected String renameErrorFileExistsText;
protected boolean smallIconsView = false;
protected final boolean smallIconsView = false;
protected Border listViewBorder;
protected Color listViewBackground;
protected boolean listViewWindowsStyle;
@ -155,7 +155,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// be selected when it appears in the model.
protected File newFolderFile;
// Used for accessing methods in the corresponding UI class
protected FileChooserUIAccessor fileChooserUIAccessor;
protected final FileChooserUIAccessor fileChooserUIAccessor;
protected DetailsTableModel detailsTableModel;
protected DetailsTableRowSorter rowSorter;
protected final KeyListener detailsKeyListener = new KeyAdapter() {
@ -240,7 +240,9 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
if (index >= 0) {
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);
}
}
@ -272,7 +274,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
int lastIndex = -1;
File editFile = null;
JTextField editCell = null;
protected FocusListener editorFocusListener = new FocusAdapter() {
protected final FocusListener editorFocusListener = new FocusAdapter() {
public void focusLost(final FocusEvent e) {
if (!e.isTemporary()) {
applyEdit();
@ -348,7 +350,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
Boolean prop = (Boolean) chooser.getClientProperty("FileChooser.useShellFolder");
return prop == null ? chooser.getFileSystemView().equals(FileSystemView.getFileSystemView())
: prop.booleanValue();
: prop;
}
public void uninstallUI() {
@ -926,23 +928,32 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
}
String s = e.getPropertyName();
if (s.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
switch (s) {
case JFileChooser.SELECTED_FILE_CHANGED_PROPERTY:
doSelectedFileChanged(e);
} else if (s.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) {
break;
case JFileChooser.SELECTED_FILES_CHANGED_PROPERTY:
doSelectedFilesChanged(e);
} else if (s.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
break;
case JFileChooser.DIRECTORY_CHANGED_PROPERTY:
doDirectoryChanged(e);
} else if (s.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
break;
case JFileChooser.FILE_FILTER_CHANGED_PROPERTY:
doFilterChanged(e);
} else if (s.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) {
break;
case JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY:
doFileSelectionModeChanged(e);
} else if (s.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) {
break;
case JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY:
doMultiSelectionChanged(e);
} else if (s.equals(JFileChooser.CANCEL_SELECTION)) {
break;
case JFileChooser.CANCEL_SELECTION:
applyEdit();
} else if (s.equals("busy")) {
break;
case "busy":
setCursor((Boolean) e.getNewValue() ? waitCursor : null);
} else if (s.equals(PropertyKey.COMPONENT_ORIENTATION)) {
break;
case PropertyKey.COMPONENT_ORIENTATION:
ComponentOrientation o = (ComponentOrientation) e.getNewValue();
JFileChooser cc = (JFileChooser) e.getSource();
if (o != e.getOldValue()) {
@ -952,6 +963,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
detailsTable.setComponentOrientation(o);
detailsTable.getParent().getParent().setComponentOrientation(o);
}
break;
}
}
@ -1076,7 +1088,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
@SuppressWarnings("serial")
// JDK-implementation class
protected class ViewTypeAction extends AbstractAction {
protected int viewType;
protected final int viewType;
ViewTypeAction(final int viewType) {
super(viewTypeActionNames[viewType]);
@ -1134,8 +1146,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
@SuppressWarnings("serial")
// JDK-implementation class
class DetailsTableModel extends AbstractTableModel implements ListDataListener {
JFileChooser chooser;
BasicDirectoryModel directoryModel;
final JFileChooser chooser;
final BasicDirectoryModel directoryModel;
ShellFolderColumnInfo[] columns;
int[] columnMap;
@ -1242,7 +1254,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
final File f2 = fsv.createFileObject(f.getParentFile(), newFileName);
if (f2.exists()) {
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorFileExistsText,
oldFileName), renameErrorTitleText,
oldFileName),
renameErrorTitleText,
JOptionPane.ERROR_MESSAGE);
} else {
if (DarkFilePaneUIBridge.this.getModel().renameFile(f, f2)) {
@ -1262,7 +1275,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// chooser.setSelectedFile(null);
}
} else {
JOptionPane.showMessageDialog(chooser, MessageFormat.format(renameErrorText, oldFileName),
JOptionPane.showMessageDialog(chooser,
MessageFormat.format(renameErrorText, oldFileName),
renameErrorTitleText, JOptionPane.ERROR_MESSAGE);
}
}
@ -1367,8 +1381,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
* comparator.
*/
protected class DirectoriesFirstComparatorWrapper implements Comparator<File> {
protected Comparator<Object> comparator;
protected int column;
protected final Comparator<Object> comparator;
protected final int column;
@SuppressWarnings("unchecked")
public DirectoriesFirstComparatorWrapper(final int column, final Comparator<?> comparator) {
@ -1427,8 +1441,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
@SuppressWarnings("serial")
// JDK-implementation class
public class DetailsTableCellRenderer extends DarkTableCellRenderer {
JFileChooser chooser;
DateFormat df;
final JFileChooser chooser;
final DateFormat df;
public DetailsTableCellRenderer(final JFileChooser chooser) {
this.chooser = chooser;
@ -1502,7 +1516,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
}
protected class AlignableTableHeaderRenderer implements TableCellRenderer {
TableCellRenderer wrappedRenderer;
final TableCellRenderer wrappedRenderer;
public AlignableTableHeaderRenderer(final TableCellRenderer 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);
}
@Override
protected void installTitlePane() {
super.installTitlePane();
}
@Override
protected void 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 cellForegroundNoFocus;
protected Rectangle paintIconR = new Rectangle();
protected Rectangle paintTextR = new Rectangle();
protected final Rectangle paintIconR = new Rectangle();
protected final Rectangle paintTextR = new Rectangle();
public DarkLabelUI() {
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 {
protected Color borderColor;
protected final Color borderColor;
public DarkListCellFocusBorder() {
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
* @see #paint
*/
protected void paintCell(
final Graphics g,
protected void paintCell(final Graphics g,
final int row,
final Rectangle rowBounds,
final ListCellRenderer cellRenderer,
@ -359,8 +358,7 @@ public class DarkListUIBridge extends BasicListUI {
BASELINE_COMPONENT_KEY);
if (renderer == null) {
@SuppressWarnings("unchecked")
ListCellRenderer<Object> lcr = (ListCellRenderer) UIManager.get(
"List.cellRenderer");
ListCellRenderer<Object> lcr = (ListCellRenderer<Object>) UIManager.get("List.cellRenderer");
// fix for 6711072 some LAFs like Nimbus do not provide this
// 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) {
@SuppressWarnings("unchecked")
ListCellRenderer<Object> tmp = (ListCellRenderer) (UIManager.get("List.cellRenderer"));
ListCellRenderer<Object> tmp = (ListCellRenderer<Object>) (UIManager.get("List.cellRenderer"));
list.setCellRenderer(tmp);
}
@ -716,7 +714,7 @@ public class DarkListUIBridge extends BasicListUI {
*/
public void installUI(final JComponent c) {
@SuppressWarnings("unchecked")
JList<Object> tmp = (JList) c;
JList<Object> tmp = (JList<Object>) c;
list = tmp;
layoutOrientation = list.getLayoutOrientation();
@ -1434,9 +1432,6 @@ public class DarkListUIBridge extends BasicListUI {
(column == 0 && columnCount == 1)) {
return list.getModel().getSize();
}
if (column >= columnCount) {
return -1;
}
if (layoutOrientation == JList.VERTICAL_WRAP) {
if (column < (columnCount - 1)) {
return rowsPerColumn;
@ -1742,7 +1737,7 @@ public class DarkListUIBridge extends BasicListUI {
@SuppressWarnings("deprecation")
protected Transferable createTransferable(final JComponent c) {
if (c instanceof JList) {
JList<?> list = (JList) c;
JList<?> list = (JList<Object>) c;
Object[] values = list.getSelectedValues();
if (values == null || values.length == 0) {
@ -1754,8 +1749,7 @@ public class DarkListUIBridge extends BasicListUI {
htmlStr.append("<html>\n<body>\n<ul>\n");
for (int i = 0; i < values.length; i++) {
Object obj = values[i];
for (Object obj : values) {
String val = ((obj == null) ? "" : obj.toString());
plainStr.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
// DefaultListSelectionModel
return c != null && ((JList) c).getSelectionModel()
return c != null && ((JList<Object>) c).getSelectionModel()
instanceof DefaultListSelectionModel;
}
@ -2562,7 +2556,7 @@ public class DarkListUIBridge extends BasicListUI {
* letters followed by first typed another letter.
*/
public void keyTyped(final KeyEvent e) {
JList<?> src = (JList) e.getSource();
JList<?> src = (JList<?>) e.getSource();
ListModel<?> model = src.getModel();
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.
*/
if (Objects.equals(propertyName, "model")) {
ListModel<?> oldModel = (ListModel) e.getOldValue();
ListModel<?> newModel = (ListModel) e.getNewValue();
ListModel<?> oldModel = (ListModel<?>) e.getOldValue();
ListModel<?> newModel = (ListModel<?>) e.getNewValue();
if (oldModel != null) {
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 {
protected Color borderColor;
protected final Color borderColor;
public DarkMenuBarBorder() {
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;
import com.github.weisj.darklaf.util.DarkUIUtil;
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 com.github.weisj.darklaf.util.*;
import sun.swing.MenuItemLayoutHelper;
import sun.swing.SwingUtilities2;
import sun.swing.UIAction;
@ -98,9 +94,11 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
DarkUIUtil.applyInsets(viewRect, mi.getInsets());
MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon,
arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter,
arrowIcon, viewRect, defaultTextIconGap,
acceleratorDelimiter,
mi.getComponentOrientation().isLeftToRight(), mi.getFont(),
acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem),
acceleratorFont,
MenuItemLayoutHelper.useCheckAndArrow(menuItem),
getPropertyPrefix());
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());
MenuItemLayoutHelper lh = new MenuItemLayoutHelper(mi, checkIcon,
arrowIcon, viewRect, defaultTextIconGap, acceleratorDelimiter,
arrowIcon, viewRect, defaultTextIconGap,
acceleratorDelimiter,
mi.getComponentOrientation().isLeftToRight(), mi.getFont(),
acceleratorFont, MenuItemLayoutHelper.useCheckAndArrow(menuItem),
acceleratorFont,
MenuItemLayoutHelper.useCheckAndArrow(menuItem),
getPropertyPrefix());
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.drawString(String.format("%1$" + digits + "d", i), OUTER_PAD,
lineRect.y + lineRect.height - descent);
} catch (BadLocationException ignored) { }
} catch (BadLocationException ignored) {
}
}
config.restore();
}
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());
for (Map.Entry<Position, Icon> icon : icons) {
Rectangle lineRect;
@ -264,7 +266,8 @@ public class DarkNumberingPaneUI extends ComponentUI {
listener.iconClicked(e);
}
}
} catch (BadLocationException ignored) { }
} catch (BadLocationException ignored) {
}
}
IndexListener[] list = numberingPane.getIndexListeners();
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();
}
@Override
protected LayoutManager createLayoutManager() {
return super.createLayoutManager();
}
@Override
protected Container createButtonArea() {
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
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"));
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);
yOffset = r.y + pHeight / 2;
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));
} else {
shape = getShapedRect(xOffset, r.y, pWidth, r.height, pWidth);
xOffset = r.x + pWidth / 2;
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));
}
g2.fill(shape);
@ -180,7 +182,8 @@ public class DarkProgressBarUI extends BasicProgressBarUI implements PropertyCha
@Override
protected void 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);
trackColor = UIManager.getColor("ProgressBar.trackColor");
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 oldLayout;
private JRootPane rootPane;
private DisposeListener disposeListener = new DisposeListener();
private final DisposeListener disposeListener = new DisposeListener();
private boolean decorationStyleLock = false;
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;
private final DarkScrollBarUI ui;
private Animator trackFadeoutAnimator;
private Animator trackFadeinAnimator;
private Animator thumbFadeoutAnimator;
private Animator thumbFadeinAnimator;
private final Animator trackFadeoutAnimator;
private final Animator trackFadeinAnimator;
private final Animator thumbFadeoutAnimator;
private final Animator thumbFadeinAnimator;
protected boolean mouseOverThumb = false;
protected boolean mouseOverTrack = false;
@ -221,7 +221,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class TrackFadeOutAnimator extends Animator {
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) {
@ -245,7 +246,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class ThumbFadeInAnimator extends Animator {
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
@ -273,7 +275,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class TrackFadeInAnimator extends Animator {
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) {
@ -294,7 +297,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
protected class ThumbFadeOutAnimator extends Animator {
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

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 {
protected Color focusBorderColor;
protected Color borderColor;
protected Color inactiveBorderColor;
protected int arc;
protected int borderSize;
protected final Color focusBorderColor;
protected final Color borderColor;
protected final Color inactiveBorderColor;
protected final int arc;
protected final int borderSize;
protected Insets insets;
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 {
protected Icon leftOneTouch;
protected Icon rightOneTouch;
protected Icon topOneTouch;
protected Icon bottomOneTouch;
protected Icon verticalSplit;
protected Icon horizontalSplit;
protected Color borderColor;
protected final Icon leftOneTouch;
protected final Icon rightOneTouch;
protected final Icon topOneTouch;
protected final Icon bottomOneTouch;
protected final Icon verticalSplit;
protected final Icon horizontalSplit;
protected final Color borderColor;
public DarkSplitPaneDivider(final BasicSplitPaneUI 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 {
protected DarkTabbedPaneUI ui;
protected final DarkTabbedPaneUI ui;
protected Point origin;
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 textRect = new Rectangle();
private DarkTabbedPaneUI ui;
private final DarkTabbedPaneUI ui;
public DarkScrollableTabPanel(final DarkTabbedPaneUI ui) {
super(ui);
@ -79,7 +79,8 @@ class DarkScrollableTabPanel extends ScrollableTabPanel {
public void paint(final Graphics g) {
super.paint(g);
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);
if (comp != null) {
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 Timer timer;
protected long lastClickEvent;
private DarkTabbedPaneUI ui;
private final DarkTabbedPaneUI ui;
public DarkScrollableTabSupport(final DarkTabbedPaneUI ui, final int tabPlacement) {
super(ui);
@ -59,7 +59,8 @@ public class DarkScrollableTabSupport extends ScrollableTabSupport implements Mo
moreTabsButton.addActionListener(this);
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));
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 {
private DarkTabbedPaneUI ui;
private final DarkTabbedPaneUI ui;
public DarkTabAreaButton(final DarkTabbedPaneUI 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 {
private DarkTabbedPaneUI ui;
private final DarkTabbedPaneUI ui;
public DarkTabbedPaneLayout(final DarkTabbedPaneUI 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 {
private DarkTabbedPaneUI ui;
private final DarkTabbedPaneUI ui;
public DarkTabbedPaneScrollLayout(final DarkTabbedPaneUI ui) {
super(ui);
@ -570,7 +570,8 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
protected void restoreHiddenTabsY(final int minY, final int maxY, final int tabCount) {
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);
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 boolean dragging;
protected Rectangle dragRect = new Rectangle();
protected final Rectangle dragRect = new Rectangle();
protected Color dragBorderColor;
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 Icon icon;
protected DarkTabbedPaneUI ui;
protected final DarkTabbedPaneUI ui;
protected final int pad;
public MoreTabsButton(final DarkTabbedPaneUI ui) {
@ -87,7 +87,8 @@ public class MoreTabsButton extends DarkTabAreaButton {
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);
}

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 {
protected final JButton button;
protected DarkTabbedPaneUI ui;
protected final DarkTabbedPaneUI ui;
protected NewTabButton(final DarkTabbedPaneUI 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.*;
public class ScrollableTabPanel extends JPanel implements UIResource {
private DarkTabbedPaneUIBridge ui;
private final DarkTabbedPaneUIBridge ui;
public ScrollableTabPanel(final DarkTabbedPaneUIBridge ui) {
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.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.dnd.DragGestureEvent;
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.dnd.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.lang.reflect.Field;
@ -260,7 +248,8 @@ public class TabbedPaneTransferHandler extends TransferHandler implements DropTa
}
Rectangle dropRect = TabbedPaneUtil.getDropRect(supportsIndicator(destTabbedPane), destTabbedPane,
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,
tab, t.transferData.sourceTabbedPane == destTabbedPane);
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,
lastTab, tabPlacement, destRect);
} else {
calculateDropRectWrapLayout(ui, destTabbedPane, source, mouseLocation, tabBounds, tab, sourceIndex, destRect);
calculateDropRectWrapLayout(ui, destTabbedPane, source, mouseLocation, tabBounds, tab, sourceIndex,
destRect);
}
return tabBounds;
}
private static void calculateDropRectScrollLayout(final JTabbedPane destTabbedPane, final JTabbedPane source,
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;
if (destTabbedPane == source && (tab == sourceIndex || (sourceIndex == source.getTabCount() - 1
&& 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;
boolean focus = DarkUIUtil.hasFocus(popupComponent);
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);
}
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 {
private final TabFrameTab tab;
private JMenuItem[] actions;
private final JMenuItem[] actions;
private int disabled = -1;
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 selectedColor;
private Color hoverColor;
private RotatableIcon rotatableIcon = new RotatableIcon();
private final RotatableIcon rotatableIcon = new RotatableIcon();
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 int tabHeight;
private Color dragBorderColor;
private Dimension dropSize = new Dimension();
private final Dimension dropSize = new Dimension();
private Alignment sourceAlign;
private int sourceIndex;
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;
}
@SuppressWarnings("unchecked")
@Override
public void mouseDragged(final MouseEvent e) {
if (origin == null) origin = e.getPoint();
@ -60,7 +61,8 @@ public class TabDragListener extends MouseAdapter {
if (th != null && tabComponent.getTabFrame().isDndEnabled()) {
Point p = e.getPoint();
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, tabComponent.getTabFrame());
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 {
private final JTabFrame tabFrame;
private DarkTabFrameUI ui;
private int[] shift;
private boolean[] draggedOver;
private final DarkTabFrameUI ui;
private final int[] shift;
private final boolean[] draggedOver;
private int topHeight;
private int leftHeight;
private int rightHeight;
@ -230,7 +230,8 @@ public class TabFrameLayout implements LayoutManager {
int size = rightSize > 0 ? rightHeight : tabFrame.getTabSize();
int height = dim.height - topPane.getHeight() - bottomPane.getHeight();
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());
if (rightSize > 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) {
Point p = MouseInfo.getPointerInfo().getLocation();
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);
}
});

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 {
protected Color rowBorderColor;
protected Color borderColor;
protected final Color rowBorderColor;
protected final Color borderColor;
public DarkTableCellFocusBorder() {
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 {
protected Color borderColor;
protected Color background;
protected final Color borderColor;
protected final Color background;
public DarkTableHeaderCorner() {
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;
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;
String cutActionName = String.valueOf(TransferHandler.getCutAction().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 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);
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)) {
changeLead = (rsm.getSelectionMode()
== 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()
== ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
}
@ -1990,10 +1992,10 @@ public abstract class TableUIBridge extends TableUI {
htmlStr.append("<html>\n<body>\n<table>\n");
for (int row = 0; row < rows.length; row++) {
for (int value : rows) {
htmlStr.append("<tr>\n");
for (int col = 0; col < cols.length; col++) {
Object obj = table.getValueAt(rows[row], cols[col]);
for (int i : cols) {
Object obj = table.getValueAt(value, i);
String val = ((obj == null) ? "" : obj.toString());
plainStr.append(val).append('\t');
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 {
protected Color borderColor;
protected final Color borderColor;
public TextTableCellEditorBorder() {
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 Color color;
protected int arc;
protected final Color color;
protected 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) {
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);
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 {
private static final Border editorBorder = new TextTableCellEditorBorder();
protected Color errorBorderColor;
protected Color focusErrorBorderColor;
protected Color focusBorderColor;
protected Color borderColor;
protected Color inactiveBorderColor;
protected int borderSize;
protected int arc;
protected int searchArc;
protected int focusArc;
protected int searchFocusArc;
protected final Color errorBorderColor;
protected final Color focusErrorBorderColor;
protected final Color focusBorderColor;
protected final Color borderColor;
protected final Color inactiveBorderColor;
protected final int borderSize;
protected final int arc;
protected final int searchArc;
protected final int focusArc;
protected final int searchFocusArc;
protected Insets padding;
protected Icon showIcon;
protected final Icon showIcon;
public DarkTextBorder() {
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.event.DocumentEvent;
import javax.swing.plaf.basic.BasicTextFieldUI;
import javax.swing.text.AbstractDocument;
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 javax.swing.text.*;
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
// so we reset the border
// 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.putClientProperty(KEY_ROUNDED_SELECTION, UIManager.getBoolean("TextComponent.roundedSelection"));
@ -317,7 +318,8 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
km.clear();
if (accelerator != '\0') {
km.put(KeyStroke.getKeyStroke(accelerator, getFocusAcceleratorKeyMask()), "requestFocus");
km.put(KeyStroke.getKeyStroke(accelerator, DarkSwingUtil.setAltGraphMask(getFocusAcceleratorKeyMask())),
km.put(KeyStroke
.getKeyStroke(accelerator, DarkSwingUtil.setAltGraphMask(getFocusAcceleratorKeyMask())),
"requestFocus");
}
}
@ -363,8 +365,10 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
*/
EditorKit editorKit = getEditorKit(editor);
if (editorKit instanceof DefaultEditorKit) {
Set<AWTKeyStroke> storedForwardTraversalKeys = editor.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> storedForwardTraversalKeys = editor.getFocusTraversalKeys(
KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> storedBackwardTraversalKeys = editor.getFocusTraversalKeys(
KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> forwardTraversalKeys = new HashSet<>(storedForwardTraversalKeys);
Set<AWTKeyStroke> backwardTraversalKeys = new HashSet<>(storedBackwardTraversalKeys);
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
*/
public class TextActionWrapper extends TextAction {
TextAction action;
final TextAction action;
public TextActionWrapper(final TextAction action) {
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;
import javax.swing.*;
import javax.swing.text.BadLocationException;
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 javax.swing.text.*;
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;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.DefaultEditorKit;
import javax.swing.text.JTextComponent;
import javax.swing.text.TextAction;
import javax.swing.text.Utilities;
import javax.swing.text.*;
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
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);
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;
public class ButtonGroupInfo {
protected AbstractButton activeButton;
protected final AbstractButton activeButton;
protected AbstractButton firstButton = null;
protected AbstractButton lastButton = null;
@ -37,7 +37,7 @@ public class ButtonGroupInfo {
protected AbstractButton previousButton = null;
protected AbstractButton nextButton = null;
protected HashSet<AbstractButton> buttonsInGroup;
protected final HashSet<AbstractButton> buttonsInGroup;
protected boolean sourceFound = false;
public ButtonGroupInfo(final AbstractButton btn) {
@ -120,8 +120,7 @@ public class ButtonGroupInfo {
}
/**
* Find the new radio button that focus needs to be
* moved to in the group, select the button
* Find the new radio button that focus needs to be moved to in the group, select the button
*
* @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
* move focus to next component of the last button in the group
* or previous component of first button
* Find the button group the passed in AbstractButton belongs to, and move focus to next component of the last
* button in the group or previous component of first button
*
* @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 {
protected Icon horizontalGrip;
protected Icon verticalGrip;
protected Color borderColor;
protected final Icon horizontalGrip;
protected final Icon verticalGrip;
protected final Color borderColor;
public DarkToolBarBorder() {
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;
private Dimension verticalDim = 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) {
@ -84,11 +84,6 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
}
}
@Override
protected void uninstallListeners() {
super.uninstallListeners();
}
@Override
public void setFloating(final boolean b, final Point p) {
if (toolBar.isFloatable()) {
@ -151,11 +146,6 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
background = UIManager.getColor("ToolBar.background");
}
@Override
protected void installListeners() {
super.installListeners();
}
protected void setBorderToNonRollover(final Component c) {
}
@ -171,7 +161,9 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
frame = (Window) p;
}
}
if (floatingToolBar instanceof Window) { frame = (Window) floatingToolBar; }
if (floatingToolBar instanceof Window) {
frame = (Window) floatingToolBar;
}
return new DarkDragWindow(frame);
}
@ -249,7 +241,9 @@ public class DarkToolBarUI extends DarkToolBarUIBridge {
protected void updateDockingSource() {
dockingSource.invalidate();
Container dockingSourceParent = dockingSource.getParent();
if (dockingSourceParent != null) { dockingSourceParent.validate(); }
if (dockingSourceParent != null) {
dockingSourceParent.validate();
}
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 {
// 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 nonRolloverBorder;
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}.
*/
@ -115,8 +115,8 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
*/
protected String constraintBeforeFloating = BorderLayout.NORTH;
protected boolean rolloverBorders = false;
protected HashMap<AbstractButton, Border> borderTable = new HashMap<>();
protected Hashtable<AbstractButton, Boolean> rolloverTable = new Hashtable<>();
protected final HashMap<AbstractButton, Border> borderTable = new HashMap<>();
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
* 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();
// Clear instance vars
if (isFloating()) { setFloating(false, null); }
if (isFloating()) {
setFloating(false, null);
}
floatingToolBar = null;
dragWindow = null;
@ -421,7 +423,9 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
public void setOrientation(final int 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) {
case EAST:
case SOUTH:
if (focusedCompIndex < 0 || focusedCompIndex >= nComp) { break; }
if (focusedCompIndex < 0 || focusedCompIndex >= nComp) {
break;
}
j = focusedCompIndex + 1;
while (j != focusedCompIndex) {
if (j >= nComp) { j = 0; }
if (j >= nComp) {
j = 0;
}
Component comp = toolBar.getComponentAtIndex(j++);
if (comp != null && comp.isFocusTraversable() && comp.isEnabled()) {
comp.requestFocus();
@ -716,10 +724,14 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
break;
case WEST:
case NORTH:
if (focusedCompIndex < 0 || focusedCompIndex >= nComp) { break; }
if (focusedCompIndex < 0 || focusedCompIndex >= nComp) {
break;
}
j = focusedCompIndex - 1;
while (j != focusedCompIndex) {
if (j < 0) { j = nComp - 1; }
if (j < 0) {
j = nComp - 1;
}
Component comp = toolBar.getComponentAtIndex(j--);
if (comp != null && comp.isFocusTraversable() && comp.isEnabled()) {
@ -1073,10 +1085,16 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
protected class FrameListener extends WindowAdapter {
public void windowClosing(final WindowEvent w) {
if (toolBar.isFloatable()) {
if (dragWindow != null) { dragWindow.setVisible(false); }
if (dragWindow != null) {
dragWindow.setVisible(false);
}
floating = false;
if (floatingToolBar == null) { floatingToolBar = createFloatingWindow(toolBar); }
if (floatingToolBar instanceof Window) { ((Window) floatingToolBar).setVisible(false); }
if (floatingToolBar == null) {
floatingToolBar = createFloatingWindow(toolBar);
}
if (floatingToolBar instanceof Window) {
((Window) floatingToolBar).setVisible(false);
}
floatingToolBar.getContentPane().remove(toolBar);
String constraint = constraintBeforeFloating;
if (toolBar.getOrientation() == JToolBar.HORIZONTAL) {
@ -1088,12 +1106,18 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
constraint = "West";
}
}
if (dockingSource == null) { dockingSource = toolBar.getParent(); }
if (propertyListener != null) { UIManager.removePropertyChangeListener(propertyListener); }
if (dockingSource == null) {
dockingSource = toolBar.getParent();
}
if (propertyListener != null) {
UIManager.removePropertyChangeListener(propertyListener);
}
dockingSource.add(toolBar, constraint);
dockingSource.invalidate();
Container dockingSourceParent = dockingSource.getParent();
if (dockingSourceParent != null) { dockingSourceParent.validate(); }
if (dockingSourceParent != null) {
dockingSourceParent.validate();
}
dockingSource.repaint();
}
}
@ -1120,7 +1144,9 @@ public abstract class DarkToolBarUIBridge extends ToolBarUI implements SwingCons
*/
public void setOrientation(final int o) {
if (isShowing()) {
if (o == this.orientation) { return; }
if (o == this.orientation) {
return;
}
this.orientation = o;
Dimension size = getSize();
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
*/
public void setBorderColor(final Color c) {
if (this.borderColor == c) { return; }
if (this.borderColor == c) {
return;
}
this.borderColor = c;
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 {
private JToolBar toolBar;
private Color dropBackground;
private final Color dropBackground;
public DropPreviewPanel() {
dropBackground = UIManager.getColor("ToolBar.dropColor");
@ -62,19 +62,25 @@ public class DropPreviewPanel extends JComponent {
@Override
public Dimension getPreferredSize() {
if (toolBar != null) { return toolBar.getPreferredSize(); }
if (toolBar != null) {
return toolBar.getPreferredSize();
}
return super.getPreferredSize();
}
@Override
public Dimension getMaximumSize() {
if (toolBar != null) { return toolBar.getMaximumSize(); }
if (toolBar != null) {
return toolBar.getMaximumSize();
}
return super.getMinimumSize();
}
@Override
public Dimension getMinimumSize() {
if (toolBar != null) { return toolBar.getMinimumSize(); }
if (toolBar != null) {
return toolBar.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 ToolTipStyle style;
protected boolean isTipTextChanging;
protected MouseListener exitListener = new MouseAdapter() {
protected final MouseListener exitListener = new MouseAdapter() {
@Override
public void mouseExited(final MouseEvent 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
public void mouseEntered(final MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) return;
@ -90,7 +90,7 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe
exitListener.mouseExited(e);
}
};
protected PropertyChangeListener componentPropertyChaneListener = e -> {
protected final PropertyChangeListener componentPropertyChaneListener = e -> {
if (KEY_STYLE.equals(e.getPropertyName())) {
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;
}
@Override
public Object getCellEditorValue() {
return super.getCellEditorValue();
}
@Override
public boolean stopCellEditing() {
return super.stopCellEditing();
}
@Override
protected boolean canEditImmediately(final EventObject event) {
if (event != null && event.getSource() instanceof JTree) {
@ -120,7 +110,7 @@ public class DarkDefaultTreeEditor extends DefaultTreeCellEditor {
Rectangle bounds = tree.getRowBounds(row);
if (bounds != null) {
DarkTreeCellRenderer rend = (DarkTreeCellRenderer) renderer;
DarkCellRendererToggleButton booleanRend = rend.getBooleanRenderer(tree);
DarkCellRendererToggleButton<?> booleanRend = rend.getBooleanRenderer(tree);
JToggleButton button = booleanRend.getButton();
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 {
protected Color borderColor;
protected final Color borderColor;
protected Insets insets;
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));
private final DarkCellRendererToggleButton<DarkCellRendererToggleButton.CellEditorRadioButton> radioRenderer =
new DarkCellRendererToggleButton<>(new DarkCellRendererToggleButton.CellEditorRadioButton(false));
private TreeRendererComponent rendererComponent = new TreeRendererComponent();
private final TreeRendererComponent rendererComponent = new TreeRendererComponent();
@Override
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));
}
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))) {
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);
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();
if (parentPath != null) {
if (parentPath.getParentPath() != null || tree.isRootVisible()) {
@ -339,9 +340,11 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
}
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.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 true;
@ -437,7 +440,9 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
path = (TreePath) paintingEnumerator.nextElement();
if (path != null) {
isLeaf = treeModel.isLeaf(path.getLastPathComponent());
if (isLeaf) { isExpanded = hasBeenExpanded = false; } else {
if (isLeaf) {
isExpanded = hasBeenExpanded = false;
} else {
isExpanded = treeState.getExpandedState(path);
hasBeenExpanded = tree.hasBeenExpanded(path);
}
@ -447,7 +452,9 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
// from under us (usually in another thread).
// Swing isn't multithreaded, but I'll put this
// check in anyway.
{ return; }
{
return;
}
// See if the vertical line to the parent has been drawn.
parentPath = path.getParentPath();
@ -467,7 +474,9 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
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 {
done = true;
}
@ -666,7 +675,8 @@ public class DarkTreeUI extends BasicTreeUI implements PropertyChangeListener {
}
//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)) {
int count = treeModel.getChildCount(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 DROP_ALPHA = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f);
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 textRect = new Rectangle();
@ -332,7 +333,7 @@ public final class DarkUIUtil {
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);
if (!bounds.contains(e.getPoint())) return false;
//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 {
@SuppressWarnings("unchecked")
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) {
TransformUI ui = (TransformUI) layer.getUI();
Point pos = SwingUtilities.convertPoint(source, p, layer);
//noinspection unchecked
AffineTransform transform = ui.getPreferredTransform(layer.getSize(), layer);
transform.transform(pos, 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 Paint paint;
private Color color;
private ColorWrapper wrapper;
private final ColorWrapper wrapper;
private boolean roundedEdges;
private AlphaComposite alphaComposite;
private float alpha;
private int selectionStart = -1;
private int selectionEnd = -1;
private int repaintCount = 0;
private int arcSize;
private final int arcSize;
private boolean suppressRounded = false;
private boolean enabled;
@ -402,7 +402,8 @@ public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPai
boolean roundLeftBottom = !isFirstLine && !extendToStart;
boolean roundLeftTop = isSecondLine && !extendToStart && posStart.x >= r.x + arcSize;
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) {
paintEndArc(g2d, r);
r.width += arcSize;
@ -435,7 +436,8 @@ public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPai
start = Math.min(start, c.getWidth() - ins.right - w);
if (rounded) {
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;
paintRoundRect(g2d, new Rectangle(start, r.y, w, r.height), arcSize,
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,
final MouseEvent originalEvent, final Component newTarget, final Point realPoint) {
final MouseEvent originalEvent, final Component newTarget,
final Point realPoint) {
if (lastEnteredTarget != newTarget) {
dispatchMouseEvent(transformMouseEvent(layer, originalEvent,
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,
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) {
return null;
} 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.LayerUI;
import org.jdesktop.swingx.ForwardingRepaintManager;
import org.pbjar.jxlayer.plaf.ext.transform.DefaultTransformModel;
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.plaf.ext.transform.*;
import org.pbjar.jxlayer.repaint.RepaintManagerProvider;
import org.pbjar.jxlayer.repaint.RepaintManagerUtils;
import org.pbjar.jxlayer.repaint.WrappedRepaintManager;
@ -56,11 +51,7 @@ import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.*;
import java.util.logging.ConsoleHandler;
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)
*/
public static boolean hack = false;
public static final boolean hack = false;
static {
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(
final Class<? extends RepaintManager> clazz, final RepaintManager delegate) {
try {
RepaintManager newManager = clazz.getConstructor(RepaintManager.class).newInstance(delegate);
return newManager;
return clazz.getConstructor(RepaintManager.class).newInstance(delegate);
} catch (Throwable 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}
*/

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

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

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

Loading…
Cancel
Save