From 8e4ce7dc1fdff30866c05a120b47768dfa55fa0e Mon Sep 17 00:00:00 2001 From: weisj Date: Tue, 19 May 2020 18:53:50 +0200 Subject: [PATCH] Formatting. --- .../darklaf/components/color/PopupColorChooser.java | 3 +-- .../components/text/SearchTextFieldWithHistory.java | 12 ++++-------- .../darklaf/components/tooltip/ToolTipContext.java | 3 +-- core/src/test/java/ui/button/ButtonDemo.java | 6 ++---- .../{LoadIndicator.java => LoadIndicatorDemo.java} | 4 ++-- 5 files changed, 10 insertions(+), 18 deletions(-) rename core/src/test/java/ui/label/{LoadIndicator.java => LoadIndicatorDemo.java} (93%) diff --git a/core/src/main/java/com/github/weisj/darklaf/components/color/PopupColorChooser.java b/core/src/main/java/com/github/weisj/darklaf/components/color/PopupColorChooser.java index 9e365f91..6cccb106 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/color/PopupColorChooser.java +++ b/core/src/main/java/com/github/weisj/darklaf/components/color/PopupColorChooser.java @@ -129,8 +129,7 @@ public class PopupColorChooser extends JToolTip { } protected ToolTipContext createToolTipContext() { - return new ToolTipContext() - .setAlignment(Alignment.CENTER) + return new ToolTipContext().setAlignment(Alignment.CENTER) .setCenterAlignment(Alignment.SOUTH) .setUseBestFit(true) .setToolTipInsets(new Insets(2, 2, 2, 2)) 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 8430c589..de17dd24 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 @@ -24,6 +24,9 @@ */ package com.github.weisj.darklaf.components.text; +import com.github.weisj.darklaf.ui.text.DarkTextFieldUI; +import com.github.weisj.darklaf.ui.text.DarkTextUI; + import java.util.List; import javax.swing.text.Document; @@ -64,7 +67,7 @@ public class SearchTextFieldWithHistory extends SearchTextField { public SearchTextFieldWithHistory(final Document doc, final String text, final int columns) { super(doc, text, columns); history = new TextFieldHistoryPopup(this, 100, 800); - putClientProperty("JTextField.Search.FindPopup", history); + putClientProperty(DarkTextFieldUI.KEY_FIND_POPUP, history); } /** @@ -169,11 +172,4 @@ public class SearchTextFieldWithHistory extends SearchTextField { public int getLength() { return history.getLength(); } - - public void setHistoryLength(final int length) { - if (length < 0) throw new IllegalArgumentException("History can't have negative size"); - if (length == 0) { - putClientProperty("JTextField.Search.FindPopup", null); - } - } } 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 66e83264..3c74529c 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 @@ -413,8 +413,7 @@ public class ToolTipContext { * @see #setInsideArea(Area) */ public ToolTipContext setInsideArea(final Rectangle insideRect) { - this.hotSpotArea = new Area(insideRect); - return this; + return setInsideArea(new Area(insideRect)); } /** diff --git a/core/src/test/java/ui/button/ButtonDemo.java b/core/src/test/java/ui/button/ButtonDemo.java index 9d97cb93..9acade63 100644 --- a/core/src/test/java/ui/button/ButtonDemo.java +++ b/core/src/test/java/ui/button/ButtonDemo.java @@ -122,12 +122,10 @@ public class ButtonDemo implements ComponentDemo { controlPanel = panel.addControls(); controlPanel.add(new QuickColorChooser(DarkButtonUI.KEY_HOVER_COLOR, Color.BLACK, - (b, c) -> button - .putClientProperty(DarkButtonUI.KEY_HOVER_COLOR, + (b, c) -> button.putClientProperty(DarkButtonUI.KEY_HOVER_COLOR, b ? c : null))); controlPanel.add(new QuickColorChooser(DarkButtonUI.KEY_HOVER_COLOR, Color.BLACK, - (b, c) -> button - .putClientProperty(DarkButtonUI.KEY_CLICK_COLOR, + (b, c) -> button.putClientProperty(DarkButtonUI.KEY_CLICK_COLOR, b ? c : null))); controlPanel = panel.addControls(); diff --git a/core/src/test/java/ui/label/LoadIndicator.java b/core/src/test/java/ui/label/LoadIndicatorDemo.java similarity index 93% rename from core/src/test/java/ui/label/LoadIndicator.java rename to core/src/test/java/ui/label/LoadIndicatorDemo.java index 3b666a27..9d5d6517 100644 --- a/core/src/test/java/ui/label/LoadIndicator.java +++ b/core/src/test/java/ui/label/LoadIndicatorDemo.java @@ -32,10 +32,10 @@ import ui.DemoResources; import com.github.weisj.darklaf.components.loading.LoadingIndicator; -public class LoadIndicator extends LabelDemoBase { +public class LoadIndicatorDemo extends LabelDemoBase { public static void main(final String[] args) { - ComponentDemo.showDemo(new LoadIndicator()); + ComponentDemo.showDemo(new LoadIndicatorDemo()); } @Override