From 8302cc0462080a88fc043e3f23e0c63dd4cd3eea Mon Sep 17 00:00:00 2001 From: weisj Date: Tue, 15 Oct 2019 23:20:41 +0200 Subject: [PATCH] Fixed text background. --- .../darklaf/ui/text/DarkEditorPaneUI.java | 3 +- .../darklaf/properties/ui/text.properties | 11 ++++ .../theme/darcula/darcula_defaults.properties | 2 +- src/test/java/ScrollPaneDemo.java | 29 +---------- src/test/java/TabFrameDemo.java | 14 ++++-- src/test/java/TestResources.java | 50 +++++++++++++++++++ 6 files changed, 73 insertions(+), 36 deletions(-) create mode 100644 src/test/java/TestResources.java diff --git a/src/main/java/com/weis/darklaf/ui/text/DarkEditorPaneUI.java b/src/main/java/com/weis/darklaf/ui/text/DarkEditorPaneUI.java index 1febbe5e..e75cd043 100644 --- a/src/main/java/com/weis/darklaf/ui/text/DarkEditorPaneUI.java +++ b/src/main/java/com/weis/darklaf/ui/text/DarkEditorPaneUI.java @@ -84,8 +84,7 @@ public class DarkEditorPaneUI extends DarkTextUI { */ public void installUI(final JComponent c) { super.installUI(c); - updateDisplayProperties(c.getFont(), - c.getForeground()); + updateDisplayProperties(c.getFont(), c.getForeground()); } void updateDisplayProperties(final Font font, final Color fg) { diff --git a/src/main/resources/com/weis/darklaf/properties/ui/text.properties b/src/main/resources/com/weis/darklaf/properties/ui/text.properties index ac928ca4..70b1ee75 100644 --- a/src/main/resources/com/weis/darklaf/properties/ui/text.properties +++ b/src/main/resources/com/weis/darklaf/properties/ui/text.properties @@ -49,22 +49,33 @@ TextField.borderThickness = %borderThickness TextPane.selectionBackground = %textSelectionBackground TextPane.selectionForeground = %textSelectionForeground +TextPane.background = %textBackground +TextPane.disabledBackground = %textBackgroundInactive + EditorPane.selectionBackground = %textSelectionBackground EditorPane.selectionForeground = %textSelectionForeground +EditorPane.background = %textBackground +EditorPane.disabledBackground = %textBackgroundInactive + TextArea.selectionBackground = %textSelectionBackground TextArea.selectionForeground = %textSelectionForeground TextArea.background = %textBackground +TextArea.disabledBackground = %textBackgroundInactive + FormattedTextFieldUI = com.weis.darklaf.ui.text.DarkFormattedTextFieldUI FormattedTextField.border = com.weis.darklaf.ui.text.DarkTextBorder FormattedTextField.background = %textBackground +FormattedTextField.disabledBackground = %textBackgroundInactive + FormattedTextField.selectionBackground = %textSelectionBackground FormattedTextField.selectionForeground = %textSelectionForeground PasswordFieldUI = com.weis.darklaf.ui.text.DarkPasswordFieldUI PasswordField.background = %textBackground +PasswordField.disabledBackground = %textBackgroundInactive PasswordField.selectionBackground = %textSelectionBackground PasswordField.selectionForeground = %textSelectionForeground PasswordField.border = com.weis.darklaf.ui.text.DarkTextBorder diff --git a/src/main/resources/com/weis/darklaf/theme/darcula/darcula_defaults.properties b/src/main/resources/com/weis/darklaf/theme/darcula/darcula_defaults.properties index 17741088..2dd64e56 100644 --- a/src/main/resources/com/weis/darklaf/theme/darcula/darcula_defaults.properties +++ b/src/main/resources/com/weis/darklaf/theme/darcula/darcula_defaults.properties @@ -97,7 +97,7 @@ acceleratorForeground = eeeeee textSelectionForeground = bbbbbb textSelectionForegroundInactive = bbbbbb -textSelectionBackground = 2852a0 +textSelectionBackground = 214283 #currentLineBackground textSelectionBackgroundSecondary = 323232 textBackground = 45494a diff --git a/src/test/java/ScrollPaneDemo.java b/src/test/java/ScrollPaneDemo.java index 3d5ab631..981d8cfa 100644 --- a/src/test/java/ScrollPaneDemo.java +++ b/src/test/java/ScrollPaneDemo.java @@ -18,35 +18,8 @@ public final class ScrollPaneDemo extends MultiSplitLayout { frame.setSize(500, 500); var overlayScroll = new JScrollPane(new JEditorPane() {{ setEditorKit(new HTMLEditorKit()); - setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tempor quis nibh a semper. Nullam" - + " auctor, erat non viverra commodo, libero orci aliquam quam, ac interdum nunc est sed " - + "ligula. Aliquam vel velit non dolor accumsan blandit id eu metus. Aenean iaculis urna in " - + "placerat aliquam. Aliquam dui quam, bibendum sed magna in, cursus ornare est. Quisque " - + "tempor nunc quis nunc tempor convallis. Vestibulum tristique luctus ante, ac hendrerit dui" - + ".\n" - + "\n" - + "Donec ut maximus augue. Nam eleifend maximus scelerisque. Duis varius accumsan est, non " - + "aliquam dolor. Aenean iaculis nibh in aliquam viverra. Sed laoreet, urna ut facilisis " - + "convallis, arcu turpis vestibulum augue, id convallis tellus metus nec orci. Lorem ipsum " - + "dolor sit amet, consectetur adipiscing elit. Donec hendrerit purus velit, at blandit elit " - + "luctus ut. Proin diam nisl, sodales vitae dignissim nec, eleifend eu libero. Maecenas odio" - + " ligula, fermentum eget nisl vel, cursus tristique est. In nec nibh nec dui tempor " - + "ullamcorper. Praesent tincidunt luctus sem, ut luctus dolor commodo non. Nulla consectetur" - + " facilisis dolor, in facilisis ligula fringilla et. Cras id placerat libero. Donec " - + "vehicula orci a quam rutrum, eu efficitur lorem iaculis. Aenean varius nisi in dictum " - + "accumsan.\n" - + "\n" - + "Nulla massa ipsum, consectetur non gravida ut, blandit quis velit. Ut pretium quam aliquam" - + " diam porttitor mattis. Nam ullamcorper, felis ut iaculis iaculis, nunc odio pulvinar " - + "enim, vitae iaculis turpis sapien iaculis metus. Donec rutrum varius augue in dictum. Cras" - + " vestibulum vitae mauris ut finibus. Ut dictum imperdiet lorem et imperdiet. Vivamus " - + "semper tempor dolor eu porta. Sed at vehicula nisl. Pellentesque ut lorem tincidunt, " - + "elementum ligula at, porta turpis. Praesent feugiat dolor diam, at facilisis metus gravida" - + " non. Aliquam quis pellentesque nibh. Sed vestibulum porttitor nisi. In vitae malesuada " - + "sapien."); -// setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + setText(TestResources.LOREM_IPSUM); setFont(Font.getFont(Font.MONOSPACED)); - }}); frame.setContentPane(new JPanel(new BorderLayout()) {{ add(overlayScroll, BorderLayout.CENTER); diff --git a/src/test/java/TabFrameDemo.java b/src/test/java/TabFrameDemo.java index 83e6d9eb..f22d1619 100644 --- a/src/test/java/TabFrameDemo.java +++ b/src/test/java/TabFrameDemo.java @@ -1,11 +1,11 @@ import com.weis.darklaf.LafManager; +import com.weis.darklaf.components.OverlayScrollPane; import com.weis.darklaf.components.alignment.Alignment; import com.weis.darklaf.components.tabframe.TabFrame; import com.weis.darklaf.components.tabframe.TabbedPopup; import com.weis.darklaf.icons.IconLoader; import javax.swing.*; -import javax.swing.border.EmptyBorder; import java.awt.*; /* @@ -48,7 +48,6 @@ public class TabFrameDemo { for (int i = 0; i < 2; i++) { var pcc = new JPanel(); pcc.setOpaque(true); - pcc.setBackground(Color.YELLOW.darker().darker()); pcc.add(new JLabel(o.toString() + "_" + i + " Popup")); tabFrame.addTab(pcc, o.toString() + "_" + i, folderIcon, o); } @@ -58,22 +57,27 @@ public class TabFrameDemo { tabFrame.setTabAt(tabbedPopup, "NORTH (Tabbed Pane Tab)", null, Alignment.NORTH, 0); for (int i = 0; i < 5; i++) { var panel = new JPanel(); - var label = new JLabel("inside tab " + i); + var label = new JLabel("Tab Number " + i); panel.add(label); - panel.setBackground(Color.GREEN.darker().darker()); tabbedPopup.getTabbedPane().addTab("Tab " + i, panel); } + /* Activate for custom tab demo. tabFrame.setUserTabComponentAt(new JLabel("NORTH (custom tab)") {{ setBorder(new EmptyBorder(0, 5, 0, 5)); setOpaque(false); setForeground(Color.RED); setFont(new Font(Font.SERIF, Font.ITALIC, 12)); }}, Alignment.NORTH, 1); - + */ tabFrame.setAcceleratorAt(1, Alignment.NORTH_WEST, 0); var contentPane = new JPanel(new BorderLayout()); + var overlayScroll = new OverlayScrollPane(new JTextPane() {{ + setText(TestResources.LOREM_IPSUM); + setFont(Font.getFont(Font.MONOSPACED)); + }}); + contentPane.add(overlayScroll, BorderLayout.CENTER); frame.setContentPane(tabFrame); tabFrame.setContent(contentPane); diff --git a/src/test/java/TestResources.java b/src/test/java/TestResources.java new file mode 100644 index 00000000..2f73075e --- /dev/null +++ b/src/test/java/TestResources.java @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2019 Jannis Weis + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +public class TestResources { + public static final String LOREM_IPSUM = + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In tempor quis nibh a semper. Nullam" + + " auctor, erat non viverra commodo, libero orci aliquam quam, ac interdum nunc est sed " + + "ligula. Aliquam vel velit non dolor accumsan blandit id eu metus. Aenean iaculis urna in " + + "placerat aliquam. Aliquam dui quam, bibendum sed magna in, cursus ornare est. Quisque " + + "tempor nunc quis nunc tempor convallis. Vestibulum tristique luctus ante, ac hendrerit dui" + + ".\n\n" + + "Donec ut maximus augue. Nam eleifend maximus scelerisque. Duis varius accumsan est, non " + + "aliquam dolor. Aenean iaculis nibh in aliquam viverra. Sed laoreet, urna ut facilisis " + + "convallis, arcu turpis vestibulum augue, id convallis tellus metus nec orci. Lorem ipsum " + + "dolor sit amet, consectetur adipiscing elit. Donec hendrerit purus velit, at blandit elit " + + "luctus ut. Proin diam nisl, sodales vitae dignissim nec, eleifend eu libero. Maecenas odio" + + " ligula, fermentum eget nisl vel, cursus tristique est. In nec nibh nec dui tempor " + + "ullamcorper. Praesent tincidunt luctus sem, ut luctus dolor commodo non. Nulla consectetur" + + " facilisis dolor, in facilisis ligula fringilla et. Cras id placerat libero. Donec " + + "vehicula orci a quam rutrum, eu efficitur lorem iaculis. Aenean varius nisi in dictum " + + "accumsan.\n\n" + + "Nulla massa ipsum, consectetur non gravida ut, blandit quis velit. Ut pretium quam aliquam" + + " diam porttitor mattis. Nam ullamcorper, felis ut iaculis iaculis, nunc odio pulvinar " + + "enim, vitae iaculis turpis sapien iaculis metus. Donec rutrum varius augue in dictum. Cras" + + " vestibulum vitae mauris ut finibus. Ut dictum imperdiet lorem et imperdiet. Vivamus " + + "semper tempor dolor eu porta. Sed at vehicula nisl. Pellentesque ut lorem tincidunt, " + + "elementum ligula at, porta turpis. Praesent feugiat dolor diam, at facilisis metus gravida" + + " non. Aliquam quis pellentesque nibh. Sed vestibulum porttitor nisi. In vitae malesuada " + + "sapien."; +}