From 17607448072d1d1370e476085bdbb6be1def9c50 Mon Sep 17 00:00:00 2001 From: weisj Date: Wed, 25 Mar 2020 23:08:51 +0100 Subject: [PATCH] formatting and code style. --- .../com/github/weisj/darklaf/DarkLaf.java | 5 +- .../com/github/weisj/darklaf/LafManager.java | 53 +- .../weisj/darklaf/color/ColorWrapper.java | 6 +- .../components/ClosableTabComponent.java | 28 +- .../darklaf/components/ColorPipetteBase.java | 4 +- .../components/DefaultColorPipette.java | 12 +- .../weisj/darklaf/components/JXPopupMenu.java | 4 +- .../darklaf/components/OverlayScrollPane.java | 4 +- .../darklaf/components/ScrollPopupMenu.java | 4 +- .../components/border/BubbleBorder.java | 4 +- .../components/border/DarkBorders.java | 4 +- .../components/border/DropShadowBorder.java | 27 +- .../components/border/WeakLineBorder.java | 8 +- .../components/tabframe/JTabFrame.java | 3 +- .../components/tabframe/PanelPopup.java | 4 +- .../tabframe/TabFrameContentPane.java | 64 +- .../components/tabframe/TabFramePopup.java | 4 +- .../components/tabframe/ToggleSplitPane.java | 4 +- .../components/text/LineHighlighter.java | 7 +- .../components/text/NumberingPane.java | 7 +- .../text/SearchTextFieldWithHistory.java | 2 +- .../text/TextFieldHistoryPopup.java | 8 +- .../components/tooltip/ToolTipContext.java | 13 +- .../tristate/TristateCheckBoxMenuItem.java | 3 +- .../weisj/darklaf/platform/Decorations.java | 7 +- .../com/github/weisj/darklaf/theme/Theme.java | 56 +- .../weisj/darklaf/ui/BasicTransferable.java | 33 +- .../weisj/darklaf/ui/DarkPopupFactory.java | 2 +- .../darklaf/ui/DragRecognitionSupport.java | 15 +- .../darklaf/ui/button/ButtonConstants.java | 12 +- .../darklaf/ui/button/DarkButtonBorder.java | 40 +- .../weisj/darklaf/ui/button/DarkButtonUI.java | 2 +- .../ui/cell/DarkCellRendererToggleButton.java | 14 +- .../colorchooser/ColorPreviewComponent.java | 2 +- .../ui/colorchooser/ColorValueFormatter.java | 4 +- .../darklaf/ui/colorchooser/ColorWheel.java | 2 +- .../colorchooser/ColorWheelImageProducer.java | 6 +- .../colorchooser/DarkColorChooserPanel.java | 13 +- .../ui/colorchooser/DarkColorChooserUI.java | 10 +- .../DarkSwatchesChooserPanel.java | 7 +- .../ui/colorchooser/MainSwatchPanel.java | 902 +++++++++--------- .../ui/colorchooser/SlideComponent.java | 2 +- .../darklaf/ui/colorchooser/SwatchPanel.java | 10 +- .../ui/combobox/ComboBoxConstants.java | 4 +- .../ui/combobox/DarkComboBoxBorder.java | 16 +- .../ui/combobox/DarkComboBoxListener.java | 2 +- .../darklaf/ui/combobox/DarkComboBoxUI.java | 2 +- .../darklaf/ui/combobox/DarkComboPopup.java | 19 +- .../ui/filechooser/DarkFileChooserUI.java | 2 +- .../filechooser/DarkFileChooserUIBridge.java | 85 +- .../darklaf/ui/filechooser/DarkFilePane.java | 10 +- .../ui/filechooser/DarkFilePaneUIBridge.java | 168 ++-- .../weisj/darklaf/ui/html/DarkHTML.java | 2 +- .../DarkInternalFrameTitlePane.java | 5 - .../weisj/darklaf/ui/label/DarkLabelUI.java | 12 +- .../ui/list/DarkListCellFocusBorder.java | 4 +- .../darklaf/ui/list/DarkListUIBridge.java | 234 +++-- .../darklaf/ui/menu/DarkMenuBarBorder.java | 2 +- .../darklaf/ui/menu/DarkMenuItemUIBase.java | 24 +- .../weisj/darklaf/ui/menu/DarkMenuUI.java | 20 +- .../ui/numberingpane/DarkNumberingPaneUI.java | 11 +- .../ui/optionpane/DarkOptionPaneUI.java | 15 +- .../ui/popupmenu/DarkPopupMenuBorder.java | 3 +- .../darklaf/ui/popupmenu/DarkPopupMenuUI.java | 20 +- .../ui/progressbar/DarkProgressBarUI.java | 9 +- .../darklaf/ui/rootpane/DarkRootPaneUI.java | 2 +- .../ui/rootpane/DarkSubstanceRootLayout.java | 12 +- .../ui/scrollpane/DarkScrollBarListener.java | 22 +- .../ui/scrollpane/DarkScrollPaneUI.java | 6 +- .../darklaf/ui/scrollpane/ScrollBarUtil.java | 4 +- .../weisj/darklaf/ui/slider/DarkSliderUI.java | 16 +- .../darklaf/ui/spinner/DarkSpinnerBorder.java | 10 +- .../ui/spinner/DarkSpinnerListener.java | 2 +- .../darklaf/ui/spinner/SpinnerConstants.java | 4 +- .../ui/splitpane/DarkSplitPaneDivider.java | 14 +- .../darklaf/ui/tabbedpane/DarkHandler.java | 2 +- .../ui/tabbedpane/DarkScrollableTabPanel.java | 5 +- .../tabbedpane/DarkScrollableTabSupport.java | 9 +- .../ui/tabbedpane/DarkTabAreaButton.java | 2 +- .../ui/tabbedpane/DarkTabbedPaneLayout.java | 10 +- .../DarkTabbedPaneScrollLayout.java | 17 +- .../ui/tabbedpane/DarkTabbedPaneUI.java | 2 +- .../ui/tabbedpane/DarkTabbedPaneUIBridge.java | 40 +- .../darklaf/ui/tabbedpane/MoreTabsButton.java | 5 +- .../darklaf/ui/tabbedpane/NewTabButton.java | 2 +- .../ui/tabbedpane/ScrollableTabPanel.java | 2 +- .../ui/tabbedpane/ScrollableTabSupport.java | 6 +- .../ui/tabbedpane/ScrollableTabViewport.java | 2 +- .../ui/tabbedpane/TabbedPaneHandler.java | 4 +- .../ui/tabbedpane/TabbedPaneLayout.java | 14 +- .../ui/tabbedpane/TabbedPaneScrollLayout.java | 2 +- .../tabbedpane/TabbedPaneTransferHandler.java | 27 +- .../darklaf/ui/tabbedpane/TabbedPaneUtil.java | 10 +- .../darklaf/ui/tabframe/DarkPanelPopupUI.java | 3 +- .../DarkTabFrameComponentPopupMenu.java | 2 +- .../ui/tabframe/DarkTabFrameTabLabelUI.java | 2 +- .../darklaf/ui/tabframe/DarkTabFrameUI.java | 2 +- .../darklaf/ui/tabframe/TabDragListener.java | 4 +- .../darklaf/ui/tabframe/TabFrameLayout.java | 17 +- .../ui/tabframe/TabFrameTransferHandler.java | 13 +- .../darklaf/ui/table/DarkTableCellEditor.java | 6 +- .../DarkTableCellEditorToggleButton.java | 2 +- .../ui/table/DarkTableCellFocusBorder.java | 10 +- .../ui/table/DarkTableCellRenderer.java | 6 +- .../ui/table/DarkTableHeaderBorder.java | 8 +- .../ui/table/DarkTableHeaderCorner.java | 4 +- .../ui/table/DarkTableHeaderUIBridge.java | 62 +- .../weisj/darklaf/ui/table/DarkTableUI.java | 7 +- .../darklaf/ui/table/DarkTableUIBridge.java | 10 +- .../weisj/darklaf/ui/table/TableUIBridge.java | 266 +++--- .../ui/table/TextTableCellEditorBorder.java | 6 +- .../darklaf/ui/taskpane/DarkTaskPaneUI.java | 4 +- .../weisj/darklaf/ui/text/DarkCaret.java | 8 +- .../darklaf/ui/text/DarkEditorPaneUI.java | 12 +- .../darklaf/ui/text/DarkPasswordFieldUI.java | 4 +- .../weisj/darklaf/ui/text/DarkTextAreaUI.java | 6 +- .../weisj/darklaf/ui/text/DarkTextBorder.java | 30 +- .../darklaf/ui/text/DarkTextFieldUI.java | 4 +- .../ui/text/DarkTextFieldUIBridge.java | 20 +- .../weisj/darklaf/ui/text/DarkTextUI.java | 18 +- .../darklaf/ui/text/SelectLineAction.java | 10 +- .../darklaf/ui/text/SelectWordAction.java | 8 +- .../ui/titledborder/DarkTitledBorder.java | 9 +- .../ui/togglebutton/ButtonGroupInfo.java | 16 +- .../ui/togglebutton/DarkToggleButtonUI.java | 2 +- .../darklaf/ui/togglebutton/StateIconUI.java | 2 +- .../togglebutton/ToggleButtonConstants.java | 6 +- .../checkbox/DarkCheckBoxBorder.java | 2 +- .../radiobutton/DarkRadioButtonBorder.java | 2 +- .../radiobutton/DarkRadioButtonUI.java | 2 +- .../darklaf/ui/toolbar/DarkToolBarBorder.java | 6 +- .../darklaf/ui/toolbar/DarkToolBarUI.java | 20 +- .../ui/toolbar/DarkToolBarUIBridge.java | 98 +- .../darklaf/ui/toolbar/DropPreviewPanel.java | 14 +- .../darklaf/ui/tooltip/DarkTooltipBorder.java | 2 +- .../darklaf/ui/tooltip/DarkTooltipUI.java | 8 +- .../weisj/darklaf/ui/tooltip/ToolTipUtil.java | 2 +- .../ui/tree/DarkDefaultTreeEditor.java | 16 +- .../darklaf/ui/tree/DarkTreeCellBorder.java | 2 +- .../darklaf/ui/tree/DarkTreeCellRenderer.java | 8 +- .../weisj/darklaf/ui/tree/DarkTreeUI.java | 30 +- .../ui/tree/TreeRendererComponent.java | 2 +- .../github/weisj/darklaf/util/DarkUIUtil.java | 27 +- .../github/weisj/darklaf/util/ImageUtil.java | 2 +- .../weisj/darklaf/util/LazyActionMap.java | 10 +- .../weisj/darklaf/util/SwingXUtilities.java | 4 +- .../DarkHighlightPainter.java | 34 +- .../pbjar/jxlayer/plaf/ext/MouseEventUI.java | 26 +- .../pbjar/jxlayer/plaf/ext/TransformUI.java | 47 +- .../ext/transform/DefaultLayerLayout.java | 4 +- .../plaf/ext/transform/TransformRPMImpl.java | 18 +- .../plaf/ext/transform/TransformUtils.java | 6 +- .../jxlayer/repaint/RepaintManagerUtils.java | 17 +- .../repaint/WrappedRepaintManager.java | 1 - core/src/test/java/UIDemo.java | 736 +++++++------- core/src/test/java/defaults/SafeIcon.java | 4 +- .../test/java/defaults/SampleRenderer.java | 14 +- .../test/java/defaults/UIManagerDefaults.java | 4 +- .../java/documentation/CreateUITable.java | 36 +- core/src/test/java/icon/AllIcons.java | 4 +- core/src/test/java/ui/DemoResources.java | 48 +- core/src/test/java/ui/button/ButtonDemo.java | 6 +- .../src/test/java/ui/dialog/CustomDialog.java | 25 +- core/src/test/java/ui/dialog/DialogDemo.java | 110 +-- .../ui/internalFrame/InternalFrameDemo.java | 2 +- .../ui/scrollPane/OverlayScrollPaneDemo.java | 2 +- .../java/ui/scrollPane/ScrollPaneDemo.java | 12 +- core/src/test/java/ui/slider/SliderDemo.java | 5 +- .../TabbedPaneKeyboardShortcut.java | 6 +- core/src/test/java/ui/table/TableDemo.java | 6 +- .../platform/macos/JNIDecorationsMacOS.java | 9 +- .../platform/macos/ui/MacOSTitlePane.java | 4 +- .../weisj/darklaf/platform/NativeUtil.java | 10 +- .../github/weisj/darklaf/PropertyLoader.java | 18 +- .../weisj/darklaf/icons/IconColorMapper.java | 5 +- .../weisj/darklaf/icons/ScaledIcon.java | 3 +- .../github/weisj/darklaf/util/Alignment.java | 6 +- .../weisj/darklaf/util/AlignmentExt.java | 2 +- .../github/weisj/darklaf/util/SystemInfo.java | 12 +- .../windows/JNIDecorationsWindows.java | 12 +- .../platform/windows/ui/WindowsTitlePane.java | 32 +- 181 files changed, 2239 insertions(+), 2236 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/DarkLaf.java b/core/src/main/java/com/github/weisj/darklaf/DarkLaf.java index a69e1524..04cbb65a 100644 --- a/core/src/main/java/com/github/weisj/darklaf/DarkLaf.java +++ b/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); } diff --git a/core/src/main/java/com/github/weisj/darklaf/LafManager.java b/core/src/main/java/com/github/weisj/darklaf/LafManager.java index d7b83797..8cbec5bc 100644 --- a/core/src/main/java/com/github/weisj/darklaf/LafManager.java +++ b/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. *

