Browse Source

Fixed string property for tooltip style not being respected.

pull/97/head
weisj 5 years ago
parent
commit
e33e366adf
  1. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipUI.java
  2. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tooltip/ToolTipUtil.java
  3. 1
      core/src/test/java/ui/toolTip/ToolTipDemo.java

3
core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipUI.java

@ -349,8 +349,9 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe
}
}
private ToolTipStyle getStyle(final Object style) {
public static ToolTipStyle getStyle(final Object style) {
if (style instanceof ToolTipStyle) return (ToolTipStyle) style;
if (style == null) return null;
String name = style.toString();
if (VARIANT_PLAIN_BALLOON.equals(name)) return ToolTipStyle.PLAIN_BALLOON;
if (VARIANT_BALLOON.equals(name)) return ToolTipStyle.BALLOON;

3
core/src/main/java/com/github/weisj/darklaf/ui/tooltip/ToolTipUtil.java

@ -133,7 +133,8 @@ public class ToolTipUtil {
if (context instanceof ToolTipContext) {
return (ToolTipContext) context;
}
if (ToolTipStyle.BALLOON.equals(comp.getClientProperty(DarkTooltipUI.KEY_STYLE))) {
Object style = comp.getClientProperty(DarkTooltipUI.KEY_STYLE);
if (ToolTipStyle.BALLOON.equals(DarkTooltipUI.getStyle(style))) {
return DEFAULT_CONTEXT;
}
return null;

1
core/src/test/java/ui/toolTip/ToolTipDemo.java

@ -47,6 +47,7 @@ public class ToolTipDemo implements ComponentDemo {
.setCenterAlignment(Alignment.SOUTH);
button.putClientProperty(DarkTooltipUI.KEY_CONTEXT, context);
button.setToolTipText("This is the ToolTip demo text!");
button.putClientProperty(DarkTooltipUI.KEY_STYLE, DarkTooltipUI.VARIANT_BALLOON);
JPanel controlPanel = panel.addControls();

Loading…
Cancel
Save