From 88331ee2ada990346215b8b5592213d906e51d8f Mon Sep 17 00:00:00 2001 From: weisj Date: Mon, 30 Mar 2020 01:50:35 +0200 Subject: [PATCH] Made theme consistent across demo classes. Added *.disabledText to globals. Fixed incorrect disabled foreground for labels. Adjusted radioButton baseline offset. Adjusted some values for dark high contrast theme. --- .../weisj/darklaf/ui/label/DarkLabelUI.java | 2 +- .../darklaf/properties/globals.properties | 3 +- .../properties/ui/radioButton.properties | 2 +- .../high_contrast_dark_defaults.properties | 4 +- .../high_contrast_dark_icons.properties | 2 +- .../high_contrast_dark_ui.properties | 2 +- core/src/test/java/icon/AllIcons.java | 3 +- core/src/test/java/ui/ComponentDemo.java | 6 +- .../ui/colorChooser/ColorChooserDemo.java | 3 +- core/src/test/java/ui/dialog/DialogDemo.java | 4 +- .../java/ui/fileChooser/FileChooserDemo.java | 3 +- .../ui/internalFrame/InternalFrameDemo.java | 3 +- .../TabbedPaneKeyboardShortcut.java | 59 ++++++++----------- 13 files changed, 49 insertions(+), 47 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java index fa2c1113..5448db59 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java @@ -152,7 +152,7 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener } } } else { - g.setColor(l.getForeground()); + g.setColor(inactiveForeground); } SwingUtilities2.drawStringUnderlineCharAt(l, g, s, accChar, textX, textY); diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/globals.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/globals.properties index f1e46061..53f2c56a 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/globals.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/globals.properties @@ -30,6 +30,7 @@ global.caretForeground = %caret global.textForeground = %textForeground global.foreground = %textForeground global.selectionInactiveForeground = %textForegroundInactive +global.disabledText = %textForegroundInactive global.selectionForeground = %textSelectionForeground global.selectionForegroundInactive = %textSelectionForegroundInactive global.selectionBackground = %textSelectionBackground @@ -48,4 +49,4 @@ ArrowButton.down.icon = navigation/arrowDown.svg[themed] link.foreground = %hyperlink Hyperlink.linkColor = %hyperlink swing.boldMetal = false -Highlight.arc = %arc \ No newline at end of file +Highlight.arc = %arc diff --git a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/radioButton.properties b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/radioButton.properties index 03d8a2dc..4458eac8 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/properties/ui/radioButton.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/properties/ui/radioButton.properties @@ -38,7 +38,7 @@ RadioButton.activeBorderColor = %controlBorder RadioButton.inactiveBorderColor = %controlBorderDisabled RadioButton.borderInsets = 4,4,4,4 -RadioButton.iconBaselineOffset = 2 +RadioButton.iconBaselineOffset = 1 #Icons RadioButton.icon = {control/radio.svg[themed](19,19);\ diff --git a/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties b/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties index bb03363d..3b7db79b 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_defaults.properties @@ -41,7 +41,7 @@ Theme.dark = true %backgroundHoverColorful = 7E00D9 %backgroundSelectedColorful = 7E00D9 -%dropBackground = 000000 +%dropBackground = FFFFFF %dropForeground = 00EAFF ####Border#### @@ -129,7 +129,7 @@ Theme.dark = true %shadow = 000000 %glowOpacity = 100 -%dropOpacity = 80 +%dropOpacity = 50 %shadowOpacity = 0 %glowFocus = 1AEBFF diff --git a/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties b/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties index 83f6d215..65cd2f5f 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_icons.properties @@ -26,7 +26,7 @@ %menuIconHovered = FFFFFF %menuIconSelected = FFFFFF %menuIconSelectedSecondary = FFFFFF -%menuIconDisabled = 5B5B5B +%menuIconDisabled = AA6E28 %menuIconHighlight = 1AEBFF %fileIconBackground = FFFFFF diff --git a/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties b/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties index 4e10e509..4510f25a 100644 --- a/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties +++ b/core/src/main/resources/com/github/weisj/darklaf/theme/high_contrast_dark/high_contrast_dark_ui.properties @@ -22,7 +22,7 @@ # SOFTWARE. # # suppress inspection "UnusedProperty" for whole file -ColorChooser.swatchesDefaultRecentColor = FFFFFF +ColorChooser.swatchesDefaultRecentColor = 000000 Button.borderless.drawOutline = true ToolTip.paintShadow = false ScrollBar.fadeEndColor = %ScrollBar.fadeStartColor diff --git a/core/src/test/java/icon/AllIcons.java b/core/src/test/java/icon/AllIcons.java index d1937f59..30d93c66 100644 --- a/core/src/test/java/icon/AllIcons.java +++ b/core/src/test/java/icon/AllIcons.java @@ -30,6 +30,7 @@ import com.github.weisj.darklaf.icons.IconLoader; import com.github.weisj.darklaf.icons.ThemedSVGIcon; import com.github.weisj.darklaf.util.Pair; import com.kitfox.svg.app.beans.SVGIcon; +import ui.ComponentDemo; import javax.swing.*; import javax.swing.event.ListDataListener; @@ -55,7 +56,7 @@ public class AllIcons { public static void main(final String[] args) { SwingUtilities.invokeLater(() -> { - LafManager.install(); + LafManager.install(ComponentDemo.getTheme()); try { JFrame frame = new JFrame("Icons"); JList> list = new JList<>(new ListModel>() { diff --git a/core/src/test/java/ui/ComponentDemo.java b/core/src/test/java/ui/ComponentDemo.java index e5adbc15..59ed04a9 100644 --- a/core/src/test/java/ui/ComponentDemo.java +++ b/core/src/test/java/ui/ComponentDemo.java @@ -32,6 +32,10 @@ import java.awt.event.ActionEvent; public interface ComponentDemo { + static Theme getTheme() { + return new IntelliJTheme(); + } + JComponent createComponent(); static void showDemo(final ComponentDemo demo) { @@ -40,7 +44,7 @@ public interface ComponentDemo { static void showDemo(final ComponentDemo demo, final Dimension dimension) { SwingUtilities.invokeLater(() -> { - LafManager.install(); + LafManager.install(getTheme()); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setTitle(demo.getTitle()); diff --git a/core/src/test/java/ui/colorChooser/ColorChooserDemo.java b/core/src/test/java/ui/colorChooser/ColorChooserDemo.java index 96968c3f..0af9a3df 100644 --- a/core/src/test/java/ui/colorChooser/ColorChooserDemo.java +++ b/core/src/test/java/ui/colorChooser/ColorChooserDemo.java @@ -24,6 +24,7 @@ package ui.colorChooser; import com.github.weisj.darklaf.LafManager; +import ui.ComponentDemo; import javax.swing.*; import java.awt.*; @@ -32,7 +33,7 @@ public final class ColorChooserDemo { public static void main(final String[] args) { SwingUtilities.invokeLater(() -> { - LafManager.install(); + LafManager.install(ComponentDemo.getTheme()); /* * In newer versions of the JDK you can control whether the transparency slider is visible or not. */ diff --git a/core/src/test/java/ui/dialog/DialogDemo.java b/core/src/test/java/ui/dialog/DialogDemo.java index 4962bd1d..e55a2fb9 100644 --- a/core/src/test/java/ui/dialog/DialogDemo.java +++ b/core/src/test/java/ui/dialog/DialogDemo.java @@ -25,7 +25,7 @@ package ui.dialog; import com.github.weisj.darklaf.LafManager; -import com.github.weisj.darklaf.theme.DarculaTheme; +import ui.ComponentDemo; import javax.swing.*; import javax.swing.border.Border; @@ -90,7 +90,7 @@ public class DialogDemo extends JPanel { public static void main(final String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. - LafManager.install(new DarculaTheme()); + LafManager.install(ComponentDemo.getTheme()); javax.swing.SwingUtilities.invokeLater(DialogDemo::createAndShowGUI); } diff --git a/core/src/test/java/ui/fileChooser/FileChooserDemo.java b/core/src/test/java/ui/fileChooser/FileChooserDemo.java index ac0ad1cc..dd620df4 100644 --- a/core/src/test/java/ui/fileChooser/FileChooserDemo.java +++ b/core/src/test/java/ui/fileChooser/FileChooserDemo.java @@ -24,6 +24,7 @@ package ui.fileChooser; import com.github.weisj.darklaf.LafManager; +import ui.ComponentDemo; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; @@ -32,7 +33,7 @@ public final class FileChooserDemo { public static void main(final String[] args) { SwingUtilities.invokeLater(() -> { - LafManager.install(); + LafManager.install(ComponentDemo.getTheme()); JFileChooser chooser = new JFileChooser(System.getProperty("user.home")); chooser.addChoosableFileFilter(new FileNameExtensionFilter("Test Filter", ".svg")); chooser.setMultiSelectionEnabled(true); diff --git a/core/src/test/java/ui/internalFrame/InternalFrameDemo.java b/core/src/test/java/ui/internalFrame/InternalFrameDemo.java index 562445f0..2783bbe4 100644 --- a/core/src/test/java/ui/internalFrame/InternalFrameDemo.java +++ b/core/src/test/java/ui/internalFrame/InternalFrameDemo.java @@ -24,6 +24,7 @@ package ui.internalFrame; import com.github.weisj.darklaf.LafManager; +import ui.ComponentDemo; import javax.swing.*; import java.awt.*; @@ -94,7 +95,7 @@ public class InternalFrameDemo extends JFrame implements ActionListener { * Create the GUI and show it. For thread safety, this method should be invoked from the event-dispatching thread. */ private static void createAndShowGUI() { - LafManager.install(); + LafManager.install(ComponentDemo.getTheme()); //Create and set up the window. InternalFrameDemo frame = new InternalFrameDemo(); diff --git a/core/src/test/java/ui/tabbedPane/TabbedPaneKeyboardShortcut.java b/core/src/test/java/ui/tabbedPane/TabbedPaneKeyboardShortcut.java index 19e20e69..12feb815 100644 --- a/core/src/test/java/ui/tabbedPane/TabbedPaneKeyboardShortcut.java +++ b/core/src/test/java/ui/tabbedPane/TabbedPaneKeyboardShortcut.java @@ -23,48 +23,41 @@ */ package ui.tabbedPane; -import com.github.weisj.darklaf.LafManager; +import ui.ComponentDemo; import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; -public class TabbedPaneKeyboardShortcut extends JPanel { - public TabbedPaneKeyboardShortcut() { - initializeUI(); - } - - private void initializeUI() { - LafManager.install(); - this.setLayout(new BorderLayout()); - this.setPreferredSize(new Dimension(500, 200)); - - JTabbedPane pane = new JTabbedPane(); - pane.addTab("A Tab", new JPanel()); - pane.addTab("B Tab", new JPanel()); - pane.addTab("C Tab", new JPanel()); - pane.addTab("D Tab", new JPanel()); - - pane.setMnemonicAt(0, KeyEvent.VK_A); - pane.setMnemonicAt(1, KeyEvent.VK_B); - pane.setMnemonicAt(2, KeyEvent.VK_C); - pane.setMnemonicAt(3, KeyEvent.VK_D); - - this.add(pane, BorderLayout.CENTER); - } +public class TabbedPaneKeyboardShortcut implements ComponentDemo { public static void main(final String[] args) { - SwingUtilities.invokeLater(() -> TabbedPaneKeyboardShortcut.showFrame()); + ComponentDemo.showDemo(new TabbedPaneKeyboardShortcut()); } - public static void showFrame() { - JPanel panel = new TabbedPaneKeyboardShortcut(); - panel.setOpaque(true); + @Override + public JComponent createComponent() { + JPanel panel = new JPanel(); + panel.setLayout(new BorderLayout()); + panel.setPreferredSize(new Dimension(500, 200)); + + JTabbedPane tabbedPane = new JTabbedPane(); + tabbedPane.addTab("A Tab", new JPanel()); + tabbedPane.addTab("B Tab", new JPanel()); + tabbedPane.addTab("C Tab", new JPanel()); + tabbedPane.addTab("D Tab", new JPanel()); + + tabbedPane.setMnemonicAt(0, KeyEvent.VK_A); + tabbedPane.setMnemonicAt(1, KeyEvent.VK_B); + tabbedPane.setMnemonicAt(2, KeyEvent.VK_C); + tabbedPane.setMnemonicAt(3, KeyEvent.VK_D); + + panel.add(tabbedPane, BorderLayout.CENTER); + return panel; + } - JFrame frame = new JFrame("JTabbedPane Demo"); - frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - frame.setContentPane(panel); - frame.pack(); - frame.setVisible(true); + @Override + public String getTitle() { + return "Tabbed Pane Keyboard Shortcut Demo"; } }