Browse Source

formatting and code style.

pull/127/head
weisj 5 years ago
parent
commit
1760744807
  1. 5
      core/src/main/java/com/github/weisj/darklaf/DarkLaf.java
  2. 53
      core/src/main/java/com/github/weisj/darklaf/LafManager.java
  3. 6
      core/src/main/java/com/github/weisj/darklaf/color/ColorWrapper.java
  4. 28
      core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java
  5. 4
      core/src/main/java/com/github/weisj/darklaf/components/ColorPipetteBase.java
  6. 12
      core/src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java
  7. 4
      core/src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java
  8. 4
      core/src/main/java/com/github/weisj/darklaf/components/OverlayScrollPane.java
  9. 4
      core/src/main/java/com/github/weisj/darklaf/components/ScrollPopupMenu.java
  10. 4
      core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java
  11. 4
      core/src/main/java/com/github/weisj/darklaf/components/border/DarkBorders.java
  12. 27
      core/src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java
  13. 8
      core/src/main/java/com/github/weisj/darklaf/components/border/WeakLineBorder.java
  14. 3
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java
  15. 4
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java
  16. 64
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java
  17. 4
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFramePopup.java
  18. 4
      core/src/main/java/com/github/weisj/darklaf/components/tabframe/ToggleSplitPane.java
  19. 7
      core/src/main/java/com/github/weisj/darklaf/components/text/LineHighlighter.java
  20. 7
      core/src/main/java/com/github/weisj/darklaf/components/text/NumberingPane.java
  21. 2
      core/src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java
  22. 8
      core/src/main/java/com/github/weisj/darklaf/components/text/TextFieldHistoryPopup.java
  23. 13
      core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java
  24. 3
      core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java
  25. 7
      core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java
  26. 56
      core/src/main/java/com/github/weisj/darklaf/theme/Theme.java
  27. 33
      core/src/main/java/com/github/weisj/darklaf/ui/BasicTransferable.java
  28. 2
      core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java
  29. 15
      core/src/main/java/com/github/weisj/darklaf/ui/DragRecognitionSupport.java
  30. 12
      core/src/main/java/com/github/weisj/darklaf/ui/button/ButtonConstants.java
  31. 40
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  32. 2
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  33. 14
      core/src/main/java/com/github/weisj/darklaf/ui/cell/DarkCellRendererToggleButton.java
  34. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorPreviewComponent.java
  35. 4
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorValueFormatter.java
  36. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheel.java
  37. 6
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorWheelImageProducer.java
  38. 13
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserPanel.java
  39. 10
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserUI.java
  40. 7
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkSwatchesChooserPanel.java
  41. 902
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/MainSwatchPanel.java
  42. 2
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/SlideComponent.java
  43. 10
      core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/SwatchPanel.java
  44. 4
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/ComboBoxConstants.java
  45. 16
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxBorder.java
  46. 2
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxListener.java
  47. 2
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java
  48. 19
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboPopup.java
  49. 2
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUI.java
  50. 85
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFileChooserUIBridge.java
  51. 10
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePane.java
  52. 168
      core/src/main/java/com/github/weisj/darklaf/ui/filechooser/DarkFilePaneUIBridge.java
  53. 2
      core/src/main/java/com/github/weisj/darklaf/ui/html/DarkHTML.java
  54. 5
      core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameTitlePane.java
  55. 12
      core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java
  56. 4
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListCellFocusBorder.java
  57. 234
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java
  58. 2
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuBarBorder.java
  59. 24
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuItemUIBase.java
  60. 20
      core/src/main/java/com/github/weisj/darklaf/ui/menu/DarkMenuUI.java
  61. 11
      core/src/main/java/com/github/weisj/darklaf/ui/numberingpane/DarkNumberingPaneUI.java
  62. 15
      core/src/main/java/com/github/weisj/darklaf/ui/optionpane/DarkOptionPaneUI.java
  63. 3
      core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/DarkPopupMenuBorder.java
  64. 20
      core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/DarkPopupMenuUI.java
  65. 9
      core/src/main/java/com/github/weisj/darklaf/ui/progressbar/DarkProgressBarUI.java
  66. 2
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java
  67. 12
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkSubstanceRootLayout.java
  68. 22
      core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarListener.java
  69. 6
      core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollPaneUI.java
  70. 4
      core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/ScrollBarUtil.java
  71. 16
      core/src/main/java/com/github/weisj/darklaf/ui/slider/DarkSliderUI.java
  72. 10
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerBorder.java
  73. 2
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java
  74. 4
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/SpinnerConstants.java
  75. 14
      core/src/main/java/com/github/weisj/darklaf/ui/splitpane/DarkSplitPaneDivider.java
  76. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkHandler.java
  77. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabPanel.java
  78. 9
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkScrollableTabSupport.java
  79. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabAreaButton.java
  80. 10
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneLayout.java
  81. 17
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneScrollLayout.java
  82. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUI.java
  83. 40
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java
  84. 5
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/MoreTabsButton.java
  85. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/NewTabButton.java
  86. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/ScrollableTabPanel.java
  87. 6
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/ScrollableTabSupport.java
  88. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/ScrollableTabViewport.java
  89. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneHandler.java
  90. 14
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneLayout.java
  91. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneScrollLayout.java
  92. 27
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneTransferHandler.java
  93. 10
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneUtil.java
  94. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkPanelPopupUI.java
  95. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameComponentPopupMenu.java
  96. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java
  97. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameUI.java
  98. 4
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabDragListener.java
  99. 17
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameLayout.java
  100. 13
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/TabFrameTransferHandler.java
  101. Some files were not shown because too many files have changed in this diff Show More

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

@ -207,7 +207,7 @@ public class DarkLaf extends BasicLookAndFeel {
// (Alloy license problem)
installCutCopyPasteShortcuts(tableInputMap, true);
}
final InputMap buttonInputMap = (InputMap) defaults.get("Button.focusInputMap");
final InputMap buttonInputMap = (InputMap) defaults.get("Button.focusInputMap");
if (buttonInputMap != null && !SystemInfo.isMac) {
buttonInputMap.put(KeyStroke.getKeyStroke("ENTER"), "pressed");
buttonInputMap.put(KeyStroke.getKeyStroke("released ENTER"), "released");
@ -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);
}

