Browse Source

Fixed NPE when accessing evt.getNewValue() on properChange-Events.

Signed-off-by: weisj <weisj@arcor.de>
pull/75/head
weisj 5 years ago
parent
commit
247690e3e5
  1. 4
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java
  2. 2
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java
  3. 3
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

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

@ -51,10 +51,10 @@ public class DarkTableUI extends DarkTableUIBridge {
private final PropertyChangeListener propertyChangeListener = e -> { private final PropertyChangeListener propertyChangeListener = e -> {
String key = e.getPropertyName(); String key = e.getPropertyName();
if ("showHorizontalLines".equals(key)) { if ("showHorizontalLines".equals(key)) {
boolean b = (boolean) e.getNewValue(); boolean b = Boolean.TRUE.equals(e.getNewValue());
table.setRowMargin(b ? 1 : 0); table.setRowMargin(b ? 1 : 0);
} else if ("showVerticalLines".equals(key)) { } else if ("showVerticalLines".equals(key)) {
boolean b = (boolean) e.getNewValue(); boolean b = Boolean.TRUE.equals(e.getNewValue());
table.getColumnModel().setColumnMargin(b ? 1 : 0); table.getColumnModel().setColumnMargin(b ? 1 : 0);
} else if ("ancestor".equals(key)) { } else if ("ancestor".equals(key)) {
Object oldVal = e.getOldValue(); Object oldVal = e.getOldValue();

2
macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java

@ -243,7 +243,7 @@ public class MacOSTitlePane extends CustomTitlePane {
public void propertyChange(final PropertyChangeEvent pce) { public void propertyChange(final PropertyChangeEvent pce) {
String name = pce.getPropertyName(); String name = pce.getPropertyName();
if ("title".equals(name)) { if ("title".equals(name)) {
titleLabel.setText(pce.getNewValue().toString()); titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString());
repaint(); repaint();
} }
} }

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

@ -771,7 +771,7 @@ public class WindowsTitlePane extends CustomTitlePane {
getRootPane().repaint(); getRootPane().repaint();
} }
} else if ("title".equals(name)) { } else if ("title".equals(name)) {
titleLabel.setText(pce.getNewValue().toString()); titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString());
repaint(); repaint();
} else if ("componentOrientation".equals(name)) { } else if ("componentOrientation".equals(name)) {
revalidate(); revalidate();
@ -782,6 +782,7 @@ public class WindowsTitlePane extends CustomTitlePane {
repaint(); repaint();
} else if ("background".equals(name) && pce.getNewValue() instanceof Color) { } else if ("background".equals(name) && pce.getNewValue() instanceof Color) {
Color color = (Color) pce.getNewValue(); Color color = (Color) pce.getNewValue();
if (color == null) return;
JNIDecorationsWindows.setBackground(windowHandle, color.getRed(), color.getGreen(), color.getBlue()); JNIDecorationsWindows.setBackground(windowHandle, color.getRed(), color.getGreen(), color.getBlue());
} }
} }

Loading…
Cancel
Save