Browse Source

Fixed text background.

pull/15/head
weisj 5 years ago
parent
commit
8302cc0462
  1. 3
      src/main/java/com/weis/darklaf/ui/text/DarkEditorPaneUI.java
  2. 11
      src/main/resources/com/weis/darklaf/properties/ui/text.properties
  3. 2
      src/main/resources/com/weis/darklaf/theme/darcula/darcula_defaults.properties
  4. 29
      src/test/java/ScrollPaneDemo.java
  5. 14
      src/test/java/TabFrameDemo.java
  6. 50
      src/test/java/TestResources.java

3
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) {

11
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

2
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

29
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("<body>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);

14
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);

50
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.";
}
Loading…
Cancel
Save