Browse Source

Enable balloon tooltips for buttons by default.

pull/170/head
weisj 5 years ago
parent
commit
b4f5ab8b97
  1. 2
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  2. 1
      core/src/test/java/ui/button/ButtonDemo.java

2
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java

@ -44,6 +44,7 @@ import com.github.weisj.darklaf.graphics.GraphicsUtil;
import com.github.weisj.darklaf.graphics.PaintUtil; import com.github.weisj.darklaf.graphics.PaintUtil;
import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonKeyHandler; import com.github.weisj.darklaf.ui.togglebutton.DarkToggleButtonKeyHandler;
import com.github.weisj.darklaf.ui.togglebutton.ToggleButtonFocusNavigationActions; import com.github.weisj.darklaf.ui.togglebutton.ToggleButtonFocusNavigationActions;
import com.github.weisj.darklaf.ui.tooltip.ToolTipConstants;
import com.github.weisj.darklaf.util.AlignmentExt; import com.github.weisj.darklaf.util.AlignmentExt;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
@ -104,6 +105,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants {
@Override @Override
protected void installDefaults(final AbstractButton b) { protected void installDefaults(final AbstractButton b) {
super.installDefaults(b); super.installDefaults(b);
PropertyUtil.installProperty(b, ToolTipConstants.KEY_STYLE, ToolTipConstants.VARIANT_BALLOON);
LookAndFeel.installProperty(b, PropertyKey.OPAQUE, false); LookAndFeel.installProperty(b, PropertyKey.OPAQUE, false);
borderSize = UIManager.getInt("Button.borderThickness"); borderSize = UIManager.getInt("Button.borderThickness");
shadowHeight = UIManager.getInt("Button.shadowHeight"); shadowHeight = UIManager.getInt("Button.shadowHeight");

1
core/src/test/java/ui/button/ButtonDemo.java

@ -46,6 +46,7 @@ public class ButtonDemo implements ComponentDemo {
public JComponent createComponent() { public JComponent createComponent() {
Icon icon = DemoResources.FOLDER_ICON; Icon icon = DemoResources.FOLDER_ICON;
JButton button = new JButton("Test Button", icon); JButton button = new JButton("Test Button", icon);
button.setToolTipText("TipText");
DemoPanel panel = new DemoPanel(button); DemoPanel panel = new DemoPanel(button);
JPanel controlPanel = panel.addControls(); JPanel controlPanel = panel.addControls();
controlPanel.add(new JCheckBox("enabled") { controlPanel.add(new JCheckBox("enabled") {

Loading…
Cancel
Save