Browse Source

Fixed colours of labels not updating when theme is changed.

pull/109/head
weisj 5 years ago
parent
commit
5f934d4356
  1. 14
      core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarUI.java
  3. 5
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderUI.java
  4. 6
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java
  5. 2
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/table.properties
  6. 2
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

14
core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java

@ -45,20 +45,26 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener
protected static final DarkLabelUI darkLabelUI = new DarkLabelUI();
private final Color inactiveForeground;
private final Color cellForegroundNoFocus;
private Color inactiveForeground;
private Color cellForegroundNoFocus;
protected Rectangle paintIconR = new Rectangle();
protected Rectangle paintTextR = new Rectangle();
public DarkLabelUI() {
inactiveForeground = UIManager.getColor("Label.inactiveForeground");
cellForegroundNoFocus = UIManager.getColor("Label.cellForegroundNoFocus");
installUI(null);
}
public static ComponentUI createUI(final JComponent c) {
return darkLabelUI;
}
@Override
public void installUI(final JComponent c) {
if (c != null) super.installUI(c);
//Ensure colors are up to date.
inactiveForeground = UIManager.getColor("Label.inactiveForeground");
cellForegroundNoFocus = UIManager.getColor("Label.cellForegroundNoFocus");
}
@Override
public void paint(final Graphics g, final JComponent c) {

2
core/src/main/java/com/github/weisj/darklaf/ui/scrollpane/DarkScrollBarUI.java

@ -34,7 +34,6 @@ import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicScrollBarUI;
import java.awt.*;
import java.awt.event.*;
import java.util.Arrays;
/**
* @author Konstantin Bulenkov
@ -610,7 +609,6 @@ public class DarkScrollBarUI extends BasicScrollBarUI {
}
private void resetThumbAnimator() {
System.out.println(Arrays.toString(Thread.currentThread().getStackTrace()));
resetAnimators(thumbFadeinAnimator, thumbFadeoutAnimator, mouseOverThumb, thumbAlpha, MAX_THUMB_ALPHA);
}

5
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderUI.java

@ -29,6 +29,7 @@ import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import java.awt.*;
@ -42,7 +43,6 @@ public class DarkTableHeaderUI extends DarkTableHeaderUIBridge {
protected Color borderColor;
protected Color background;
public static ComponentUI createUI(final JComponent c) {
return new DarkTableHeaderUI();
}
@ -56,7 +56,8 @@ public class DarkTableHeaderUI extends DarkTableHeaderUIBridge {
headerHeight = HEADER_HEIGHT;
}
header.setPreferredSize(new Dimension(dim.width, Math.max(dim.height, headerHeight)));
if (header.getDefaultRenderer() instanceof DefaultTableCellRenderer) {
TableCellRenderer defaultRenderer = header.getDefaultRenderer();
if (defaultRenderer instanceof DefaultTableCellRenderer) {
DefaultTableCellRenderer renderer = (DefaultTableCellRenderer) header.getDefaultRenderer();
renderer.setHorizontalAlignment(SwingConstants.LEADING);
}

6
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

@ -130,6 +130,12 @@ public class DarkTableUI extends DarkTableUIBridge {
return false;
}
@Override
public void installUI(final JComponent c) {
super.installUI(c);
}
@Override
protected void installListeners() {
super.installListeners();

2
core/src/main/resources/com/github/weisj/darklaf/properties/ui/table.properties

@ -61,3 +61,5 @@ Table.rowHeight = 22
#Icons
Table.ascendingSortIcon = menu/up.svg[themed](8,16)
Table.descendingSortIcon = menu/down.svg[themed](8,16)
Table.naturalSortIcon = empty(8,16)

2
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

@ -263,12 +263,10 @@ public class WindowsTitlePane extends CustomTitlePane {
}
}
private WindowListener createWindowListener() {
return new WindowsTitlePane.WindowHandler();
}
private PropertyChangeListener createWindowPropertyChangeListener() {
return new PropertyChangeHandler();
}

Loading…
Cancel
Save