Browse Source

Ensure checks for Darklaf use ThemedLookAndFeel instead.

Remove logging statements.
pull/214/head
weisj 4 years ago
parent
commit
7dd04941e1
  1. 5
      core/src/main/java/com/github/weisj/darklaf/LafManager.java
  2. 4
      core/src/main/java/com/github/weisj/darklaf/components/border/DarkLineBorder.java
  3. 4
      core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBox.java
  4. 4
      core/src/main/java/com/github/weisj/darklaf/components/tristate/TristateCheckBoxMenuItem.java
  5. 4
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java
  6. 3
      core/src/main/java/javax/swing/text/DefaultHighlighterDark/DarkHighlightPainter.java

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

@ -43,6 +43,7 @@ import com.github.weisj.darklaf.theme.event.*;
import com.github.weisj.darklaf.theme.info.DefaultThemeProvider; import com.github.weisj.darklaf.theme.info.DefaultThemeProvider;
import com.github.weisj.darklaf.theme.info.PreferredThemeStyle; import com.github.weisj.darklaf.theme.info.PreferredThemeStyle;
import com.github.weisj.darklaf.theme.info.ThemeProvider; import com.github.weisj.darklaf.theme.info.ThemeProvider;
import com.github.weisj.darklaf.theme.laf.ThemedLookAndFeel;
import com.github.weisj.darklaf.util.LogUtil; import com.github.weisj.darklaf.util.LogUtil;
/** /**
@ -320,7 +321,7 @@ public final class LafManager {
* @return true if installed. * @return true if installed.
*/ */
public static boolean isInstalled() { public static boolean isInstalled() {
return theme != null && UIManager.getLookAndFeel() instanceof DarkLaf; return theme != null && UIManager.getLookAndFeel() instanceof ThemedLookAndFeel;
} }
/** /**
@ -374,7 +375,7 @@ public final class LafManager {
* @param theme the theme to install. * @param theme the theme to install.
*/ */
public static void installTheme(final Theme theme) { public static void installTheme(final Theme theme) {
if (theme == getTheme() && UIManager.getLookAndFeel() instanceof DarkLaf) return; if (theme == getTheme() && UIManager.getLookAndFeel() instanceof ThemedLookAndFeel) return;
setTheme(theme); setTheme(theme);
install(); install();
} }

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

@ -29,9 +29,9 @@ import java.util.function.Function;
import javax.swing.*; import javax.swing.*;
import com.github.weisj.darklaf.DarkLaf;
import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.theme.Theme; import com.github.weisj.darklaf.theme.Theme;
import com.github.weisj.darklaf.theme.laf.ThemedLookAndFeel;
public class DarkLineBorder extends MutableLineBorder { public class DarkLineBorder extends MutableLineBorder {
@ -57,7 +57,7 @@ public class DarkLineBorder extends MutableLineBorder {
} }
protected Color getColor(final Component c) { protected Color getColor(final Component c) {
if (!(UIManager.getLookAndFeel() instanceof DarkLaf)) { if (!(UIManager.getLookAndFeel() instanceof ThemedLookAndFeel)) {
currentTheme = null; currentTheme = null;
Color bg = c.getBackground(); Color bg = c.getBackground();
return bg != null ? fallbackSupplier.apply(bg) : null; return bg != null ? fallbackSupplier.apply(bg) : null;

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

@ -30,7 +30,7 @@ import java.awt.event.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import com.github.weisj.darklaf.DarkLaf; import com.github.weisj.darklaf.theme.laf.ThemedLookAndFeel;
public class TristateCheckBox extends JCheckBox { public class TristateCheckBox extends JCheckBox {
private final ChangeListener enableListener = e -> TristateCheckBox.this.setFocusable(getModel().isEnabled()); private final ChangeListener enableListener = e -> TristateCheckBox.this.setFocusable(getModel().isEnabled());
@ -59,7 +59,7 @@ public class TristateCheckBox extends JCheckBox {
} }
public String getUIClassID() { public String getUIClassID() {
if (UIManager.getLookAndFeel() instanceof DarkLaf) { if (UIManager.getLookAndFeel() instanceof ThemedLookAndFeel) {
return "TristateCheckBoxUI"; return "TristateCheckBoxUI";
} else { } else {
return super.getUIClassID(); return super.getUIClassID();

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

@ -32,7 +32,7 @@ import java.awt.event.MouseEvent;
import javax.swing.*; import javax.swing.*;
import com.github.weisj.darklaf.DarkLaf; import com.github.weisj.darklaf.theme.laf.ThemedLookAndFeel;
public class TristateCheckBoxMenuItem extends JCheckBoxMenuItem { public class TristateCheckBoxMenuItem extends JCheckBoxMenuItem {
@ -112,7 +112,7 @@ public class TristateCheckBoxMenuItem extends JCheckBoxMenuItem {
} }
public String getUIClassID() { public String getUIClassID() {
if (UIManager.getLookAndFeel() instanceof DarkLaf) { if (UIManager.getLookAndFeel() instanceof ThemedLookAndFeel) {
return "TristateCheckBoxMenuItemUI"; return "TristateCheckBoxMenuItemUI";
} else { } else {
return super.getUIClassID(); return super.getUIClassID();

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

@ -33,10 +33,10 @@ import javax.swing.*;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicRootPaneUI; import javax.swing.plaf.basic.BasicRootPaneUI;
import com.github.weisj.darklaf.DarkLaf;
import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.LafManager;
import com.github.weisj.darklaf.platform.DecorationsHandler; import com.github.weisj.darklaf.platform.DecorationsHandler;
import com.github.weisj.darklaf.platform.decorations.CustomTitlePane; import com.github.weisj.darklaf.platform.decorations.CustomTitlePane;
import com.github.weisj.darklaf.theme.laf.ThemedLookAndFeel;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil; import com.github.weisj.darklaf.util.PropertyUtil;
@ -131,7 +131,7 @@ public class DarkRootPaneUI extends BasicRootPaneUI implements HierarchyListener
uninstallBorder(root); uninstallBorder(root);
root.removeHierarchyListener(this); root.removeHierarchyListener(this);
if (titlePane != null) { if (titlePane != null) {
boolean removeDecorations = !(UIManager.getLookAndFeel() instanceof DarkLaf) boolean removeDecorations = !(UIManager.getLookAndFeel() instanceof ThemedLookAndFeel)
|| !LafManager.isDecorationsEnabled(); || !LafManager.isDecorationsEnabled();
titlePane.uninstall(removeDecorations); titlePane.uninstall(removeDecorations);
setTitlePane(root, null); setTitlePane(root, null);

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

@ -347,9 +347,6 @@ public class DarkHighlightPainter extends DefaultHighlighter.DefaultHighlightPai
boolean arcBottomRight = nextLineVisible && !roundedBottomRight boolean arcBottomRight = nextLineVisible && !roundedBottomRight
&& rightArcVisible(currentLineRect, nextLineRect); && rightArcVisible(currentLineRect, nextLineRect);
System.out.println(selectionStart + " " + selectionEnd);
System.out.println(posOffs0 + " " + posOffs1);
layerRect = paintRoundRect(g, context, layerRect, layerRect = paintRoundRect(g, context, layerRect,
canRoundLeft && roundedTopLeft, canRoundLeft && roundedTopLeft,
canRoundRight && roundedTopRight, canRoundRight && roundedTopRight,

Loading…
Cancel
Save