53
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();
}
}
@ -171,9 +175,9 @@ public final class LafManager {
UIManager.setLookAndFeel(DarkLaf.class.getCanonicalName());
updateLaf();
} catch (final ClassNotFoundException
| InstantiationException
| IllegalAccessException
| UnsupportedLookAndFeelException e) {
| InstantiationException
| IllegalAccessException
| UnsupportedLookAndFeelException 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

28
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,19 +76,6 @@ public class ClosableTabComponent extends JPanel {
protected static class TabButton extends JButton implements ActionListener {
private final ClosableTabComponent tabComponent;
private final MouseListener mouseListener = new MouseAdapter() {
@Override
public void mouseEntered(final MouseEvent e) {
ComponentUI ui = tabComponent.pane.getUI();
if (ui instanceof DarkTabbedPaneUI) {
int i = tabComponent.pane.indexOfTabComponent(tabComponent);
if (i != -1) {
((DarkTabbedPaneUI) ui).setRolloverTab(i);
tabComponent.pane.repaint();
}
}
}
};
protected TabButton(final ClosableTabComponent tabComponent) {
this.tabComponent = tabComponent;
@ -99,6 +86,19 @@ public class ClosableTabComponent extends JPanel {
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();
if (ui instanceof DarkTabbedPaneUI) {
int i = tabComponent.pane.indexOfTabComponent(tabComponent);
if (i != -1) {
((DarkTabbedPaneUI) ui).setRolloverTab(i);
tabComponent.pane.repaint();
}
}
}
};
addMouseListener(mouseListener);
}

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

@ -106,8 +106,8 @@ public abstract class ColorPipetteBase implements ColorPipette, AWTEventListener
Window picker = getOrCreatePickerWindow();
Toolkit.getDefaultToolkit().addAWTEventListener(this,
AWTEvent.MOUSE_MOTION_EVENT_MASK
| AWTEvent.MOUSE_EVENT_MASK
| AWTEvent.KEY_EVENT_MASK);
| AWTEvent.MOUSE_EVENT_MASK
| AWTEvent.KEY_EVENT_MASK);
updateLocation();
picker.setVisible(true);
return picker;

12
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;
@ -213,8 +209,8 @@ public class DefaultColorPipette extends ColorPipetteBase {
if (pipette.isKeyDown() && pipette.getPressedKeyCode() == KeyEvent.VK_SHIFT) {
Shape oldCLip = g.getClip();
Ellipse2D.Float circ = new Ellipse2D.Float(icon.getIconWidth() - 4, 2,
getWidth() - icon.getIconWidth() - 2 + 4,
getHeight() - 2 - icon.getIconHeight() + 4);
getWidth() - icon.getIconWidth() - 2 + 4,
getHeight() - 2 - icon.getIconHeight() + 4);
g.setClip(circ);
g.drawImage(pipette.zoomImage, icon.getIconWidth() - 4, 2, null);
g.setClip(oldCLip);

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/OverlayScrollPane.java

@ -286,11 +286,11 @@ public class OverlayScrollPane extends JLayeredPane {
@Override
public boolean contains(final int x, final int y) {
if (scrollPane.horizontalScrollBar.isVisible()
&& scrollPane.horizontalScrollBar.getBounds().contains(x, y)) {
&& scrollPane.horizontalScrollBar.getBounds().contains(x, y)) {
return true;
}
return scrollPane.verticalScrollBar.isVisible()
&& scrollPane.verticalScrollBar.getBounds().contains(x, y);
&& scrollPane.verticalScrollBar.getBounds().contains(x, y);
}

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

@ -83,8 +83,8 @@ public class ScrollPopupMenu extends JPopupMenu {
view = new JPanel(new BorderLayout());
view.add(this, BorderLayout.CENTER);
OverlayScrollPane overlayScrollPane =
new OverlayScrollPane(view, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
new OverlayScrollPane(view, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
JScrollBar bar = overlayScrollPane.getVerticalScrollBar();
bar.putClientProperty("JScrollBar.thin", Boolean.TRUE);
DarkUIUtil.doNotCancelPopupSetup(bar);

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<>());

27
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);
@ -166,8 +167,8 @@ public class DropShadowBorder implements Border, Serializable {
if (showLeftShadow) {
assert topLeftShadowPoint != null && bottomLeftShadowPoint != null;
Rectangle leftShadowRect =
new Rectangle(x, topLeftShadowPoint.y + shadowSize, shadowSize,
bottomLeftShadowPoint.y - topLeftShadowPoint.y - shadowSize);
new Rectangle(x, topLeftShadowPoint.y + shadowSize, shadowSize,
bottomLeftShadowPoint.y - topLeftShadowPoint.y - shadowSize);
g2.drawImage(images[Position.LEFT.ordinal()],
leftShadowRect.x, leftShadowRect.y,
leftShadowRect.width, leftShadowRect.height, null);
@ -176,9 +177,9 @@ public class DropShadowBorder implements Border, Serializable {
if (showBottomShadow) {
assert bottomLeftShadowPoint != null && bottomRightShadowPoint != null;
Rectangle bottomShadowRect =
new Rectangle(bottomLeftShadowPoint.x + shadowSize, y + height - shadowSize,
bottomRightShadowPoint.x - bottomLeftShadowPoint.x - shadowSize,
shadowSize);
new Rectangle(bottomLeftShadowPoint.x + shadowSize, y + height - shadowSize,
bottomRightShadowPoint.x - bottomLeftShadowPoint.x - shadowSize,
shadowSize);
g2.drawImage(images[Position.BOTTOM.ordinal()],
bottomShadowRect.x, bottomShadowRect.y,
bottomShadowRect.width, bottomShadowRect.height, null);
@ -187,8 +188,8 @@ public class DropShadowBorder implements Border, Serializable {
if (showRightShadow) {
assert topRightShadowPoint != null && bottomRightShadowPoint != null;
Rectangle rightShadowRect =
new Rectangle(x + width - shadowSize, topRightShadowPoint.y + shadowSize, shadowSize,
bottomRightShadowPoint.y - topRightShadowPoint.y - shadowSize);
new Rectangle(x + width - shadowSize, topRightShadowPoint.y + shadowSize, shadowSize,
bottomRightShadowPoint.y - topRightShadowPoint.y - shadowSize);
g2.drawImage(images[Position.RIGHT.ordinal()],
rightShadowRect.x, rightShadowRect.y,
rightShadowRect.width, rightShadowRect.height, null);
@ -197,8 +198,8 @@ public class DropShadowBorder implements Border, Serializable {
if (showTopShadow) {
assert topLeftShadowPoint != null && topRightShadowPoint != null;
Rectangle topShadowRect =
new Rectangle(topLeftShadowPoint.x + shadowSize, y,
topRightShadowPoint.x - topLeftShadowPoint.x - shadowSize, shadowSize);
new Rectangle(topLeftShadowPoint.x + shadowSize, y,
topRightShadowPoint.x - topLeftShadowPoint.x - shadowSize, shadowSize);
g2.drawImage(images[Position.TOP.ordinal()],
topShadowRect.x, topShadowRect.y,
topShadowRect.width, topShadowRect.height, null);
@ -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));
}
/**

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

@ -122,7 +122,7 @@ public class PanelPopup extends JPanel implements TabFramePopup {
@Override
public void close() {
if (parent != null && getAlignment() != null && getIndex() >= 0
&& parent.isSelected(getAlignment(), getIndex())) {
&& parent.isSelected(getAlignment(), getIndex())) {
boolean oldOpen = isOpen();
parent.closeTab(getAlignment(), getIndex());
open = false;
@ -166,7 +166,7 @@ public class PanelPopup extends JPanel implements TabFramePopup {
@Override
public void open() {
if (parent != null && getAlignment() != null && getIndex() >= 0
&& !parent.isSelected(getAlignment(), getIndex())) {
&& !parent.isSelected(getAlignment(), getIndex())) {
boolean oldOpen = isOpen();
parent.openTab(getAlignment(), getIndex());
open = true;

64
core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java

@ -189,59 +189,59 @@ public class TabFrameContentPane extends JPanel implements TabFrameContent {
switch (a) {
case NORTH:
changeStatus(
enabled, Alignment.NORTH_EAST,
topSplit, topSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 1.0, 0.0, 0.0),
new LayoutWeights(0.0, 0.0, 0.0, 1.0));
enabled, Alignment.NORTH_EAST,
topSplit, topSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 1.0, 0.0, 0.0),
new LayoutWeights(0.0, 0.0, 0.0, 1.0));
break;
case NORTH_EAST:
changeStatus(
enabled, Alignment.NORTH,
topSplit, topSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 0.0, 0.0, 1.0),
new LayoutWeights(0.0, 0.0, 1.0, 0.0));
enabled, Alignment.NORTH,
topSplit, topSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 0.0, 0.0, 1.0),
new LayoutWeights(0.0, 0.0, 1.0, 0.0));
break;
case EAST:
changeStatus(
enabled, Alignment.SOUTH_EAST,
rightSplit, rightSplitter,
new LayoutProportions(HORIZONTAL_PROP_RIGHT, 1.0, 1.0, 0.0),
new LayoutWeights(1.0, 1.0, 0.0, 1.0));
enabled, Alignment.SOUTH_EAST,
rightSplit, rightSplitter,
new LayoutProportions(HORIZONTAL_PROP_RIGHT, 1.0, 1.0, 0.0),
new LayoutWeights(1.0, 1.0, 0.0, 1.0));
break;
case SOUTH_EAST:
changeStatus(
enabled, Alignment.EAST,
rightSplit, rightSplitter,
new LayoutProportions(HORIZONTAL_PROP_RIGHT, 0.0, 1.0, 1.0),
new LayoutWeights(1.0, 1.0, 1.0, 0.0));
enabled, Alignment.EAST,
rightSplit, rightSplitter,
new LayoutProportions(HORIZONTAL_PROP_RIGHT, 0.0, 1.0, 1.0),
new LayoutWeights(1.0, 1.0, 1.0, 0.0));
break;
case NORTH_WEST:
changeStatus(
enabled, Alignment.WEST,
leftSplit, leftSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 1.0, 0.0, 0.0),
new LayoutWeights(0.0, 0.0, 0.0, 1.0));
enabled, Alignment.WEST,
leftSplit, leftSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 1.0, 0.0, 0.0),
new LayoutWeights(0.0, 0.0, 0.0, 1.0));
break;
case WEST:
changeStatus(
enabled, Alignment.NORTH_WEST,
leftSplit, leftSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 0.0, 0.0, 1.0),
new LayoutWeights(0.0, 0.0, 1.0, 0.0));
enabled, Alignment.NORTH_WEST,
leftSplit, leftSplitter,
new LayoutProportions(VERTICAL_PROP_TOP, 0.0, 0.0, 1.0),
new LayoutWeights(0.0, 0.0, 1.0, 0.0));
break;
case SOUTH_WEST:
changeStatus(
enabled, Alignment.SOUTH,
bottomSplit, bottomSplitter,
new LayoutProportions(VERTICAL_PROP_BOTTOM, 1.0, 1.0, 0.0),
new LayoutWeights(1.0, 1.0, 0.0, 1.0));
enabled, Alignment.SOUTH,
bottomSplit, bottomSplitter,
new LayoutProportions(VERTICAL_PROP_BOTTOM, 1.0, 1.0, 0.0),
new LayoutWeights(1.0, 1.0, 0.0, 1.0));
break;
case SOUTH:
changeStatus(
enabled, Alignment.SOUTH_WEST,
bottomSplit, bottomSplitter,
new LayoutProportions(VERTICAL_PROP_BOTTOM, 0.0, 1.0, 1.0),
new LayoutWeights(1.0, 1.0, 1.0, 0.0));
enabled, Alignment.SOUTH_WEST,
bottomSplit, bottomSplitter,
new LayoutProportions(VERTICAL_PROP_BOTTOM, 0.0, 1.0, 1.0),
new LayoutWeights(1.0, 1.0, 1.0, 0.0));
break;
case CENTER:
break;

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

@ -66,7 +66,7 @@ public interface TabFramePopup {
*/
default void close() {
if (getTabFrame() != null && getAlignment() != null && getIndex() >= 0
&& getTabFrame().isSelected(getAlignment(), getIndex())) {
&& getTabFrame().isSelected(getAlignment(), getIndex())) {
getTabFrame().closeTab(getAlignment(), getIndex());
}
}
@ -119,7 +119,7 @@ public interface TabFramePopup {
*/
default void open() {
if (getTabFrame() != null && getAlignment() != null && getIndex() >= 0
&& !getTabFrame().isSelected(getAlignment(), getIndex())) {
&& !getTabFrame().isSelected(getAlignment(), getIndex())) {
getTabFrame().closeTab(getAlignment(), getIndex());
}
}

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

@ -108,9 +108,9 @@ public class ToggleSplitPane extends JSplitPane {
public void forceSetDividerLocation(final double proportionalLocation) {
if (proportionalLocation < 0.0 ||
proportionalLocation > 1.0) {
proportionalLocation > 1.0) {
throw new IllegalArgumentException("proportional location must "
+ "be between 0.0 and 1.0.");
+ "be between 0.0 and 1.0.");
}
if (getOrientation() == VERTICAL_SPLIT) {
super.setDividerLocation((int) ((double) (getHeight()) * proportionalLocation));

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

13
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);
}
@ -303,7 +304,7 @@ public class ToolTipContext {
/**
* Create a new tooltip context to ease the creation of custom tooltips.
*
* @param target the component which the tooltip belongs to.
* @param target the component which the tooltip belongs to.
* @param alignment {@link #setAlignment(Alignment)}
* @param alignmentStrategy {@link #setAlignmentStrategy(AlignmentStrategy)}
* @param alignInside {@link #setAlignInside(boolean)}
@ -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

7
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);
}
@ -74,8 +75,8 @@ public final class Decorations {
public static boolean isCustomDecorationSupported() {
return decorationsProvider.isCustomDecorationSupported()
&& LafManager.isDecorationsEnabled()
&& LafManager.getTheme().useCustomDecorations();
&& LafManager.isDecorationsEnabled()
&& LafManager.getTheme().useCustomDecorations();
}
public static void initialize() {

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

@ -48,12 +48,12 @@ import java.util.logging.Logger;
public abstract class Theme {
private static final Logger LOGGER = Logger.getLogger(Theme.class.getName());
private static final String[] UI_PROPERTIES = new String[]{
"borders", "button", "checkBox", "colorChooser", "comboBox", "fileChooser", "tristate",
"internalFrame", "label", "list", "menu", "menuBar", "menuItem", "numberingPane", "optionPane", "panel",
"popupMenu", "progressBar", "radioButton", "rootPane", "scrollBar", "scrollPane", "separator",
"slider", "spinner", "splitPane", "statusBar", "tabbedPane", "tabFrame", "table", "taskPane", "text",
"toggleButton", "toolBar", "toolTip", "tree",
};
"borders", "button", "checkBox", "colorChooser", "comboBox", "fileChooser", "tristate",
"internalFrame", "label", "list", "menu", "menuBar", "menuItem", "numberingPane", "optionPane", "panel",
"popupMenu", "progressBar", "radioButton", "rootPane", "scrollBar", "scrollPane", "separator",
"slider", "spinner", "splitPane", "statusBar", "tabbedPane", "tabFrame", "table", "taskPane", "text",
"toggleButton", "toolBar", "toolTip", "tree",
};
private static final String[] ICON_PROPERTIES = new String[]{
"control", "dialog", "files", "frame", "indicator", "menu", "misc", "navigation"
};
@ -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;
}
}

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

@ -40,7 +40,7 @@ public class DarkPopupFactory extends PopupFactory {
boolean isMediumWeight = popup.getClass().getSimpleName().endsWith("MediumWeightPopup");
boolean isLightWeight = popup.getClass().getSimpleName().endsWith("LightWeightPopup");
boolean isBalloonTooltip = contents instanceof JToolTip
&& ((JToolTip) contents).getBorder() instanceof DarkTooltipBorder;
&& ((JToolTip) contents).getBorder() instanceof DarkTooltipBorder;
boolean isPopupMenu = contents instanceof JPopupMenu;
if (isMediumWeight || isLightWeight) {
if (isBalloonTooltip) {

15
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
@ -71,7 +72,7 @@ public class DragRecognitionSupport {
component = (JComponent) me.getSource();
if (mapDragOperationFromModifiers(me, component.getTransferHandler())
!= TransferHandler.NONE) {
!= TransferHandler.NONE) {
motionThreshold = DragSource.getDragThreshold();
dndArmedEvent = me;
@ -96,7 +97,7 @@ public class DragRecognitionSupport {
// }
DragRecognitionSupport support = (DragRecognitionSupport)
UIManager.get("sharedInstance.dragRecognitionSupport");
UIManager.get("sharedInstance.dragRecognitionSupport");
if (support == null) {
support = new DragRecognitionSupport();
UIManager.put("sharedInstance.dragRecognitionSupport", support);
@ -112,8 +113,8 @@ public class DragRecognitionSupport {
}
// PENDING JW: c'p from SunDragSourceContextPeer
return SwingXUtilities.
convertModifiersToDropAction(me.getModifiersEx(),
th.getSourceActions(component));
convertModifiersToDropAction(me.getModifiersEx(),
th.getSourceActions(component));
}
private void clearState() {
@ -125,12 +126,12 @@ public class DragRecognitionSupport {
* If a dnd recognition has been going on, return the MouseEvent that started the recognition. Otherwise, return
* null.
*
* @param me the MouseEvent.
* @param me the MouseEvent.
* @return true if mouse has been released.
*/
public static MouseEvent mouseReleased(final MouseEvent me) {
return getDragRecognitionSupport().
mouseReleasedImpl(me);
mouseReleasedImpl(me);
}
/**

12
core/src/main/java/com/github/weisj/darklaf/ui/button/ButtonConstants.java

@ -48,17 +48,17 @@ public interface ButtonConstants {
static boolean chooseAlternativeArc(final Component c) {
return c instanceof AbstractButton
&& Boolean.TRUE.equals(((AbstractButton) c).getClientProperty(KEY_ALT_ARC));
&& Boolean.TRUE.equals(((AbstractButton) c).getClientProperty(KEY_ALT_ARC));
}
static boolean isLabelButton(final Component c) {
return c instanceof AbstractButton
&& VARIANT_ONLY_LABEL.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
&& VARIANT_ONLY_LABEL.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
}
static boolean isNoArc(final Component c) {
return c instanceof AbstractButton
&& Boolean.TRUE.equals(((AbstractButton) c).getClientProperty(KEY_NO_ARC));
&& Boolean.TRUE.equals(((AbstractButton) c).getClientProperty(KEY_NO_ARC));
}
static boolean isSquare(final Component c) {
@ -84,7 +84,7 @@ public interface ButtonConstants {
static boolean isFullShadow(final Component c) {
return c instanceof AbstractButton
&& VARIANT_FULL_SHADOW.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
&& VARIANT_FULL_SHADOW.equals(((AbstractButton) c).getClientProperty(KEY_VARIANT));
}
static boolean doConvertToShadow(final AbstractButton b) {
@ -93,8 +93,8 @@ public interface ButtonConstants {
static boolean convertIconButtonToShadow(final AbstractButton b) {
return !(b instanceof UIResource)
&& UIManager.getBoolean("Button.convertIconOnlyToShadow")
&& !Boolean.TRUE.equals(b.getClientProperty(KEY_NO_SHADOW_OVERWRITE));
&& UIManager.getBoolean("Button.convertIconOnlyToShadow")
&& !Boolean.TRUE.equals(b.getClientProperty(KEY_NO_SHADOW_OVERWRITE));
}
static boolean isIconOnly(final AbstractButton b) {

40
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;
@ -94,13 +94,13 @@ public class DarkButtonBorder implements Border, UIResource {
public static boolean showDropShadow(final AlignmentExt a) {
return a == null
|| a == AlignmentExt.SOUTH
|| a == AlignmentExt.SOUTH_EAST
|| a == AlignmentExt.SOUTH_WEST
|| a == AlignmentExt.LEFT
|| a == AlignmentExt.RIGHT
|| a == AlignmentExt.BOTTOM
|| a == AlignmentExt.MIDDLE_HORIZONTAL;
|| a == AlignmentExt.SOUTH
|| a == AlignmentExt.SOUTH_EAST
|| a == AlignmentExt.SOUTH_WEST
|| a == AlignmentExt.LEFT
|| a == AlignmentExt.RIGHT
|| a == AlignmentExt.BOTTOM
|| a == AlignmentExt.MIDDLE_HORIZONTAL;
}
protected int getArc(final Component c) {
@ -275,7 +275,7 @@ public class DarkButtonBorder implements Border, UIResource {
Insets pad = ButtonConstants.isThin(c) ? square ? squareThinInsets
: thinInsets
: square ? squareInsets
: insets;
: insets;
return maskInsets(new InsetsUIResource(pad.top, pad.left, pad.bottom, pad.right), c, shadow);
}

2
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java

@ -317,7 +317,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
boolean defaultButton = ButtonConstants.isDefaultButton(c);
AbstractButton b = (AbstractButton) c;
boolean rollOver = (b.isRolloverEnabled() || ButtonConstants.doConvertToShadow(b))
&& (((JButton) c).getModel().isRollover());
&& (((JButton) c).getModel().isRollover());
boolean clicked = b.getModel().isArmed();
if (c.isEnabled()) {
if (defaultButton) {

14
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;
@ -42,7 +42,7 @@ import java.awt.*;
* @author Jannis Weis
*/
public class DarkCellRendererToggleButton<T extends JToggleButton & CellEditorToggleButton>
implements TableCellRenderer, TreeCellRenderer, SwingConstants {
implements TableCellRenderer, TreeCellRenderer, SwingConstants {
private final T toggleButton;
@ -62,13 +62,13 @@ public class DarkCellRendererToggleButton<T extends JToggleButton & CellEditorTo
toggleButton.setHasFocus(focus);
boolean isLeadSelectionCell = DarkUIUtil.hasFocus(table)
&& focus && !DarkTableCellFocusBorder.isRowFocusBorder(table);
&& focus && !DarkTableCellFocusBorder.isRowFocusBorder(table);
boolean paintSelected = isSelected && !isLeadSelectionCell && !table.isEditing();
CellUtil.setupForeground(toggleButton, table, paintSelected,
"Table.selectionForeground","Table.selectionForegroundInactive");
CellUtil.setupBackground(toggleButton, table, paintSelected, row,DarkTableUI.KEY_ALTERNATE_ROW_COLOR,
"Table.background","Table.alternateRowBackground");
"Table.selectionForeground", "Table.selectionForegroundInactive");
CellUtil.setupBackground(toggleButton, table, paintSelected, row, DarkTableUI.KEY_ALTERNATE_ROW_COLOR,
"Table.background", "Table.alternateRowBackground");
return toggleButton;
}
@ -89,7 +89,7 @@ public class DarkCellRendererToggleButton<T extends JToggleButton & CellEditorTo
toggleButton.setHasFocus(false);
CellUtil.setupForeground(toggleButton, tree, selected,
"Tree.selectionForeground","Tree.selectionForegroundInactive");
"Tree.selectionForeground", "Tree.selectionForegroundInactive");
return toggleButton;
}

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() {

4
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/ColorValueFormatter.java

@ -43,7 +43,7 @@ import static java.util.Locale.ENGLISH;
* @author Jannis Weis
*/
public final class ColorValueFormatter extends JFormattedTextField.AbstractFormatter implements FocusListener,
ActionListener {
ActionListener {
private final int fieldIndex;
private final int radix;
@ -68,7 +68,7 @@ public final class ColorValueFormatter extends JFormattedTextField.AbstractForma
public void insertString(final FilterBypass fb, final int offset,
final String text, final AttributeSet set) throws BadLocationException {
if (isValid(fb.getDocument().getLength() + text.length())
&& isValid(text)) {
&& isValid(text)) {
StringBuilder newText = new StringBuilder(fb.getDocument().getText(0, fb.getDocument().getLength()));
newText.insert(offset, text);
if (hex || isValidValue(newText.toString())) {

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

@ -162,7 +162,7 @@ public class ColorWheel extends JComponent {
if (myImage == null) {
myImage = createImage(new ColorWheelImageProducer(
_size - BORDER_SIZE * 2, _size - BORDER_SIZE * 2, myBrightness));
_size - BORDER_SIZE * 2, _size - BORDER_SIZE * 2, myBrightness));
myWheel = new Rectangle(BORDER_SIZE, BORDER_SIZE, _size - BORDER_SIZE * 2,
_size - BORDER_SIZE * 2);
}

6
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;
@ -76,8 +76,8 @@ public class ColorWheelImageProducer extends MemoryImageSource {
int index = x + y * myWidth;
mySat[index] = (float) Math.sqrt(squarekx + ky
* ky)
/ radius;
* ky)
/ radius;
if (mySat[index] <= 1f) {
myAlphas[index] = 0xff000000;
} else {

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

@ -49,7 +49,7 @@ import java.awt.event.KeyEvent;
public class DarkColorChooserPanel extends AbstractColorChooserPanel implements ColorListener {
public static final String TRANSPARENCY_ENABLED_PROPERTY
= "TransparencyEnabled";
= "TransparencyEnabled";
private final ColorPipette pipette;
private final ColorWheelPanel colorWheelPanel;
@ -275,12 +275,13 @@ public class DarkColorChooserPanel extends AbstractColorChooserPanel implements
int alpha = isColorTransparencySelectionEnabled()
? Integer.valueOf(hexStr.substring(6, 8), 16) : 255;
Color c = new Color(
Integer.valueOf(hexStr.substring(0, 2), 16),
Integer.valueOf(hexStr.substring(2, 4), 16),
Integer.valueOf(hexStr.substring(4, 6), 16),
alpha);
Integer.valueOf(hexStr.substring(0, 2), 16),
Integer.valueOf(hexStr.substring(2, 4), 16),
Integer.valueOf(hexStr.substring(4, 6), 16),
alpha);
colorWheelPanel.setColor(c, textHex);
} catch (NumberFormatException | IndexOutOfBoundsException ignore) {}
} catch (NumberFormatException | IndexOutOfBoundsException ignore) {
}
}
});
}

10
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/DarkColorChooserUI.java

@ -80,12 +80,12 @@ public class DarkColorChooserUI extends BasicColorChooserUI {
@Override
protected AbstractColorChooserPanel[] createDefaultChoosers() {
return new AbstractColorChooserPanel[]{
new DarkColorChooserPanel(new DarkColorModel(),
new DarkColorModelHSL(),
new DarkColorChooserPanel(new DarkColorModel(),
new DarkColorModelHSL(),
// new DarkColorModelHSB(),
new DarkColorModelCMYK()),
new DarkSwatchesChooserPanel(),
};
new DarkColorModelCMYK()),
new DarkSwatchesChooserPanel(),
};
}
@Override

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;
/**

902
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/MainSwatchPanel.java

@ -50,456 +50,456 @@ class MainSwatchPanel extends SwatchPanel {
private int[] initRawValues() {
return new int[]{
0, 0, 0,
31, 0, 0,
31, 6, 0,
31, 12, 0,
31, 18, 0,
31, 24, 0,
31, 31, 0,
24, 31, 0,
18, 31, 0,
12, 31, 0,
6, 31, 0,
0, 31, 0,
0, 31, 6,
0, 31, 12,
0, 31, 18,
0, 31, 24,
0, 31, 31,
0, 24, 31,
0, 18, 31,
0, 12, 31,
0, 6, 31,
0, 0, 31,
6, 0, 31,
12, 0, 31,
18, 0, 31,
24, 0, 31,
31, 0, 31,
31, 0, 24,
31, 0, 18,
31, 0, 12,
18, 18, 18,
61, 0, 0,
61, 12, 0,
61, 24, 0,
61, 37, 0,
61, 49, 0,
61, 61, 0,
49, 61, 0,
37, 61, 0,
24, 61, 0,
12, 61, 0,
0, 61, 0,
0, 61, 12,
0, 61, 24,
0, 61, 37,
0, 61, 49,
0, 61, 61,
0, 49, 61,
0, 37, 61,
0, 24, 61,
0, 12, 61,
0, 0, 61,
11, 0, 61,
24, 0, 61,
37, 0, 61,
49, 0, 61,
61, 0, 61,
61, 0, 49,
61, 0, 37,
61, 0, 24,
36, 36, 36,
92, 0, 0,
92, 18, 0,
92, 37, 0,
92, 55, 0,
92, 73, 0,
92, 92, 0,
73, 92, 0,
55, 92, 0,
37, 92, 0,
18, 92, 0,
0, 92, 0,
0, 92, 18,
0, 92, 37,
0, 92, 55,
0, 92, 73,
0, 92, 92,
0, 73, 92,
0, 55, 92,
0, 37, 92,
0, 18, 92,
0, 0, 92,
17, 0, 92,
37, 0, 92,
55, 0, 92,
73, 0, 92,
92, 0, 92,
92, 0, 73,
92, 0, 55,
92, 0, 37,
54, 54, 54,
128, 0, 0,
128, 26, 0,
128, 51, 0,
128, 77, 0,
128, 102, 0,
128, 128, 0,
102, 128, 0,
77, 128, 0,
51, 128, 0,
26, 128, 0,
0, 128, 0,
0, 128, 25,
0, 128, 51,
0, 128, 77,
0, 128, 102,
0, 128, 128,
0, 102, 128,
0, 77, 128,
0, 51, 128,
0, 26, 128,
0, 0, 128,
23, 0, 128,
51, 0, 128,
77, 0, 128,
102, 0, 128,
128, 0, 128,
128, 0, 102,
128, 0, 76,
128, 0, 51,
72, 72, 72,
158, 0, 0,
158, 32, 0,
158, 63, 0,
158, 95, 0,
158, 126, 0,
158, 158, 0,
126, 158, 0,
95, 158, 0,
63, 158, 0,
32, 158, 0,
0, 158, 0,
0, 158, 32,
0, 158, 63,
0, 158, 95,
0, 158, 126,
0, 158, 158,
0, 126, 158,
0, 95, 158,
0, 63, 158,
0, 32, 158,
0, 0, 158,
29, 0, 158,
63, 0, 158,
95, 0, 158,
126, 0, 158,
158, 0, 158,
158, 0, 126,
158, 0, 95,
158, 0, 63,
91, 91, 91,
189, 0, 0,
189, 38, 0,
189, 75, 0,
189, 113, 0,
189, 151, 0,
189, 189, 0,
151, 189, 0,
113, 189, 0,
75, 189, 0,
38, 189, 0,
0, 189, 0,
0, 189, 38,
0, 189, 75,
0, 189, 113,
0, 189, 151,
0, 189, 189,
0, 151, 189,
0, 113, 189,
0, 75, 189,
0, 38, 189,
0, 0, 189,
35, 0, 189,
75, 0, 189,
113, 0, 189,
151, 0, 189,
189, 0, 189,
189, 0, 151,
189, 0, 113,
189, 0, 75,
109, 109, 109,
219, 0, 0,
219, 44, 0,
219, 88, 0,
219, 132, 0,
219, 175, 0,
219, 219, 0,
175, 219, 0,
132, 219, 0,
88, 219, 0,
44, 219, 0,
0, 219, 0,
0, 219, 44,
0, 219, 88,
0, 219, 132,
0, 219, 175,
0, 219, 219,
0, 175, 219,
0, 132, 219,
0, 88, 219,
0, 44, 219,
0, 0, 219,
40, 0, 219,
88, 0, 219,
132, 0, 219,
175, 0, 219,
219, 0, 219,
219, 0, 175,
219, 0, 132,
219, 0, 88,
127, 127, 127,
255, 0, 0,
255, 51, 0,
255, 102, 0,
255, 153, 0,
255, 204, 0,
255, 255, 0,
204, 255, 0,
153, 255, 0,
102, 255, 0,
51, 255, 0,
0, 255, 0,
0, 255, 51,
0, 255, 102,
0, 255, 153,
0, 255, 204,
0, 255, 255,
0, 204, 255,
0, 153, 255,
0, 102, 255,
0, 51, 255,
0, 0, 255,
47, 0, 255,
102, 0, 255,
153, 0, 255,
204, 0, 255,
255, 0, 255,
255, 0, 204,
255, 0, 153,
255, 0, 102,
145, 145, 145,
255, 31, 31,
255, 75, 31,
255, 120, 31,
255, 165, 31,
255, 210, 31,
255, 255, 31,
210, 255, 31,
165, 255, 31,
120, 255, 31,
75, 255, 31,
31, 255, 31,
31, 255, 75,
31, 255, 120,
31, 255, 165,
31, 255, 210,
31, 255, 255,
31, 210, 255,
31, 165, 255,
31, 120, 255,
31, 75, 255,
31, 31, 255,
72, 31, 255,
120, 31, 255,
165, 31, 255,
210, 31, 255,
255, 31, 255,
255, 31, 210,
255, 31, 165,
255, 31, 120,
163, 163, 163,
255, 61, 61,
255, 100, 61,
255, 139, 61,
255, 177, 61,
255, 216, 61,
255, 255, 61,
216, 255, 61,
177, 255, 61,
139, 255, 61,
100, 255, 61,
61, 255, 61,
61, 255, 100,
61, 255, 139,
61, 255, 177,
61, 255, 216,
61, 255, 255,
61, 216, 255,
61, 177, 255,
61, 139, 255,
61, 100, 255,
61, 61, 255,
97, 61, 255,
139, 61, 255,
177, 61, 255,
216, 61, 255,
255, 61, 255,
255, 61, 216,
255, 61, 177,
255, 61, 139,
182, 182, 182,
255, 92, 92,
255, 124, 92,
255, 157, 92,
255, 190, 92,
255, 222, 92,
255, 255, 92,
222, 255, 92,
190, 255, 92,
157, 255, 92,
124, 255, 92,
92, 255, 92,
92, 255, 124,
92, 255, 157,
92, 255, 190,
92, 255, 222,
92, 255, 255,
92, 222, 255,
92, 190, 255,
92, 157, 255,
92, 124, 255,
92, 92, 255,
122, 92, 255,
157, 92, 255,
190, 92, 255,
222, 92, 255,
255, 92, 255,
255, 92, 222,
255, 92, 190,
255, 92, 157,
200, 200, 200,
255, 128, 128,
255, 153, 128,
255, 179, 128,
255, 204, 128,
255, 230, 128,
255, 255, 128,
229, 255, 128,
204, 255, 128,
179, 255, 128,
153, 255, 128,
128, 255, 128,
128, 255, 153,
128, 255, 179,
128, 255, 204,
128, 255, 229,
128, 255, 255,
128, 229, 255,
128, 204, 255,
128, 179, 255,
128, 153, 255,
128, 128, 255,
151, 128, 255,
178, 128, 255,
204, 128, 255,
230, 128, 255,
255, 128, 255,
255, 128, 229,
255, 128, 204,
255, 128, 179,
218, 218, 218,
255, 158, 158,
255, 177, 158,
255, 197, 158,
255, 216, 158,
255, 236, 158,
255, 255, 158,
236, 255, 158,
216, 255, 158,
197, 255, 158,
177, 255, 158,
158, 255, 158,
158, 255, 177,
158, 255, 197,
158, 255, 216,
158, 255, 236,
158, 255, 255,
158, 236, 255,
158, 216, 255,
158, 197, 255,
158, 177, 255,
158, 158, 255,
176, 158, 255,
197, 158, 255,
216, 158, 255,
236, 158, 255,
255, 158, 255,
255, 158, 236,
255, 158, 216,
255, 158, 197,
236, 236, 236,
255, 189, 189,
255, 202, 189,
255, 215, 189,
255, 228, 189,
255, 242, 189,
255, 255, 189,
242, 255, 189,
228, 255, 189,
215, 255, 189,
202, 255, 189,
189, 255, 189,
189, 255, 202,
189, 255, 215,
189, 255, 228,
189, 255, 242,
189, 255, 255,
189, 242, 255,
189, 228, 255,
189, 215, 255,
189, 202, 255,
189, 189, 255,
201, 189, 255,
215, 189, 255,
228, 189, 255,
242, 189, 255,
255, 189, 255,
255, 189, 242,
255, 189, 228,
255, 189, 215,
255, 255, 255,
255, 219, 219,
255, 226, 219,
255, 234, 219,
255, 241, 219,
255, 248, 219,
255, 255, 219,
248, 255, 219,
241, 255, 219,
234, 255, 219,
226, 255, 219,
219, 255, 219,
219, 255, 226,
219, 255, 234,
219, 255, 241,
219, 255, 248,
219, 255, 255,
219, 248, 255,
219, 241, 255,
219, 234, 255,
219, 226, 255,
219, 219, 255,
226, 219, 255,
234, 219, 255,
241, 219, 255,
248, 219, 255,
255, 219, 255,
255, 219, 248,
255, 219, 241,
255, 219, 234,
};
0, 0, 0,
31, 0, 0,
31, 6, 0,
31, 12, 0,
31, 18, 0,
31, 24, 0,
31, 31, 0,
24, 31, 0,
18, 31, 0,
12, 31, 0,
6, 31, 0,
0, 31, 0,
0, 31, 6,
0, 31, 12,
0, 31, 18,
0, 31, 24,
0, 31, 31,
0, 24, 31,
0, 18, 31,
0, 12, 31,
0, 6, 31,
0, 0, 31,
6, 0, 31,
12, 0, 31,
18, 0, 31,
24, 0, 31,
31, 0, 31,
31, 0, 24,
31, 0, 18,
31, 0, 12,
18, 18, 18,
61, 0, 0,
61, 12, 0,
61, 24, 0,
61, 37, 0,
61, 49, 0,
61, 61, 0,
49, 61, 0,
37, 61, 0,
24, 61, 0,
12, 61, 0,
0, 61, 0,
0, 61, 12,
0, 61, 24,
0, 61, 37,
0, 61, 49,
0, 61, 61,
0, 49, 61,
0, 37, 61,
0, 24, 61,
0, 12, 61,
0, 0, 61,
11, 0, 61,
24, 0, 61,
37, 0, 61,
49, 0, 61,
61, 0, 61,
61, 0, 49,
61, 0, 37,
61, 0, 24,
36, 36, 36,
92, 0, 0,
92, 18, 0,
92, 37, 0,
92, 55, 0,
92, 73, 0,
92, 92, 0,
73, 92, 0,
55, 92, 0,
37, 92, 0,
18, 92, 0,
0, 92, 0,
0, 92, 18,
0, 92, 37,
0, 92, 55,
0, 92, 73,
0, 92, 92,
0, 73, 92,
0, 55, 92,
0, 37, 92,
0, 18, 92,
0, 0, 92,
17, 0, 92,
37, 0, 92,
55, 0, 92,
73, 0, 92,
92, 0, 92,
92, 0, 73,
92, 0, 55,
92, 0, 37,
54, 54, 54,
128, 0, 0,
128, 26, 0,
128, 51, 0,
128, 77, 0,
128, 102, 0,
128, 128, 0,
102, 128, 0,
77, 128, 0,
51, 128, 0,
26, 128, 0,
0, 128, 0,
0, 128, 25,
0, 128, 51,
0, 128, 77,
0, 128, 102,
0, 128, 128,
0, 102, 128,
0, 77, 128,
0, 51, 128,
0, 26, 128,
0, 0, 128,
23, 0, 128,
51, 0, 128,
77, 0, 128,
102, 0, 128,
128, 0, 128,
128, 0, 102,
128, 0, 76,
128, 0, 51,
72, 72, 72,
158, 0, 0,
158, 32, 0,
158, 63, 0,
158, 95, 0,
158, 126, 0,
158, 158, 0,
126, 158, 0,
95, 158, 0,
63, 158, 0,
32, 158, 0,
0, 158, 0,
0, 158, 32,
0, 158, 63,
0, 158, 95,
0, 158, 126,
0, 158, 158,
0, 126, 158,
0, 95, 158,
0, 63, 158,
0, 32, 158,
0, 0, 158,
29, 0, 158,
63, 0, 158,
95, 0, 158,
126, 0, 158,
158, 0, 158,
158, 0, 126,
158, 0, 95,
158, 0, 63,
91, 91, 91,
189, 0, 0,
189, 38, 0,
189, 75, 0,
189, 113, 0,
189, 151, 0,
189, 189, 0,
151, 189, 0,
113, 189, 0,
75, 189, 0,
38, 189, 0,
0, 189, 0,
0, 189, 38,
0, 189, 75,
0, 189, 113,
0, 189, 151,
0, 189, 189,
0, 151, 189,
0, 113, 189,
0, 75, 189,
0, 38, 189,
0, 0, 189,
35, 0, 189,
75, 0, 189,
113, 0, 189,
151, 0, 189,
189, 0, 189,
189, 0, 151,
189, 0, 113,
189, 0, 75,
109, 109, 109,
219, 0, 0,
219, 44, 0,
219, 88, 0,
219, 132, 0,
219, 175, 0,
219, 219, 0,
175, 219, 0,
132, 219, 0,
88, 219, 0,
44, 219, 0,
0, 219, 0,
0, 219, 44,
0, 219, 88,
0, 219, 132,
0, 219, 175,
0, 219, 219,
0, 175, 219,
0, 132, 219,
0, 88, 219,
0, 44, 219,
0, 0, 219,
40, 0, 219,
88, 0, 219,
132, 0, 219,
175, 0, 219,
219, 0, 219,
219, 0, 175,
219, 0, 132,
219, 0, 88,
127, 127, 127,
255, 0, 0,
255, 51, 0,
255, 102, 0,
255, 153, 0,
255, 204, 0,
255, 255, 0,
204, 255, 0,
153, 255, 0,
102, 255, 0,
51, 255, 0,
0, 255, 0,
0, 255, 51,
0, 255, 102,
0, 255, 153,
0, 255, 204,
0, 255, 255,
0, 204, 255,
0, 153, 255,
0, 102, 255,
0, 51, 255,
0, 0, 255,
47, 0, 255,
102, 0, 255,
153, 0, 255,
204, 0, 255,
255, 0, 255,
255, 0, 204,
255, 0, 153,
255, 0, 102,
145, 145, 145,
255, 31, 31,
255, 75, 31,
255, 120, 31,
255, 165, 31,
255, 210, 31,
255, 255, 31,
210, 255, 31,
165, 255, 31,
120, 255, 31,
75, 255, 31,
31, 255, 31,
31, 255, 75,
31, 255, 120,
31, 255, 165,
31, 255, 210,
31, 255, 255,
31, 210, 255,
31, 165, 255,
31, 120, 255,
31, 75, 255,
31, 31, 255,
72, 31, 255,
120, 31, 255,
165, 31, 255,
210, 31, 255,
255, 31, 255,
255, 31, 210,
255, 31, 165,
255, 31, 120,
163, 163, 163,
255, 61, 61,
255, 100, 61,
255, 139, 61,
255, 177, 61,
255, 216, 61,
255, 255, 61,
216, 255, 61,
177, 255, 61,
139, 255, 61,
100, 255, 61,
61, 255, 61,
61, 255, 100,
61, 255, 139,
61, 255, 177,
61, 255, 216,
61, 255, 255,
61, 216, 255,
61, 177, 255,
61, 139, 255,
61, 100, 255,
61, 61, 255,
97, 61, 255,
139, 61, 255,
177, 61, 255,
216, 61, 255,
255, 61, 255,
255, 61, 216,
255, 61, 177,
255, 61, 139,
182, 182, 182,
255, 92, 92,
255, 124, 92,
255, 157, 92,
255, 190, 92,
255, 222, 92,
255, 255, 92,
222, 255, 92,
190, 255, 92,
157, 255, 92,
124, 255, 92,
92, 255, 92,
92, 255, 124,
92, 255, 157,
92, 255, 190,
92, 255, 222,
92, 255, 255,
92, 222, 255,
92, 190, 255,
92, 157, 255,
92, 124, 255,
92, 92, 255,
122, 92, 255,
157, 92, 255,
190, 92, 255,
222, 92, 255,
255, 92, 255,
255, 92, 222,
255, 92, 190,
255, 92, 157,
200, 200, 200,
255, 128, 128,
255, 153, 128,
255, 179, 128,
255, 204, 128,
255, 230, 128,
255, 255, 128,
229, 255, 128,
204, 255, 128,
179, 255, 128,
153, 255, 128,
128, 255, 128,
128, 255, 153,
128, 255, 179,
128, 255, 204,
128, 255, 229,
128, 255, 255,
128, 229, 255,
128, 204, 255,
128, 179, 255,
128, 153, 255,
128, 128, 255,
151, 128, 255,
178, 128, 255,
204, 128, 255,
230, 128, 255,
255, 128, 255,
255, 128, 229,
255, 128, 204,
255, 128, 179,
218, 218, 218,
255, 158, 158,
255, 177, 158,
255, 197, 158,
255, 216, 158,
255, 236, 158,
255, 255, 158,
236, 255, 158,
216, 255, 158,
197, 255, 158,
177, 255, 158,
158, 255, 158,
158, 255, 177,
158, 255, 197,
158, 255, 216,
158, 255, 236,
158, 255, 255,
158, 236, 255,
158, 216, 255,
158, 197, 255,
158, 177, 255,
158, 158, 255,
176, 158, 255,
197, 158, 255,
216, 158, 255,
236, 158, 255,
255, 158, 255,
255, 158, 236,
255, 158, 216,
255, 158, 197,
236, 236, 236,
255, 189, 189,
255, 202, 189,
255, 215, 189,
255, 228, 189,
255, 242, 189,
255, 255, 189,
242, 255, 189,
228, 255, 189,
215, 255, 189,
202, 255, 189,
189, 255, 189,
189, 255, 202,
189, 255, 215,
189, 255, 228,
189, 255, 242,
189, 255, 255,
189, 242, 255,
189, 228, 255,
189, 215, 255,
189, 202, 255,
189, 189, 255,
201, 189, 255,
215, 189, 255,
228, 189, 255,
242, 189, 255,
255, 189, 255,
255, 189, 242,
255, 189, 228,
255, 189, 215,
255, 255, 255,
255, 219, 219,
255, 226, 219,
255, 234, 219,
255, 241, 219,
255, 248, 219,
255, 255, 219,
248, 255, 219,
241, 255, 219,
234, 255, 219,
226, 255, 219,
219, 255, 219,
219, 255, 226,
219, 255, 234,
219, 255, 241,
219, 255, 248,
219, 255, 255,
219, 248, 255,
219, 241, 255,
219, 234, 255,
219, 226, 255,
219, 219, 255,
226, 219, 255,
234, 219, 255,
241, 219, 255,
248, 219, 255,
255, 219, 255,
255, 219, 248,
255, 219, 241,
255, 219, 234,
};
}
}

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;

10
core/src/main/java/com/github/weisj/darklaf/ui/colorchooser/SwatchPanel.java

@ -42,9 +42,9 @@ abstract class SwatchPanel extends JPanel {
protected Dimension numSwatches;
protected Dimension gap;
private final ToolTipContext toolTipContext = new ToolTipContext(this)
.setAlignment(Alignment.CENTER)
.setToolTipRectSupplier(this::getSwatchBounds)
.setHideOnExit(true);
.setAlignment(Alignment.CENTER)
.setToolTipRectSupplier(this::getSwatchBounds)
.setHideOnExit(true);
private int selRow;
private int selCol;
@ -86,14 +86,14 @@ abstract class SwatchPanel extends JPanel {
selCol--;
repaint();
} else if (selCol < numSwatches.width - 1
&& !SwatchPanel.this.getComponentOrientation().isLeftToRight()) {
&& !SwatchPanel.this.getComponentOrientation().isLeftToRight()) {
selCol++;
repaint();
}
break;
case KeyEvent.VK_RIGHT:
if (selCol < numSwatches.width - 1
&& SwatchPanel.this.getComponentOrientation().isLeftToRight()) {
&& SwatchPanel.this.getComponentOrientation().isLeftToRight()) {
selCol++;
repaint();
} else if (selCol > 0 && !SwatchPanel.this.getComponentOrientation().isLeftToRight()) {

4
core/src/main/java/com/github/weisj/darklaf/ui/combobox/ComboBoxConstants.java

@ -36,11 +36,11 @@ public interface ComboBoxConstants {
static boolean isTreeCellEditor(final Component c) {
return c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TREE_EDITOR));
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TREE_EDITOR));
}
static boolean isTableCellEditor(final Component c) {
return c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TABLE_EDITOR));
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TABLE_EDITOR));
}
}

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;

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

@ -265,7 +265,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
int buttonWidth = squareButton
? buttonHeight
: arrowButton.getPreferredSize().width
+ arrowButton.getInsets().left + arrowButton.getInsets().right;
+ arrowButton.getInsets().left + arrowButton.getInsets().right;
//adjust the size based on the button width
size.height += insets.top + insets.bottom;
size.width += insets.left + insets.right + buttonWidth;

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) {

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

@ -145,7 +145,7 @@ public class DarkFileChooserUI extends DarkFileChooserUIBridge {
}
}
}
);
);
if (fileChooser.isMultiSelectionEnabled()) {
setFileName(fileNameString(fileChooser.getSelectedFiles()));
} else {

85
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;
@ -273,7 +273,7 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
File f = (File) e.getNewValue();
JFileChooser fc = getFileChooser();
if (f != null
&& ((fc.isFileSelectionEnabled() && !f.isDirectory())
&& ((fc.isFileSelectionEnabled() && !f.isDirectory())
|| (f.isDirectory() && fc.isDirectorySelectionEnabled()))) {
setFileName(fileNameString(f));
@ -284,8 +284,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
File[] files = (File[]) e.getNewValue();
JFileChooser fc = getFileChooser();
if (files != null
&& files.length > 0
&& (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) {
&& files.length > 0
&& (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) {
setFileName(fileNameString(files));
}
}
@ -322,9 +322,9 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
JFileChooser fc = getFileChooser();
File currentDirectory = fc.getCurrentDirectory();
if (currentDirectory != null
&& fc.isDirectorySelectionEnabled()
&& !fc.isFileSelectionEnabled()
&& fc.getFileSystemView().isFileSystem(currentDirectory)) {
&& fc.isDirectorySelectionEnabled()
&& !fc.isFileSelectionEnabled()
&& fc.getFileSystemView().isFileSystem(currentDirectory)) {
setFileName(currentDirectory.getPath());
} else {
@ -545,8 +545,8 @@ public abstract class DarkFileChooserUIBridge extends BasicFileChooserUI {
} else {
JFileChooser fc = getFileChooser();
if ((fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) ||
(fc.isDirectorySelectionEnabled() && fc.isFileSelectionEnabled()
&& fc.getFileSystemView().isFileSystemRoot(file))) {
(fc.isDirectorySelectionEnabled() && fc.isFileSelectionEnabled()
&& fc.getFileSystemView().isFileSystemRoot(file))) {
return file.getPath();
} else {
return file.getName();
@ -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,13 +724,13 @@ 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);
}
return new Dimension(extraWidth + numChildren * maxWidth +
(numChildren - 1) * hGap,
(numChildren - 1) * hGap,
extraHeight + height);
}
}
@ -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,16 +836,16 @@ 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 {
}
//
// Renderer for DirectoryComboBox
//
@SuppressWarnings("serial")
// Superclass is not serializable across versions
// 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;

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

@ -194,7 +194,7 @@ public class DarkFilePane extends DarkFilePaneUIBridge {
detailsTable.setFont(font);
TableCellRenderer headerRenderer =
new AlignableTableHeaderRenderer(detailsTable.getTableHeader().getDefaultRenderer());
new AlignableTableHeaderRenderer(detailsTable.getTableHeader().getDefaultRenderer());
detailsTable.getTableHeader().setDefaultRenderer(headerRenderer);
TableCellRenderer cellRenderer = new DetailsTableCellRenderer(chooser);
detailsTable.setDefaultRenderer(Object.class, cellRenderer);
@ -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;
}
@ -446,9 +446,9 @@ public class DarkFilePane extends DarkFilePaneUIBridge {
// For single click, we handle editing file name
if (evt.getClickCount() == 1 && source instanceof JList) {
if ((!fc.isMultiSelectionEnabled() || fc.getSelectedFiles().length <= 1)
&& listSelectionModel.isSelectedIndex(index)
&& getEditIndex() == index && editFile == null
&& DarkUIUtil.isOverText(evt, index, list)) {
&& listSelectionModel.isSelectedIndex(index)
&& getEditIndex() == index && editFile == null
&& DarkUIUtil.isOverText(evt, index, list)) {
editFileName(index);
} else {
setEditIndex(index);

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

@ -80,10 +80,10 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
public static final int VIEWTYPE_DETAILS = 1;
protected static final int VIEWTYPE_COUNT = 2;
protected static final Cursor waitCursor =
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
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() {
@ -184,7 +184,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
int rowCount = model.getSize();
if (detailsTable == null || rowCount == 0 ||
e.isAltDown() || e.isControlDown() || e.isMetaDown()) {
e.isAltDown() || e.isControlDown() || e.isMetaDown()) {
return;
}
@ -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() {
@ -458,17 +460,17 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
UIDefaults metal = MetalUIDefaults.DEFAULTS;
viewMenuLabelText =
metal.getString("FileChooser.viewMenuLabelText", l);
metal.getString("FileChooser.viewMenuLabelText", l);
refreshActionLabelText =
metal.getString("FileChooser.refreshActionLabelText", l);
metal.getString("FileChooser.refreshActionLabelText", l);
newFolderActionLabelText =
metal.getString("FileChooser.newFolderActionLabelText", l);
metal.getString("FileChooser.newFolderActionLabelText", l);
viewTypeActionNames = new String[VIEWTYPE_COUNT];
viewTypeActionNames[VIEWTYPE_LIST] =
metal.getString("FileChooser.listViewActionLabelText", l);
metal.getString("FileChooser.listViewActionLabelText", l);
viewTypeActionNames[VIEWTYPE_DETAILS] =
metal.getString("FileChooser.detailsViewActionLabelText", l);
metal.getString("FileChooser.detailsViewActionLabelText", l);
kiloByteString = UIManager.getString("FileChooser.fileSizeKiloBytes", l);
megaByteString = UIManager.getString("FileChooser.fileSizeMegaBytes", l);
@ -491,7 +493,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
public Action[] getActions() {
if (actions == null) {
@SuppressWarnings("serial")
// JDK-implementation class
// JDK-implementation class
class FilePaneAction extends AbstractAction {
FilePaneAction(final String name) {
this(name, name);
@ -515,8 +517,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
JFileChooser fc = getFileChooser();
int index = listSelectionModel.getMinSelectionIndex();
if (index >= 0 && editFile == null &&
(!fc.isMultiSelectionEnabled() ||
fc.getSelectedFiles().length <= 1)) {
(!fc.isMultiSelectionEnabled() ||
fc.getSelectedFiles().length <= 1)) {
editFileName(index);
}
@ -622,7 +624,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// Install cell editor for editing file name
if (!readOnly && columnModel.getColumnCount() > COLUMN_FILENAME) {
columnModel.getColumn(COLUMN_FILENAME).
setCellEditor(getDetailsTableCellEditor());
setCellEditor(getDetailsTableCellEditor());
}
table.setColumnModel(columnModel);
@ -785,7 +787,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// Remove files that shouldn't be selected and add files which should be selected
// Note: Assume files are already sorted in compareTo order.
while (shouldIndex < files.length &&
actuallyIndex < selectedObjects.length) {
actuallyIndex < selectedObjects.length) {
int comparison = files[shouldIndex].compareTo((File) selectedObjects[actuallyIndex]);
if (comparison < 0) {
doSelectFile(files[shouldIndex++]);
@ -810,7 +812,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// restore the anchor and lead
if (listSelectionModel instanceof DefaultListSelectionModel) {
((DefaultListSelectionModel) listSelectionModel).
moveLeadSelectionIndex(lead);
moveLeadSelectionIndex(lead);
listSelectionModel.setAnchorSelectionIndex(anchor);
}
} finally {
@ -846,7 +848,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
protected void doDeselectFile(final Object fileToDeselect) {
int index = getRowSorter().convertRowIndexToView(
getModel().indexOf(fileToDeselect));
getModel().indexOf(fileToDeselect));
listSelectionModel.removeSelectionInterval(index, index);
}
@ -855,7 +857,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
File f = (File) e.getNewValue();
JFileChooser fc = getFileChooser();
if (f != null
&& ((fc.isFileSelectionEnabled() && !f.isDirectory())
&& ((fc.isFileSelectionEnabled() && !f.isDirectory())
|| (f.isDirectory() && fc.isDirectorySelectionEnabled()))) {
setFileSelected();
@ -867,8 +869,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
File[] files = (File[]) e.getNewValue();
JFileChooser fc = getFileChooser();
if (files != null
&& files.length > 0
&& (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) {
&& files.length > 0
&& (files.length > 1 || fc.isDirectorySelectionEnabled() || !files[0].isDirectory())) {
setFileSelected();
}
}
@ -926,32 +928,42 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
}
String s = e.getPropertyName();
if (s.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) {
doSelectedFileChanged(e);
} else if (s.equals(JFileChooser.SELECTED_FILES_CHANGED_PROPERTY)) {
doSelectedFilesChanged(e);
} else if (s.equals(JFileChooser.DIRECTORY_CHANGED_PROPERTY)) {
doDirectoryChanged(e);
} else if (s.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
doFilterChanged(e);
} else if (s.equals(JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY)) {
doFileSelectionModeChanged(e);
} else if (s.equals(JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) {
doMultiSelectionChanged(e);
} else if (s.equals(JFileChooser.CANCEL_SELECTION)) {
applyEdit();
} else if (s.equals("busy")) {
setCursor((Boolean) e.getNewValue() ? waitCursor : null);
} else if (s.equals(PropertyKey.COMPONENT_ORIENTATION)) {
ComponentOrientation o = (ComponentOrientation) e.getNewValue();
JFileChooser cc = (JFileChooser) e.getSource();
if (o != e.getOldValue()) {
cc.applyComponentOrientation(o);
}
if (detailsTable != null) {
detailsTable.setComponentOrientation(o);
detailsTable.getParent().getParent().setComponentOrientation(o);
}
switch (s) {
case JFileChooser.SELECTED_FILE_CHANGED_PROPERTY:
doSelectedFileChanged(e);
break;
case JFileChooser.SELECTED_FILES_CHANGED_PROPERTY:
doSelectedFilesChanged(e);
break;
case JFileChooser.DIRECTORY_CHANGED_PROPERTY:
doDirectoryChanged(e);
break;
case JFileChooser.FILE_FILTER_CHANGED_PROPERTY:
doFilterChanged(e);
break;
case JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY:
doFileSelectionModeChanged(e);
break;
case JFileChooser.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY:
doMultiSelectionChanged(e);
break;
case JFileChooser.CANCEL_SELECTION:
applyEdit();
break;
case "busy":
setCursor((Boolean) e.getNewValue() ? waitCursor : null);
break;
case PropertyKey.COMPONENT_ORIENTATION:
ComponentOrientation o = (ComponentOrientation) e.getNewValue();
JFileChooser cc = (JFileChooser) e.getSource();
if (o != e.getOldValue()) {
cc.applyComponentOrientation(o);
}
if (detailsTable != null) {
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]);
@ -1106,7 +1118,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
*/
@SuppressWarnings("serial") // JDK-implementation class
protected class SortableListModel extends AbstractListModel<Object>
implements TableModelListener, RowSorterListener {
implements TableModelListener, RowSorterListener {
public SortableListModel() {
getDetailsTableModel().addTableModelListener(this);
@ -1132,10 +1144,10 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
}
@SuppressWarnings("serial")
// JDK-implementation class
// 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) {
@ -1390,9 +1404,9 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
}
if (detailsTableModel.getColumns()[column].isCompareByColumn()) {
return comparator.compare(
getDetailsTableModel().getFileColumnValue(f1, column),
getDetailsTableModel().getFileColumnValue(f2, column)
);
getDetailsTableModel().getFileColumnValue(f1, column),
getDetailsTableModel().getFileColumnValue(f2, column)
);
}
// For this column we need to pass the file itself (not a
// column value) to the 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;
@ -1441,7 +1455,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
final int row, final int column) {
if ((table.convertColumnIndexToModel(column) != COLUMN_FILENAME ||
(listViewWindowsStyle && !table.isFocusOwner())) && !fullRowSelection) {
(listViewWindowsStyle && !table.isFocusOwner())) && !fullRowSelection) {
isSelected = false;
}
@ -1502,18 +1516,18 @@ 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;
}
public Component getTableCellRendererComponent(
final JTable table, final Object value, final boolean isSelected,
final boolean hasFocus, final int row, final int column) {
final JTable table, final Object value, final boolean isSelected,
final boolean hasFocus, final int row, final int column) {
Component c = wrappedRenderer.getTableCellRendererComponent(
table, value, isSelected, hasFocus, row, column);
table, value, isSelected, hasFocus, row, column);
int modelColumn = table.convertColumnIndexToModel(column);
ShellFolderColumnInfo columnInfo = detailsTableModel.getColumns()[modelColumn];
@ -1548,7 +1562,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
setFileSelected();
if (editFile != null) {
editFileName(getRowSorter().convertRowIndexToView(
getModel().indexOf(editFile)));
getModel().indexOf(editFile)));
editFile = null;
}
}
@ -1606,8 +1620,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
index = table.rowAtPoint(p);
boolean pointOutsidePrefSize =
SwingUtilities2.pointOutsidePrefSize(
table, index, table.columnAtPoint(p), p);
SwingUtilities2.pointOutsidePrefSize(
table, index, table.columnAtPoint(p), p);
if (pointOutsidePrefSize && !fullRowSelection) {
return;
@ -1615,7 +1629,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// Translate point from table to list
if (index >= 0 && list != null &&
listSelectionModel.isSelectedIndex(index)) {
listSelectionModel.isSelectedIndex(index)) {
// Make a new event with the list as source, placing the
// click in the corresponding list cell.
@ -1642,8 +1656,8 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// For single click, we handle editing file name
if (evt.getClickCount() == 1 && source instanceof JList) {
if ((!fc.isMultiSelectionEnabled() || fc.getSelectedFiles().length <= 1)
&& listSelectionModel.isSelectedIndex(index)
&& getEditIndex() == index && editFile == null) {
&& listSelectionModel.isSelectedIndex(index)
&& getEditIndex() == index && editFile == null) {
editFileName(index);
} else {
@ -1717,7 +1731,7 @@ public abstract class DarkFilePaneUIBridge extends JPanel implements PropertyCha
// Lazy creation of Basic's listener
if (doubleClickListener == null && list != null) {
doubleClickListener =
fileChooserUIAccessor.createDoubleClickListener(list);
fileChooserUIAccessor.createDoubleClickListener(list);
}
return doubleClickListener;
}

2
core/src/main/java/com/github/weisj/darklaf/ui/html/DarkHTML.java

@ -67,7 +67,7 @@ public class DarkHTML extends BasicHTML {
rect = bounds.getBounds();
}
return rect.y + (int) (rect.height *
child.getAlignment(View.Y_AXIS));
child.getAlignment(View.Y_AXIS));
}
return getBaseline(child, bounds);
}

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();

12
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);
@ -107,10 +107,10 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener
final int textX, final int textY) {
int mnemIndex = l.getDisplayedMnemonicIndex();
boolean focus = DarkUIUtil.hasFocus(l)
|| DarkUIUtil.hasFocus(DarkUIUtil.getParentOfType(JTree.class, l))
|| DarkUIUtil.hasFocus(DarkUIUtil.getParentOfType(JTable.class, l))
|| DarkUIUtil.hasFocus(DarkUIUtil.getParentOfType(JList.class, l))
|| DarkUIUtil.getParentOfType(JPopupMenu.class, l) != null;
|| DarkUIUtil.hasFocus(DarkUIUtil.getParentOfType(JTree.class, l))
|| DarkUIUtil.hasFocus(DarkUIUtil.getParentOfType(JTable.class, l))
|| DarkUIUtil.hasFocus(DarkUIUtil.getParentOfType(JList.class, l))
|| DarkUIUtil.getParentOfType(JPopupMenu.class, l) != null;
if (DarkUIUtil.isInCell(l) && !focus) {
g.setColor(cellForegroundNoFocus);
} else {

4
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");
@ -44,4 +44,4 @@ public class DarkListCellFocusBorder extends DarkCellBorder {
g.setColor(borderColor);
DarkUIUtil.drawRect(g, 0, 0, width, height, 1);
}
}
}

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

@ -62,7 +62,7 @@ public class DarkListUIBridge extends BasicListUI {
* The constant BASELINE_COMPONENT_KEY.
*/
protected static final StringBuilder BASELINE_COMPONENT_KEY =
new StringBuilder("List.baselineComponent");
new StringBuilder("List.baselineComponent");
/**
* The bit relates to model changed property.
*/
@ -295,20 +295,19 @@ public class DarkListUIBridge extends BasicListUI {
* @param leadIndex a lead index
* @see #paint
*/
protected void paintCell(
final Graphics g,
final int row,
final Rectangle rowBounds,
final ListCellRenderer cellRenderer,
final ListModel dataModel,
final ListSelectionModel selModel,
final int leadIndex) {
protected void paintCell(final Graphics g,
final int row,
final Rectangle rowBounds,
final ListCellRenderer cellRenderer,
final ListModel dataModel,
final ListSelectionModel selModel,
final int leadIndex) {
Object value = dataModel.getElementAt(row);
boolean cellHasFocus = list.hasFocus() && (row == leadIndex);
boolean isSelected = selModel.isSelectedIndex(row);
Component rendererComponent =
cellRenderer.getListCellRendererComponent(list, value, row, isSelected, cellHasFocus);
cellRenderer.getListCellRendererComponent(list, value, row, isSelected, cellHasFocus);
int cx = rowBounds.x;
int cy = rowBounds.y;
@ -356,11 +355,10 @@ public class DarkListUIBridge extends BasicListUI {
int rowHeight = list.getFixedCellHeight();
UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();
Component renderer = (Component) lafDefaults.get(
BASELINE_COMPONENT_KEY);
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
@ -368,7 +366,7 @@ public class DarkListUIBridge extends BasicListUI {
lcr = new DefaultListCellRenderer();
}
renderer = lcr.getListCellRendererComponent(
list, "a", -1, false, false);
list, "a", -1, false, false);
lafDefaults.put(BASELINE_COMPONENT_KEY, renderer);
}
renderer.setFont(list.getFont());
@ -383,7 +381,7 @@ public class DarkListUIBridge extends BasicListUI {
rowHeight = renderer.getPreferredSize().height;
}
return renderer.getBaseline(Integer.MAX_VALUE, rowHeight) +
list.getInsets().top;
list.getInsets().top;
}
/**
@ -394,7 +392,7 @@ public class DarkListUIBridge extends BasicListUI {
* @since 1.6
*/
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
final JComponent c) {
final JComponent c) {
super.getBaselineResizeBehavior(c);
return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
@ -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();
@ -755,12 +753,12 @@ public class DarkListUIBridge extends BasicListUI {
InputMap getInputMap(final int condition) {
if (condition == JComponent.WHEN_FOCUSED) {
InputMap keyMap = (InputMap) DefaultLookup.get(
list, this, "List.focusInputMap");
list, this, "List.focusInputMap");
InputMap rtlKeyMap;
if (isLeftToRight ||
((rtlKeyMap = (InputMap) DefaultLookup.get(list, this,
"List.focusInputMap.RightToLeft")) == null)) {
((rtlKeyMap = (InputMap) DefaultLookup.get(list, this,
"List.focusInputMap.RightToLeft")) == null)) {
return keyMap;
} else {
rtlKeyMap.setParent(keyMap);
@ -1204,10 +1202,10 @@ public class DarkListUIBridge extends BasicListUI {
switch (layoutOrientation) {
case JList.VERTICAL_WRAP:
return Math.min(list.getModel().getSize() - 1, rowsPerColumn *
column + Math.min(row, rowsPerColumn - 1));
column + Math.min(row, rowsPerColumn - 1));
case JList.HORIZONTAL_WRAP:
return Math.min(list.getModel().getSize() - 1, row * columnCount +
column);
column);
default:
return row;
}
@ -1262,7 +1260,7 @@ public class DarkListUIBridge extends BasicListUI {
rowsPerColumn = visRows;
columnCount = Math.max(1, dataModelSize / rowsPerColumn);
if (dataModelSize > 0 && dataModelSize > rowsPerColumn &&
dataModelSize % rowsPerColumn != 0) {
dataModelSize % rowsPerColumn != 0) {
columnCount++;
}
if (layoutOrientation == JList.HORIZONTAL_WRAP) {
@ -1275,23 +1273,23 @@ public class DarkListUIBridge extends BasicListUI {
}
} else if (layoutOrientation == JList.VERTICAL_WRAP && height != 0) {
rowsPerColumn = Math.max(1, (listHeight - insets.top -
insets.bottom) / height);
insets.bottom) / height);
columnCount = Math.max(1, dataModelSize / rowsPerColumn);
if (dataModelSize > 0 && dataModelSize > rowsPerColumn &&
dataModelSize % rowsPerColumn != 0) {
dataModelSize % rowsPerColumn != 0) {
columnCount++;
}
} else if (layoutOrientation == JList.HORIZONTAL_WRAP && cellWidth > 0 &&
listWidth > 0) {
listWidth > 0) {
columnCount = Math.max(1, (listWidth - insets.left -
insets.right) / cellWidth);
insets.right) / cellWidth);
rowsPerColumn = dataModelSize / columnCount;
if (dataModelSize % columnCount > 0) {
rowsPerColumn++;
}
}
preferredHeight = rowsPerColumn * cellHeight + insets.top +
insets.bottom;
insets.bottom;
}
/**
@ -1336,11 +1334,11 @@ public class DarkListUIBridge extends BasicListUI {
startColumn = convertLocationToColumn(paintBounds.x,
paintBounds.y);
endColumn = convertLocationToColumn(paintBounds.x +
paintBounds.width,
paintBounds.width,
paintBounds.y);
} else {
startColumn = convertLocationToColumn(paintBounds.x +
paintBounds.width,
paintBounds.width,
paintBounds.y);
endColumn = convertLocationToColumn(paintBounds.x,
paintBounds.y);
@ -1364,7 +1362,7 @@ public class DarkListUIBridge extends BasicListUI {
return;
}
while (row < rowCount && rowBounds.y < maxY &&
index < size) {
index < size) {
rowBounds.height = getHeight(colCounter, row);
g.setClip(rowBounds.x, rowBounds.y, rowBounds.width,
rowBounds.height);
@ -1431,22 +1429,19 @@ public class DarkListUIBridge extends BasicListUI {
return -1;
}
if (layoutOrientation == JList.VERTICAL ||
(column == 0 && columnCount == 1)) {
(column == 0 && columnCount == 1)) {
return list.getModel().getSize();
}
if (column >= columnCount) {
return -1;
}
if (layoutOrientation == JList.VERTICAL_WRAP) {
if (column < (columnCount - 1)) {
return rowsPerColumn;
}
return list.getModel().getSize() - (columnCount - 1) *
rowsPerColumn;
rowsPerColumn;
}
// JList.HORIZONTAL_WRAP
int diff = columnCount - (columnCount * rowsPerColumn -
list.getModel().getSize());
list.getModel().getSize());
if (column >= diff) {
return Math.max(0, rowsPerColumn - 1);
@ -1527,7 +1522,7 @@ public class DarkListUIBridge extends BasicListUI {
if (index == size) {
decr = true;
} else if (index != 0 && convertModelToRow(index)
!= convertModelToRow(index - 1)) {
!= convertModelToRow(index - 1)) {
Rectangle prev = getCellBounds(list, index - 1);
Rectangle me = getCellBounds(list, index);
@ -1537,16 +1532,16 @@ public class DarkListUIBridge extends BasicListUI {
decr = Point2D.distance(prev.x + prev.width,
prev.y + (int) (prev.height / 2.0),
p.x, p.y)
< Point2D.distance(me.x,
me.y + (int) (me.height / 2.0),
p.x, p.y);
< Point2D.distance(me.x,
me.y + (int) (me.height / 2.0),
p.x, p.y);
} else {
decr = Point2D.distance(prev.x,
prev.y + (int) (prev.height / 2.0),
p.x, p.y)
< Point2D.distance(me.x + me.width,
me.y + (int) (prev.height / 2.0),
p.x, p.y);
< Point2D.distance(me.x + me.width,
me.y + (int) (prev.height / 2.0),
p.x, p.y);
}
}
@ -1578,7 +1573,7 @@ public class DarkListUIBridge extends BasicListUI {
rect = getCellBounds(list, index);
rect.y += rect.height;
} else if (index != 0 && convertModelToColumn(index)
!= convertModelToColumn(index - 1)) {
!= convertModelToColumn(index - 1)) {
Rectangle prev = getCellBounds(list, index - 1);
Rectangle me = getCellBounds(list, index);
@ -1586,9 +1581,9 @@ public class DarkListUIBridge extends BasicListUI {
if (Point2D.distance(prev.x + (int) (prev.width / 2.0),
prev.y + prev.height,
p.x, p.y)
< Point2D.distance(me.x + (int) (me.width / 2.0),
me.y,
p.x, p.y)) {
< Point2D.distance(me.x + (int) (me.width / 2.0),
me.y,
p.x, p.y)) {
index--;
rect = getCellBounds(list, index);
@ -1638,7 +1633,7 @@ public class DarkListUIBridge extends BasicListUI {
}
if (layoutOrientation != JList.VERTICAL && columnCount > 1 &&
rowsPerColumn > 0) {
rowsPerColumn > 0) {
if (layoutOrientation == JList.VERTICAL_WRAP) {
return index % rowsPerColumn;
}
@ -1713,7 +1708,7 @@ public class DarkListUIBridge extends BasicListUI {
}
if (layoutOrientation != JList.VERTICAL && rowsPerColumn > 0 &&
columnCount > 1) {
columnCount > 1) {
if (layoutOrientation == JList.VERTICAL_WRAP) {
return index / 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');
@ -1775,46 +1769,46 @@ public class DarkListUIBridge extends BasicListUI {
private static class Actions extends UIAction {
private static final String SELECT_PREVIOUS_COLUMN =
"selectPreviousColumn";
"selectPreviousColumn";
private static final String SELECT_PREVIOUS_COLUMN_EXTEND =
"selectPreviousColumnExtendSelection";
"selectPreviousColumnExtendSelection";
private static final String SELECT_PREVIOUS_COLUMN_CHANGE_LEAD =
"selectPreviousColumnChangeLead";
"selectPreviousColumnChangeLead";
private static final String SELECT_NEXT_COLUMN = "selectNextColumn";
private static final String SELECT_NEXT_COLUMN_EXTEND =
"selectNextColumnExtendSelection";
"selectNextColumnExtendSelection";
private static final String SELECT_NEXT_COLUMN_CHANGE_LEAD =
"selectNextColumnChangeLead";
"selectNextColumnChangeLead";
private static final String SELECT_PREVIOUS_ROW = "selectPreviousRow";
private static final String SELECT_PREVIOUS_ROW_EXTEND =
"selectPreviousRowExtendSelection";
"selectPreviousRowExtendSelection";
private static final String SELECT_PREVIOUS_ROW_CHANGE_LEAD =
"selectPreviousRowChangeLead";
"selectPreviousRowChangeLead";
private static final String SELECT_NEXT_ROW = "selectNextRow";
private static final String SELECT_NEXT_ROW_EXTEND =
"selectNextRowExtendSelection";
"selectNextRowExtendSelection";
private static final String SELECT_NEXT_ROW_CHANGE_LEAD =
"selectNextRowChangeLead";
"selectNextRowChangeLead";
private static final String SELECT_FIRST_ROW = "selectFirstRow";
private static final String SELECT_FIRST_ROW_EXTEND =
"selectFirstRowExtendSelection";
"selectFirstRowExtendSelection";
private static final String SELECT_FIRST_ROW_CHANGE_LEAD =
"selectFirstRowChangeLead";
"selectFirstRowChangeLead";
private static final String SELECT_LAST_ROW = "selectLastRow";
private static final String SELECT_LAST_ROW_EXTEND =
"selectLastRowExtendSelection";
"selectLastRowExtendSelection";
private static final String SELECT_LAST_ROW_CHANGE_LEAD =
"selectLastRowChangeLead";
"selectLastRowChangeLead";
private static final String SCROLL_UP = "scrollUp";
private static final String SCROLL_UP_EXTEND =
"scrollUpExtendSelection";
"scrollUpExtendSelection";
private static final String SCROLL_UP_CHANGE_LEAD =
"scrollUpChangeLead";
"scrollUpChangeLead";
private static final String SCROLL_DOWN = "scrollDown";
private static final String SCROLL_DOWN_EXTEND =
"scrollDownExtendSelection";
"scrollDownExtendSelection";
private static final String SCROLL_DOWN_CHANGE_LEAD =
"scrollDownChangeLead";
"scrollDownChangeLead";
private static final String SELECT_ALL = "selectAll";
private static final String CLEAR_SELECTION = "clearSelection";
@ -1920,7 +1914,7 @@ public class DarkListUIBridge extends BasicListUI {
clearSelection(list);
} else if (Objects.equals(name, ADD_TO_SELECTION)) {
int index = adjustIndex(
list.getSelectionModel().getLeadSelectionIndex(), list);
list.getSelectionModel().getLeadSelectionIndex(), list);
if (!list.isSelectedIndex(index)) {
int oldAnchor = list.getSelectionModel().getAnchorSelectionIndex();
@ -1931,7 +1925,7 @@ public class DarkListUIBridge extends BasicListUI {
}
} else if (Objects.equals(name, TOGGLE_AND_ANCHOR)) {
int index = adjustIndex(
list.getSelectionModel().getLeadSelectionIndex(), list);
list.getSelectionModel().getLeadSelectionIndex(), list);
if (list.isSelectedIndex(index)) {
list.removeSelectionInterval(index, index);
@ -1940,14 +1934,14 @@ public class DarkListUIBridge extends BasicListUI {
}
} else if (Objects.equals(name, EXTEND_TO)) {
changeSelection(
list, EXTEND_SELECTION,
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list),
0);
list, EXTEND_SELECTION,
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list),
0);
} else if (Objects.equals(name, MOVE_SELECTION_TO)) {
changeSelection(
list, CHANGE_SELECTION,
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list),
0);
list, CHANGE_SELECTION,
adjustIndex(list.getSelectionModel().getLeadSelectionIndex(), list),
0);
}
}
@ -1958,8 +1952,8 @@ public class DarkListUIBridge extends BasicListUI {
// CHANGE_LEAD is only valid with multiple interval selection
if (type == CHANGE_LEAD &&
list.getSelectionMode()
!= ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) {
list.getSelectionMode()
!= ListSelectionModel.MULTIPLE_INTERVAL_SELECTION) {
type = CHANGE_SELECTION;
}
@ -2056,13 +2050,13 @@ public class DarkListUIBridge extends BasicListUI {
ListSelectionModel lsm = list.getSelectionModel();
int lead = adjustIndex(lsm.getLeadSelectionIndex(), list);
Rectangle leadRect =
(lead == -1) ? new Rectangle() : list.getCellBounds(lead, lead);
(lead == -1) ? new Rectangle() : list.getCellBounds(lead, lead);
if (leadRect == null) {
return index;
}
if (list.getLayoutOrientation() == JList.VERTICAL_WRAP &&
list.getVisibleRowCount() <= 0) {
list.getVisibleRowCount() <= 0) {
if (!list.getComponentOrientation().isLeftToRight()) {
direction = -direction;
}
@ -2158,8 +2152,8 @@ public class DarkListUIBridge extends BasicListUI {
// go up one cell if last visible cell doesn't fit
// into visible rectangle
if (cellBounds != null &&
cellBounds.y + cellBounds.height >
visRect.y + visRect.height) {
cellBounds.y + cellBounds.height >
visRect.y + visRect.height) {
p.y = cellBounds.y - 1;
index = list.locationToIndex(p);
if (index == -1) {
@ -2182,8 +2176,8 @@ public class DarkListUIBridge extends BasicListUI {
// go one cell up if last visible cell doesn't fit
// into adjasted visible rectangle
if (cellBounds != null &&
cellBounds.y + cellBounds.height >
visRect.y + visRect.height) {
cellBounds.y + cellBounds.height >
visRect.y + visRect.height) {
p.y = cellBounds.y - 1;
index = list.locationToIndex(p);
if (index == -1) {
@ -2250,7 +2244,7 @@ public class DarkListUIBridge extends BasicListUI {
Rectangle visRect = list.getVisibleRect();
if (cellBounds != null && !visRect.contains(cellBounds)) {
if (list.getLayoutOrientation() == JList.VERTICAL_WRAP &&
list.getVisibleRowCount() <= 0) {
list.getVisibleRowCount() <= 0) {
// horizontal
if (list.getComponentOrientation().isLeftToRight()) {
if (direction > 0) {
@ -2258,17 +2252,17 @@ public class DarkListUIBridge extends BasicListUI {
int x = Math.max(0,
cellBounds.x + cellBounds.width - visRect.width);
int startIndex =
list.locationToIndex(new Point(x, cellBounds.y));
list.locationToIndex(new Point(x, cellBounds.y));
if (startIndex == -1) {
return;
}
Rectangle startRect = list.getCellBounds(startIndex,
startIndex);
if (startRect != null &&
startRect.x < x && startRect.x < cellBounds.x) {
startRect.x < x && startRect.x < cellBounds.x) {
startRect.x += startRect.width;
startIndex =
list.locationToIndex(startRect.getLocation());
list.locationToIndex(startRect.getLocation());
if (startIndex == -1) {
return;
}
@ -2285,7 +2279,7 @@ public class DarkListUIBridge extends BasicListUI {
// left for right-to-left
int x = cellBounds.x + visRect.width;
int rightIndex =
list.locationToIndex(new Point(x, cellBounds.y));
list.locationToIndex(new Point(x, cellBounds.y));
if (rightIndex == -1) {
return;
}
@ -2293,7 +2287,7 @@ public class DarkListUIBridge extends BasicListUI {
rightIndex);
if (rightRect != null) {
if (rightRect.x + rightRect.width > x &&
rightRect.x > cellBounds.x) {
rightRect.x > cellBounds.x) {
rightRect.width = 0;
}
cellBounds.x = Math.max(0,
@ -2311,29 +2305,29 @@ public class DarkListUIBridge extends BasicListUI {
} else {
// vertical
if (direction > 0 &&
(cellBounds.y < visRect.y ||
cellBounds.y + cellBounds.height
> visRect.y + visRect.height)) {
(cellBounds.y < visRect.y ||
cellBounds.y + cellBounds.height
> visRect.y + visRect.height)) {
//down
int y = Math.max(0,
cellBounds.y + cellBounds.height - visRect.height);
int startIndex =
list.locationToIndex(new Point(cellBounds.x, y));
list.locationToIndex(new Point(cellBounds.x, y));
if (startIndex == -1) {
return;
}
Rectangle startRect = list.getCellBounds(startIndex,
startIndex);
if (startRect != null &&
startRect.y < y && startRect.y < cellBounds.y) {
startRect.y < y && startRect.y < cellBounds.y) {
startRect.y += startRect.height;
startIndex =
list.locationToIndex(startRect.getLocation());
list.locationToIndex(startRect.getLocation());
if (startIndex == -1) {
return;
}
startRect =
list.getCellBounds(startIndex, startIndex);
list.getCellBounds(startIndex, startIndex);
}
cellBounds = startRect;
if (cellBounds != null) {
@ -2359,18 +2353,18 @@ public class DarkListUIBridge extends BasicListUI {
public boolean accept(final Object c) {
Object name = getName();
if (name == SELECT_PREVIOUS_COLUMN_CHANGE_LEAD ||
name == SELECT_NEXT_COLUMN_CHANGE_LEAD ||
name == SELECT_PREVIOUS_ROW_CHANGE_LEAD ||
name == SELECT_NEXT_ROW_CHANGE_LEAD ||
name == SELECT_FIRST_ROW_CHANGE_LEAD ||
name == SELECT_LAST_ROW_CHANGE_LEAD ||
name == SCROLL_UP_CHANGE_LEAD ||
name == SCROLL_DOWN_CHANGE_LEAD) {
name == SELECT_NEXT_COLUMN_CHANGE_LEAD ||
name == SELECT_PREVIOUS_ROW_CHANGE_LEAD ||
name == SELECT_NEXT_ROW_CHANGE_LEAD ||
name == SELECT_FIRST_ROW_CHANGE_LEAD ||
name == SELECT_LAST_ROW_CHANGE_LEAD ||
name == SCROLL_UP_CHANGE_LEAD ||
name == SCROLL_DOWN_CHANGE_LEAD) {
// discontinuous selection actions are only enabled for
// DefaultListSelectionModel
return c != null && ((JList) c).getSelectionModel()
instanceof DefaultListSelectionModel;
return c != null && ((JList<Object>) c).getSelectionModel()
instanceof DefaultListSelectionModel;
}
return true;
@ -2526,9 +2520,9 @@ public class DarkListUIBridge extends BasicListUI {
* The type Handler.
*/
protected class Handler implements FocusListener, KeyListener,
ListDataListener, ListSelectionListener,
MouseInputListener, PropertyChangeListener,
DragRecognitionSupport.BeforeDrag {
ListDataListener, ListSelectionListener,
MouseInputListener, PropertyChangeListener,
DragRecognitionSupport.BeforeDrag {
/**
* The Prefix.
*/
@ -2562,12 +2556,12 @@ 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() ||
DarkUIUtil.isMenuShortcutKeyDown(e) ||
isNavigationKey(e)) {
DarkUIUtil.isMenuShortcutKeyDown(e) ||
isNavigationKey(e)) {
// Nothing to select
return;
}
@ -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);
}
@ -2687,7 +2681,7 @@ public class DarkListUIBridge extends BasicListUI {
updateLayoutStateNeeded |= cellRendererChanged;
redrawList();
} else if (Objects.equals(propertyName, PropertyKey.FONT)
|| DarkSwingUtil.isScaleChanged(e)) {
|| DarkSwingUtil.isScaleChanged(e)) {
updateLayoutStateNeeded |= fontChanged;
redrawList();
} else if (Objects.equals(propertyName, "prototypeCellValue")) {
@ -2880,8 +2874,8 @@ public class DarkListUIBridge extends BasicListUI {
// If shift is down in multi-select, we should do nothing.
// For single select or non-shift-click, clear the selection
if (isFileList && e.getID() == MouseEvent.MOUSE_PRESSED &&
(!e.isShiftDown() ||
list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)) {
(!e.isShiftDown() ||
list.getSelectionMode() == ListSelectionModel.SINGLE_SELECTION)) {
list.clearSelection();
}
} else {

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");

24
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;
@ -79,7 +75,7 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
ButtonModel model = lh.getMenuItem().getModel();
if (model.isEnabled()) {
accRect.x = lh.getViewRect().x + lh.getViewRect().width
- lh.getMenuItem().getIconTextGap() - lr.getAccRect().width;
- lh.getMenuItem().getIconTextGap() - lr.getAccRect().width;
}
}
@ -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();
@ -123,7 +121,7 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
if (lh.getCheckIcon() != null) {
ButtonModel model = lh.getMenuItem().getModel();
if (model.isArmed() || (lh.getMenuItem() instanceof JMenu
&& model.isSelected())) {
&& model.isSelected())) {
g.setColor(foreground);
} else {
g.setColor(holdc);
@ -163,7 +161,7 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
} else {
// *** paint the accText normally
if (model.isArmed()
|| (lh.getMenuItem() instanceof JMenu
|| (lh.getMenuItem() instanceof JMenu
&& model.isSelected())) {
g.setColor(acceleratorSelectionForeground);
} else {
@ -171,7 +169,7 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
}
SwingUtilities2.drawString(lh.getMenuItem(), g, lh.getAccText(),
lr.getAccRect().x, lr.getAccRect().y +
lh.getAccFontMetrics().getAscent());
lh.getAccFontMetrics().getAscent());
}
}
config.restore();
@ -222,7 +220,7 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
if (lh.getArrowIcon() != null) {
ButtonModel model = lh.getMenuItem().getModel();
if (model.isArmed() || (lh.getMenuItem() instanceof JMenu
&& model.isSelected())) {
&& model.isSelected())) {
g.setColor(foreground);
}
if (lh.useCheckAndArrow()) {
@ -250,7 +248,7 @@ public class DarkMenuItemUIBase extends BasicMenuItemUI {
}
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
model.isSelected())) {
g.setColor(bgColor);
g.fillRect(0, 0, menuWidth, menuHeight);
g.setColor(oldColor);

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

@ -122,7 +122,7 @@ public class DarkMenuUI extends BasicMenuUI {
protected Icon getArrowIcon() {
boolean hover = menuItem.getModel().isArmed()
|| (menuItem instanceof JMenu && menuItem.getModel().isSelected());
|| (menuItem instanceof JMenu && menuItem.getModel().isSelected());
return hover ? arrowIconHover : arrowIcon;
}
@ -137,7 +137,7 @@ public class DarkMenuUI extends BasicMenuUI {
ButtonModel model = lh.getMenuItem().getModel();
if (model.isEnabled()) {
accRect.x = lh.getViewRect().x + lh.getViewRect().width
- lh.getMenuItem().getIconTextGap() - lr.getAccRect().width;
- lh.getMenuItem().getIconTextGap() - lr.getAccRect().width;
}
}
@ -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();
@ -181,7 +183,7 @@ public class DarkMenuUI extends BasicMenuUI {
if (lh.getCheckIcon() != null) {
ButtonModel model = lh.getMenuItem().getModel();
if (model.isArmed() || (lh.getMenuItem() instanceof JMenu
&& model.isSelected())) {
&& model.isSelected())) {
g.setColor(foreground);
} else {
g.setColor(holdc);
@ -221,7 +223,7 @@ public class DarkMenuUI extends BasicMenuUI {
} else {
// *** paint the accText normally
if (model.isArmed()
|| (lh.getMenuItem() instanceof JMenu
|| (lh.getMenuItem() instanceof JMenu
&& model.isSelected())) {
g.setColor(acceleratorSelectionForeground);
} else {
@ -229,7 +231,7 @@ public class DarkMenuUI extends BasicMenuUI {
}
SwingUtilities2.drawString(lh.getMenuItem(), g, lh.getAccText(),
lr.getAccRect().x, lr.getAccRect().y +
lh.getAccFontMetrics().getAscent());
lh.getAccFontMetrics().getAscent());
}
}
config.restore();
@ -280,7 +282,7 @@ public class DarkMenuUI extends BasicMenuUI {
if (lh.getArrowIcon() != null) {
ButtonModel model = lh.getMenuItem().getModel();
if (model.isArmed() || (lh.getMenuItem() instanceof JMenu
&& model.isSelected())) {
&& model.isSelected())) {
g.setColor(foreground);
}
if (lh.useCheckAndArrow()) {
@ -308,7 +310,7 @@ public class DarkMenuUI extends BasicMenuUI {
}
g.setColor(oldColor);
} else if (model.isArmed() || (menuItem instanceof JMenu &&
model.isSelected())) {
model.isSelected())) {
g.setColor(bgColor);
g.fillRect(0, 0, menuWidth, menuHeight);
g.setColor(oldColor);

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

@ -202,14 +202,16 @@ 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(),
root.getElement(endLine).getEndOffset());
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;
try {
@ -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) {

15
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();
@ -228,12 +223,12 @@ public class DarkOptionPaneUI extends BasicOptionPaneUI {
x = insets.left;
if (getSyncAllWidths()) {
xOffset = (container.getWidth() - insets.left -
insets.right - totalButtonWidth) /
(numChildren - 1) + maxWidth;
insets.right - totalButtonWidth) /
(numChildren - 1) + maxWidth;
} else {
xOffset = (container.getWidth() - insets.left -
insets.right - totalButtonWidth) /
(numChildren - 1);
insets.right - totalButtonWidth) /
(numChildren - 1);
}
}
break;
@ -280,7 +275,7 @@ public class DarkOptionPaneUI extends BasicOptionPaneUI {
maxWidth = Math.max(maxWidth, aSize.width);
}
return new Dimension(extraWidth + (maxWidth * numChildren) +
(numChildren - 1) * padding,
(numChildren - 1) * padding,
extraHeight + height);
} else {
int totalWidth = 0;

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);
}

20
core/src/main/java/com/github/weisj/darklaf/ui/popupmenu/DarkPopupMenuUI.java

@ -112,7 +112,7 @@ public class DarkPopupMenuUI extends BasicPopupMenuUI {
}
public static class MouseGrabber implements ChangeListener,
AWTEventListener, ComponentListener, WindowListener {
AWTEventListener, ComponentListener, WindowListener {
Window grabbedWindow;
MenuElement[] lastPathSelected;
@ -133,13 +133,13 @@ public class DarkPopupMenuUI extends BasicPopupMenuUI {
(PrivilegedAction<Object>) () -> {
tk.addAWTEventListener(MouseGrabber.this,
AWTEvent.MOUSE_EVENT_MASK
| AWTEvent.MOUSE_MOTION_EVENT_MASK
| AWTEvent.MOUSE_WHEEL_EVENT_MASK
| AWTEvent.WINDOW_EVENT_MASK
| SunToolkit.GRAB_EVENT_MASK);
return null;
}
);
| AWTEvent.MOUSE_MOTION_EVENT_MASK
| AWTEvent.MOUSE_WHEEL_EVENT_MASK
| AWTEvent.WINDOW_EVENT_MASK
| SunToolkit.GRAB_EVENT_MASK);
return null;
}
);
Component invoker = newPath[0].getComponent();
if (invoker instanceof JPopupMenu) {
@ -174,7 +174,7 @@ public class DarkPopupMenuUI extends BasicPopupMenuUI {
tk.removeAWTEventListener(MouseGrabber.this);
return null;
}
);
);
realUngrabWindow();
}
@ -308,7 +308,7 @@ public class DarkPopupMenuUI extends BasicPopupMenuUI {
} else if (c instanceof JPopupMenu) {
return true;
} else if (c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_DO_NOT_CANCEL_ON_SCROLL))) {
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_DO_NOT_CANCEL_ON_SCROLL))) {
/*
* Change here: allows scrollable components that contain the popupMenu.
*/

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;

12
core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkSubstanceRootLayout.java

@ -126,9 +126,9 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
}
}
if ((root.getWindowDecorationStyle() != JRootPane.NONE)
&& (root.getUI() instanceof DarkRootPaneUI)) {
&& (root.getUI() instanceof DarkRootPaneUI)) {
JComponent titlePane = ((DarkRootPaneUI) root.getUI())
.getTitlePane();
.getTitlePane();
if (titlePane != null) {
tpd = titlePane.getMinimumSize();
if (tpd != null) {
@ -139,8 +139,8 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
}
return new Dimension(Math.max(Math.max(cpWidth, mbWidth), tpWidth)
+ i.left + i.right, cpHeight + mbHeight + tpHeight + i.top
+ i.bottom);
+ i.left + i.right, cpHeight + mbHeight + tpHeight + i.top
+ i.bottom);
}
protected CustomTitlePane getTitlePane(final JRootPane root) {
@ -212,9 +212,9 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
}
if ((root.getWindowDecorationStyle() != JRootPane.NONE)
&& (root.getUI() instanceof DarkRootPaneUI)) {
&& (root.getUI() instanceof DarkRootPaneUI)) {
JComponent titlePane = ((DarkRootPaneUI) root.getUI())
.getTitlePane();
.getTitlePane();
if (titlePane != null) {
tpd = titlePane.getMaximumSize();
if (tpd != null) {

22
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;
@ -183,7 +183,7 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis
}
protected void resetAnimators(final Animator fadeInAnimator, final Animator fadeOutAnimator,
final boolean overAnimatedComponent, final float currentAlpha, final float maxAlpha) {
final boolean overAnimatedComponent, final float currentAlpha, final float maxAlpha) {
fadeInAnimator.reset();
fadeOutAnimator.reset();
if (scrollbar != null && (scrollbar.getValueIsAdjusting() || overAnimatedComponent)) {
@ -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

6
core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollPaneUI.java

@ -45,7 +45,7 @@ public class DarkScrollPaneUI extends BasicScrollPaneUI {
JScrollBar scrollbar = scrollpane.getHorizontalScrollBar();
scrollbar.setValueIsAdjusting(true);
ScrollBarUtil.doScroll(scrollbar, scrollpane.getViewport(), e,
scrollpane.getComponentOrientation().isLeftToRight());
scrollpane.getComponentOrientation().isLeftToRight());
scrollbar.setValueIsAdjusting(false);
};
private final MouseWheelListener horizontalMouseWheelListener = e -> {
@ -55,7 +55,7 @@ public class DarkScrollPaneUI extends BasicScrollPaneUI {
JScrollBar scrollbar = scrollpane.getVerticalScrollBar();
scrollbar.setValueIsAdjusting(true);
ScrollBarUtil.doScroll(scrollbar, scrollpane.getViewport(), e,
scrollpane.getComponentOrientation().isLeftToRight());
scrollpane.getComponentOrientation().isLeftToRight());
scrollbar.setValueIsAdjusting(false);
};
private final MouseWheelListener mouseWheelListener = e -> {
@ -66,7 +66,7 @@ public class DarkScrollPaneUI extends BasicScrollPaneUI {
: scrollpane.getVerticalScrollBar();
scrollbar.setValueIsAdjusting(true);
ScrollBarUtil.doScroll(scrollbar, scrollpane.getViewport(), e,
scrollpane.getComponentOrientation().isLeftToRight());
scrollpane.getComponentOrientation().isLeftToRight());
scrollbar.setValueIsAdjusting(false);
};
private final PropertyChangeListener propertyChangeListener = e -> {

4
core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/ScrollBarUtil.java

@ -144,10 +144,10 @@ public class ScrollBarUtil implements ScrollBarConstants {
if (limitToBlock) {
if (direction < 0) {
limit = scrollbar.getValue() -
scrollbar.getBlockIncrement(direction);
scrollbar.getBlockIncrement(direction);
} else {
limit = scrollbar.getValue() +
scrollbar.getBlockIncrement(direction);
scrollbar.getBlockIncrement(direction);
}
}

16
core/src/main/java/com/github/weisj/darklaf/ui/slider/DarkSliderUI.java

@ -112,7 +112,7 @@ public class DarkSliderUI extends BasicSliderUI implements PropertyChangeListene
private static boolean showVolumeIcon(final JComponent c) {
return isVolumeSlider(c)
&& Boolean.TRUE.equals(c.getClientProperty(KEY_SHOW_VOLUME_ICON));
&& Boolean.TRUE.equals(c.getClientProperty(KEY_SHOW_VOLUME_ICON));
}
private static boolean isVolumeSlider(final JComponent c) {
@ -413,10 +413,10 @@ public class DarkSliderUI extends BasicSliderUI implements PropertyChangeListene
int w = showVolumeIcon(slider) ? trackRect.width + getIconBarExt() : trackRect.width;
if (slider.getComponentOrientation().isLeftToRight()) {
return new Area(new RoundRectangle2D.Double(
trackRect.x, trackRect.y + yOff, w, trackSize, arc, arc));
trackRect.x, trackRect.y + yOff, w, trackSize, arc, arc));
} else {
return new Area(new RoundRectangle2D.Double(
trackRect.x - getIconBarExt(), trackRect.y + yOff, w, trackSize, arc, arc));
trackRect.x - getIconBarExt(), trackRect.y + yOff, w, trackSize, arc, arc));
}
}
@ -437,10 +437,10 @@ public class DarkSliderUI extends BasicSliderUI implements PropertyChangeListene
int h = showVolumeIcon(slider) ? trackRect.height + getIconBarExt() : trackRect.height;
if (slider.getComponentOrientation().isLeftToRight()) {
return new Area(new RoundRectangle2D.Double(
trackRect.x + xOff, trackRect.y, trackSize, h, arc, arc));
trackRect.x + xOff, trackRect.y, trackSize, h, arc, arc));
} else {
return new Area(new RoundRectangle2D.Double(
trackRect.x + xOff, trackRect.y - getIconBarExt(), trackSize, h, arc, arc));
trackRect.x + xOff, trackRect.y - getIconBarExt(), trackSize, h, arc, arc));
}
}
@ -474,7 +474,7 @@ public class DarkSliderUI extends BasicSliderUI implements PropertyChangeListene
protected boolean isPlainThumb() {
Boolean paintThumbArrowShape = (Boolean) slider.getClientProperty(KEY_THUMB_ARROW_SHAPE);
return (!slider.getPaintTicks() && paintThumbArrowShape == null) ||
paintThumbArrowShape == Boolean.FALSE;
paintThumbArrowShape == Boolean.FALSE;
}
private void paintSliderThumb(final Graphics2D g) {
@ -641,9 +641,9 @@ public class DarkSliderUI extends BasicSliderUI implements PropertyChangeListene
if (tickSpacing != 0) {
if ((value - slider.getMinimum()) % tickSpacing != 0) {
float temp = (float) (value - slider.getMinimum())
/ (float) tickSpacing;
/ (float) tickSpacing;
snappedValue = slider.getMinimum() +
(Math.round(temp) * tickSpacing);
(Math.round(temp) * tickSpacing);
}
}
return snappedValue;

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;

2
core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerListener.java

@ -64,7 +64,7 @@ public class DarkSpinnerListener extends MouseAdapter implements PropertyChangeL
@Override
public void propertyChange(final PropertyChangeEvent evt) {
String key = evt.getPropertyName();
Component editorComponent= ui.getEditorComponent();
Component editorComponent = ui.getEditorComponent();
JComponent editor = ui.getEditor();
if (PropertyKey.OPAQUE.equals(key)) {
boolean val = Boolean.TRUE.equals(evt.getNewValue());

4
core/src/main/java/com/github/weisj/darklaf/ui/spinner/SpinnerConstants.java

@ -45,11 +45,11 @@ public interface SpinnerConstants {
static boolean isTreeCellEditor(final Component c) {
return c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TREE_EDITOR));
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TREE_EDITOR));
}
static boolean isTableCellEditor(final Component c) {
return c instanceof JComponent
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TABLE_EDITOR));
&& Boolean.TRUE.equals(((JComponent) c).getClientProperty(KEY_IS_TABLE_EDITOR));
}
}

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());