- * 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. *

- * 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. *

- * 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. *

- * 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. *

- * 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`. diff --git a/core/src/main/java/com/github/weisj/darklaf/color/ColorWrapper.java b/core/src/main/java/com/github/weisj/darklaf/color/ColorWrapper.java index 5f08cce9..3fadf43b 100644 --- a/core/src/main/java/com/github/weisj/darklaf/color/ColorWrapper.java +++ b/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 diff --git a/core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java b/core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java index 15d840cb..398b7822 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/ClosableTabComponent.java +++ b/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); } diff --git a/core/src/main/java/com/github/weisj/darklaf/components/ColorPipetteBase.java b/core/src/main/java/com/github/weisj/darklaf/components/ColorPipetteBase.java index 77a23e68..c6e34d43 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/ColorPipetteBase.java +++ b/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; diff --git a/core/src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java b/core/src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java index b0b160e8..5038cc64 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/DefaultColorPipette.java +++ b/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); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java b/core/src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java index b1b32468..cf0c1692 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/JXPopupMenu.java +++ b/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 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); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/OverlayScrollPane.java b/core/src/main/java/com/github/weisj/darklaf/components/OverlayScrollPane.java index 1a14a049..79751cbc 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/OverlayScrollPane.java +++ b/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); } diff --git a/core/src/main/java/com/github/weisj/darklaf/components/ScrollPopupMenu.java b/core/src/main/java/com/github/weisj/darklaf/components/ScrollPopupMenu.java index a7010165..d71cd776 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/ScrollPopupMenu.java +++ b/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); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java b/core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java index 4a2f9390..1196e48e 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/border/BubbleBorder.java +++ b/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) { diff --git a/core/src/main/java/com/github/weisj/darklaf/components/border/DarkBorders.java b/core/src/main/java/com/github/weisj/darklaf/components/border/DarkBorders.java index 50a3dbe1..e37471d4 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/border/DarkBorders.java +++ b/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> lineBorderMap = + private static final Map> lineBorderMap = Collections.synchronizedMap(new WeakHashMap<>()); - private static Map> lineWidgetBorderMap = + private static final Map> lineWidgetBorderMap = Collections.synchronizedMap(new WeakHashMap<>()); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java b/core/src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java index d5aa864c..2c06f1de 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/border/DropShadowBorder.java +++ b/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; diff --git a/core/src/main/java/com/github/weisj/darklaf/components/border/WeakLineBorder.java b/core/src/main/java/com/github/weisj/darklaf/components/border/WeakLineBorder.java index 1eebfed7..8fda5481 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/border/WeakLineBorder.java +++ b/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); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java b/core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java index afbc8666..f60fe766 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/JTabFrame.java +++ b/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)); } /** diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java b/core/src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java index 31b4b096..28a2c5d3 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/PanelPopup.java +++ b/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; diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java b/core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java index ac304573..3b6f2d2c 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFrameContentPane.java +++ b/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; diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFramePopup.java b/core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFramePopup.java index 8be12a62..701bcab3 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/TabFramePopup.java +++ b/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()); } } diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/ToggleSplitPane.java b/core/src/main/java/com/github/weisj/darklaf/components/tabframe/ToggleSplitPane.java index 6f830e7b..4957c79d 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tabframe/ToggleSplitPane.java +++ b/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)); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/text/LineHighlighter.java b/core/src/main/java/com/github/weisj/darklaf/components/text/LineHighlighter.java index 060b266a..dd1fc791 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/text/LineHighlighter.java +++ b/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) { + } }); } } diff --git a/core/src/main/java/com/github/weisj/darklaf/components/text/NumberingPane.java b/core/src/main/java/com/github/weisj/darklaf/components/text/NumberingPane.java index 24f049e6..7c30c1fd 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/text/NumberingPane.java +++ b/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 iconMap; - private Map> listenerMap; + private final Map iconMap; + private final Map> 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(); diff --git a/core/src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java b/core/src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java index dfdc6da5..b5a3b70e 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/text/SearchTextFieldWithHistory.java +++ b/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 TextField. A default model is created, the initial string is null, diff --git a/core/src/main/java/com/github/weisj/darklaf/components/text/TextFieldHistoryPopup.java b/core/src/main/java/com/github/weisj/darklaf/components/text/TextFieldHistoryPopup.java index 24d2aba2..9d4258ce 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/text/TextFieldHistoryPopup.java +++ b/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 diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java b/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java index ad390843..58a38af1 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java +++ b/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java @@ -224,9 +224,9 @@ public class ToolTipContext { * *

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. diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java b/core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java index 7aa1c029..6943c98f 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java +++ b/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 diff --git a/core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java b/core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java index 1421b066..4d0b1df3 100644 --- a/core/src/main/java/com/github/weisj/darklaf/platform/Decorations.java +++ b/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() { diff --git a/core/src/main/java/com/github/weisj/darklaf/theme/Theme.java b/core/src/main/java/com/github/weisj/darklaf/theme/Theme.java index 47b68d3b..5a0e254f 100644 --- a/core/src/main/java/com/github/weisj/darklaf/theme/Theme.java +++ b/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. *

- * 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. *

- * 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. *

- * 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. *

- * 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. *

- * 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. *

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

- * 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. *

- * 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. */ diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/BasicTransferable.java b/core/src/main/java/com/github/weisj/darklaf/ui/BasicTransferable.java index fea89c2d..8155b088 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/BasicTransferable.java +++ b/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; } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java b/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java index 92d889cb..b3eb40c8 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java +++ b/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) { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/DragRecognitionSupport.java b/core/src/main/java/com/github/weisj/darklaf/ui/DragRecognitionSupport.java index 71fb3b4a..80e2a7c9 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/DragRecognitionSupport.java +++ b/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 DragSource.getDragThreshold() pixels. An instance of this class is * maintained per AppContext, and the public static methods call into the appropriate instance. * - *

This is a c and p of core (package private) needed for BasicXListUI. It differs from core in that references to sun + *

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. *