9
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() {
@ -165,7 +166,7 @@ public class DarkScrollableTabSupport extends ScrollableTabSupport implements Mo
int shift;
if (horizontal) {
int rightMargin = size.width - (insets.left + insets.right
+ tabAreaInsets.right + tabAreaInsets.left);
+ tabAreaInsets.right + tabAreaInsets.left);
if (moreTabsButton.isVisible()) {
rightMargin -= moreTabsButton.getWidth();
}
@ -182,7 +183,7 @@ public class DarkScrollableTabSupport extends ScrollableTabSupport implements Mo
ui.scrollShiftX += shift;
} else {
int bottomMargin = size.height - (insets.bottom + tabAreaInsets.bottom
+ insets.top + tabAreaInsets.top);
+ insets.top + tabAreaInsets.top);
if (moreTabsButton.isVisible()) {
bottomMargin -= moreTabsButton.getHeight();
}

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;

10
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);
@ -72,7 +72,7 @@ public class DarkTabbedPaneLayout extends TabbedPaneLayout {
//
if (selectedComponent != null) {
if (selectedComponent != visibleComponent &&
visibleComponent != null) {
visibleComponent != null) {
Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (owner != null && SwingUtilities.isDescendingFrom(owner, visibleComponent)) {
shouldChangeFocus = true;
@ -94,7 +94,7 @@ public class DarkTabbedPaneLayout extends TabbedPaneLayout {
cx = insets.left + tw + contentInsets.left + tabAreaInsets.left + tabAreaInsets.right;
cy = insets.top + contentInsets.top;
cw = bounds.width - insets.left - insets.right - contentInsets.left - contentInsets.right - tw
- tabAreaInsets.left - tabAreaInsets.right;
- tabAreaInsets.left - tabAreaInsets.right;
ch = bounds.height - insets.top - insets.bottom - contentInsets.top - contentInsets.bottom;
break;
case SwingConstants.RIGHT:
@ -105,7 +105,7 @@ public class DarkTabbedPaneLayout extends TabbedPaneLayout {
cx = insets.left + contentInsets.left;
cy = insets.top + contentInsets.top;
cw = bounds.width - insets.left - insets.right - contentInsets.left - contentInsets.right - tw
- tabAreaInsets.left - tabAreaInsets.right;
- tabAreaInsets.left - tabAreaInsets.right;
ch = bounds.height - insets.top - insets.bottom - contentInsets.top - contentInsets.bottom;
break;
case SwingConstants.BOTTOM:
@ -127,7 +127,7 @@ public class DarkTabbedPaneLayout extends TabbedPaneLayout {
cy = insets.top + th + contentInsets.top + tabAreaInsets.top + tabAreaInsets.bottom;
cw = bounds.width - insets.left - insets.right - contentInsets.left - contentInsets.right;
ch = bounds.height - th - insets.top - insets.bottom - contentInsets.top - contentInsets.bottom
- tabAreaInsets.top - tabAreaInsets.bottom;
- tabAreaInsets.top - tabAreaInsets.bottom;
break;
}

17
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);
@ -71,7 +71,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
//
if (selectedComponent != null) {
if (selectedComponent != visibleComponent &&
visibleComponent != null) {
visibleComponent != null) {
Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (owner != null && SwingUtilities.isDescendingFrom(owner, visibleComponent)) {
@ -96,7 +96,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
cx = insets.left + tw + contentInsets.left + tabAreaInsets.left + tabAreaInsets.right;
cy = insets.top + contentInsets.top;
cw = bounds.width - insets.left - insets.right - tw - contentInsets.left - contentInsets.right
- tabAreaInsets.left - tabAreaInsets.right;
- tabAreaInsets.left - tabAreaInsets.right;
ch = bounds.height - insets.top - insets.bottom - contentInsets.top - contentInsets.bottom;
tw -= tabAreaInsets.left + tabAreaInsets.right;
break;
@ -313,7 +313,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
: new Rectangle(0, 0, 0, 0);
if (!verticalTabRuns) {
int rightMargin = size.width - (insets.right + tabAreaInsets.right
+ insets.left + tabAreaInsets.left);
+ insets.left + tabAreaInsets.left);
Point p = getMargins(tabPlacement);
int leftMargin = p.x;
int returnAt = p.y;
@ -360,7 +360,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
} else {
int bottomMargin = size.height - (insets.bottom + tabAreaInsets.bottom
+ insets.top + tabAreaInsets.top);
+ insets.top + tabAreaInsets.top);
Point p = getMargins(tabPlacement);
int topMargin = p.x;
int returnAt = p.y;
@ -413,7 +413,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
if (ui.isHorizontalTabPlacement()) {
int leftMargin = 0;
int returnAt = size.width - (insets.right + tabAreaInsets.right
+ insets.left + tabAreaInsets.left);
+ insets.left + tabAreaInsets.left);
if (tabsButton.isVisible()) {
returnAt -= tabsButton.getPreferredSize().width;
}
@ -424,7 +424,7 @@ public class DarkTabbedPaneScrollLayout extends TabbedPaneScrollLayout {
} else {
int topMargin = 0;
int returnAt = size.height - (insets.bottom + tabAreaInsets.bottom
+ insets.top + tabAreaInsets.top);
+ insets.top + tabAreaInsets.top);
if (tabsButton.isVisible()) {
returnAt -= tabsButton.getPreferredSize().height;
}
@ -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;

40
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java

@ -303,7 +303,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
protected void uninstallKeyboardActions() {
SwingUtilities.replaceUIActionMap(tabPane, null);
SwingUtilities.replaceUIInputMap(tabPane, JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
null);
SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED,
null);
@ -440,7 +440,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
return baseline;
case JTabbedPane.BOTTOM:
baseline = height - insets.bottom -
tabAreaInsets.bottom - maxTabHeight + baseline;
tabAreaInsets.bottom - maxTabHeight + baseline;
return baseline;
}
}
@ -455,7 +455,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
* @since 1.6
*/
public Component.BaselineResizeBehavior getBaselineResizeBehavior(
final JComponent c) {
final JComponent c) {
super.getBaselineResizeBehavior(c);
switch (tabPane.getTabPlacement()) {
case JTabbedPane.LEFT:
@ -508,7 +508,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
int tabCount = tabPane.getTabCount();
Rectangle iconRect = new Rectangle(),
textRect = new Rectangle();
textRect = new Rectangle();
Rectangle clipRect = g.getClipBounds();
// Paint tabRuns of tabs from back to front
@ -812,7 +812,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
Rectangle tabRect = rects[tabIndex];
String propKey = (isSelected ? "selectedLabelShift" : "labelShift");
int nudge = DefaultLookup.getInt(
tabPane, this, "TabbedPane." + propKey, 1);
tabPane, this, "TabbedPane." + propKey, 1);
switch (tabPlacement) {
case LEFT:
@ -950,10 +950,10 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
*/
protected void installKeyboardActions() {
InputMap km = getInputMap(JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
SwingUtilities.replaceUIInputMap(tabPane, JComponent.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
km);
km = getInputMap(JComponent.WHEN_FOCUSED);
SwingUtilities.replaceUIInputMap(tabPane, JComponent.WHEN_FOCUSED, km);
@ -1063,7 +1063,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, DarkUIUtil.getFocusAcceleratorKeyMask()),
"setSelectedIndex");
mnemonicInputMap.put(KeyStroke.getKeyStroke(mnemonic, InputEvent.ALT_GRAPH_DOWN_MASK
| DarkUIUtil.getFocusAcceleratorKeyMask()),
| DarkUIUtil.getFocusAcceleratorKeyMask()),
"setSelectedIndex");
mnemonicToIndexMap.put(mnemonic, index);
}
@ -1253,16 +1253,16 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
Insets tabInsets = getTabInsets(tabPane.getTabPlacement(), tab);
int cellHeight = maxTabHeight - tabInsets.top - tabInsets.bottom;
return c.getBaseline(pref.width, pref.height) +
(cellHeight - pref.height) / 2 + tabInsets.top;
(cellHeight - pref.height) / 2 + tabInsets.top;
} else {
View view = getTextViewForTab(tab);
if (view != null) {
int viewHeight = (int) view.getPreferredSpan(View.Y_AXIS);
int baseline = BasicHTML.getHTMLBaseline(
view, (int) view.getPreferredSpan(View.X_AXIS), viewHeight);
view, (int) view.getPreferredSpan(View.X_AXIS), viewHeight);
if (baseline >= 0) {
return maxTabHeight / 2 - viewHeight / 2 + baseline +
getBaselineOffset();
getBaselineOffset();
}
return -1;
}
@ -1271,7 +1271,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
int fontHeight = metrics.getHeight();
int fontBaseline = metrics.getAscent();
return maxTabHeight / 2 - fontHeight / 2 + fontBaseline +
getBaselineOffset();
getBaselineOffset();
}
/**
@ -1621,7 +1621,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
int tabRunOverlay = getTabRunOverlay(tabPlacement);
return (horizRunCount > 0 ?
horizRunCount * (maxTabHeight - tabRunOverlay) + tabRunOverlay +
tabAreaInsets.top + tabAreaInsets.bottom :
tabAreaInsets.top + tabAreaInsets.bottom :
0);
}
@ -1638,7 +1638,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
int tabRunOverlay = getTabRunOverlay(tabPlacement);
return (vertRunCount > 0 ?
vertRunCount * (maxTabWidth - tabRunOverlay) + tabRunOverlay +
tabAreaInsets.left + tabAreaInsets.right :
tabAreaInsets.left + tabAreaInsets.right :
0);
}
@ -2215,9 +2215,9 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
*/
protected void setVisibleComponent(final Component component) {
if (visibleComponent != null
&& visibleComponent != component
&& visibleComponent.getParent() == tabPane
&& visibleComponent.isVisible()) {
&& visibleComponent != component
&& visibleComponent.getParent() == tabPane
&& visibleComponent.isVisible()) {
visibleComponent.setVisible(false);
}
@ -2271,7 +2271,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
* The Request focus for visible.
*/
static final String REQUEST_FOCUS_FOR_VISIBLE =
"requestFocusForVisibleComponent";
"requestFocusForVisibleComponent";
/**
* The Set selected.
*/
@ -2302,8 +2302,8 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
String key = getName();
JTabbedPane pane = (JTabbedPane) e.getSource();
DarkTabbedPaneUIBridge ui = (DarkTabbedPaneUIBridge) DarkUIUtil
.getUIOfType(pane.getUI(),
DarkTabbedPaneUIBridge.class);
.getUIOfType(pane.getUI(),
DarkTabbedPaneUIBridge.class);
if (ui == null) {
return;

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);

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

@ -46,9 +46,9 @@ class ScrollableTabSupport {
public String toString() {
return "viewport.viewSize=" + viewport.getViewSize() + "\n" +
"viewport.viewRectangle=" + viewport.getViewRect() + "\n" +
"leadingTabIndex=" + leadingTabIndex + "\n" +
"tabViewPosition=" + tabViewPosition;
"viewport.viewRectangle=" + viewport.getViewRect() + "\n" +
"leadingTabIndex=" + leadingTabIndex + "\n" +
"tabViewPosition=" + tabViewPosition;
}
}

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

@ -28,7 +28,7 @@ import javax.swing.plaf.UIResource;
import java.awt.*;
@SuppressWarnings("serial")
// Superclass is not serializable across versions
// Superclass is not serializable across versions
class ScrollableTabViewport extends JViewport implements UIResource {
public ScrollableTabViewport(final DarkTabbedPaneUIBridge ui) {

4
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneHandler.java

@ -39,7 +39,7 @@ import java.beans.PropertyChangeListener;
import java.util.Objects;
public class TabbedPaneHandler implements ChangeListener, ContainerListener, FocusListener,
MouseListener, MouseMotionListener, PropertyChangeListener {
MouseListener, MouseMotionListener, PropertyChangeListener {
private final DarkTabbedPaneUIBridge ui;
//
@ -146,7 +146,7 @@ public class TabbedPaneHandler implements ChangeListener, ContainerListener, Foc
int index = tabPane.getSelectedIndex();
if (index < ui.rects.length && index != -1) {
ui.tabScroller.tabPanel.scrollRectToVisible(
(Rectangle) ui.rects[index].clone());
(Rectangle) ui.rects[index].clone());
}
}
}

14
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/TabbedPaneLayout.java

@ -102,7 +102,7 @@ public class TabbedPaneLayout implements LayoutManager {
//
if (selectedComponent != null) {
if (selectedComponent != visibleComponent &&
visibleComponent != null) {
visibleComponent != null) {
if (SwingUtilities.findFocusOwner(visibleComponent) != null) {
shouldChangeFocus = true;
}
@ -139,11 +139,11 @@ public class TabbedPaneLayout implements LayoutManager {
}
cw = bounds.width - totalTabWidth -
insets.left - insets.right -
contentInsets.left - contentInsets.right;
insets.left - insets.right -
contentInsets.left - contentInsets.right;
ch = bounds.height - totalTabHeight -
insets.top - insets.bottom -
contentInsets.top - contentInsets.bottom;
insets.top - insets.bottom -
contentInsets.top - contentInsets.bottom;
for (int i = 0; i < numChildren; i++) {
Component child = ui.tabPane.getComponent(i);
@ -151,10 +151,10 @@ public class TabbedPaneLayout implements LayoutManager {
int tabContainerWidth = totalTabWidth == 0 ? bounds.width :
totalTabWidth + insets.left + insets.right +
contentInsets.left + contentInsets.right;
contentInsets.left + contentInsets.right;
int tabContainerHeight = totalTabHeight == 0 ? bounds.height :
totalTabHeight + insets.top + insets.bottom +
contentInsets.top + contentInsets.bottom;
contentInsets.top + contentInsets.bottom;
int tabContainerX = 0;
int tabContainerY = 0;

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

@ -123,7 +123,7 @@ abstract class TabbedPaneScrollLayout extends TabbedPaneLayout {
// the bottom, flip x positions and adjust by widths
if (!leftToRight && !verticalTabRuns) {
int rightMargin = size.width
- (insets.right + tabAreaInsets.right);
- (insets.right + tabAreaInsets.right);
for (i = 0; i < tabCount; i++) {
ui.rects[i].x = rightMargin - ui.rects[i].x - ui.rects[i].width;
}

27
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;
@ -81,10 +69,10 @@ public class TabbedPaneTransferHandler extends TransferHandler implements DropTa
// only mouse events supported for drag operations
if (!(e instanceof MouseEvent)
// only support known actions
|| !(action == COPY || action == MOVE || action == LINK)
// only support valid source actions
|| (srcActions & action) == 0) {
// only support known actions
|| !(action == COPY || action == MOVE || action == LINK)
// only support valid source actions
|| (srcActions & action) == 0) {
action = NONE;
}
@ -177,7 +165,7 @@ public class TabbedPaneTransferHandler extends TransferHandler implements DropTa
createDragImage(tabPane, null);
}
if ((ui != null && !ui.scrollableTabLayoutEnabled())
|| tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT) {
|| tabPane.getTabLayoutPolicy() == JTabbedPane.WRAP_TAB_LAYOUT) {
tabPane.setSelectedIndex(currentTransferable.transferData.tabIndex);
}
return currentTransferable;
@ -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;

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

@ -124,17 +124,19 @@ 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()))) {
&& tab == source.getTabCount()))) {
lastInSource = true;
destRect.width = tabBounds.width;
destRect.height = tabBounds.height;
@ -207,7 +209,7 @@ public class TabbedPaneUtil implements SwingConstants {
tabBounds.width = Math.min(tabBounds.width / 2, destRect.width / 2);
} else {
if (destRect.y + destRect.height <= mouseLocation.y
&& prev.y <= mouseLocation.y && mouseLocation.y <= prev.y + prev.height) {
&& prev.y <= mouseLocation.y && mouseLocation.y <= prev.y + prev.height) {
destRect.x = prev.x + prev.width;
destRect.y = prev.y;
destRect.height = prev.height;

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());

17
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;
@ -66,9 +66,9 @@ public class TabFrameLayout implements LayoutManager {
public Dimension preferredLayoutSize(final Container parent) {
Dimension b = tabFrame.getContentPane().getComponent().getPreferredSize();
return new Dimension(tabFrame.getLeftTabContainer().getWidth()
+ tabFrame.getRightTabContainer().getWidth() + b.width,
+ tabFrame.getRightTabContainer().getWidth() + b.width,
tabFrame.getTopTabContainer().getHeight()
+ tabFrame.getBottomTabContainer().getHeight() + b.height);
+ tabFrame.getBottomTabContainer().getHeight() + b.height);
}
@ -76,9 +76,9 @@ public class TabFrameLayout implements LayoutManager {
public Dimension minimumLayoutSize(final Container parent) {
Dimension b = tabFrame.getContentPane().getComponent().getMinimumSize();
return new Dimension(tabFrame.getLeftTabContainer().getWidth()
+ tabFrame.getRightTabContainer().getWidth() + b.width,
+ tabFrame.getRightTabContainer().getWidth() + b.width,
tabFrame.getTopTabContainer().getHeight()
+ tabFrame.getBottomTabContainer().getHeight() + b.height);
+ tabFrame.getBottomTabContainer().getHeight() + b.height);
}
@Override
@ -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);

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

@ -46,7 +46,7 @@ import java.awt.event.MouseEvent;
public class TabFrameTransferHandler extends TransferHandler implements DropTargetListener, SwingConstants {
private static final String MIME_TYPE = DataFlavor.javaJVMLocalObjectMimeType
+ ";class=com.github.weisj.darklaf.components.tabframe.JTabFrame";
+ ";class=com.github.weisj.darklaf.components.tabframe.JTabFrame";
private static TabbedPaneDragGestureRecognizer recognizer = null;
private final Timer timer;
private final Timer startTimer;
@ -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);
}
});
@ -102,10 +103,10 @@ public class TabFrameTransferHandler extends TransferHandler implements DropTarg
// only mouse events supported for drag operations
if (!(e instanceof MouseEvent)
// only support known actions
|| !(action == COPY || action == MOVE || action == LINK)
// only support valid source actions
|| (srcActions & action) == 0) {
// only support known actions
|| !(action == COPY || action == MOVE || action == LINK)
// only support valid source actions
|| (srcActions & action) == 0) {
action = NONE;
}

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

Loading…
Cancel
Save