Browse Source

SplitButton: Respect JComponent#isRequestFocusEnabled

pull/323/head
Jannis Weis 3 years ago
parent
commit
6c875ec0d0
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 3
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java
  2. 5
      core/src/main/java/com/github/weisj/darklaf/ui/splitbutton/DarkSplitButtonListener.java

3
core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java

@ -27,6 +27,8 @@ import javax.swing.border.Border;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.UIResource;
import org.jetbrains.annotations.NotNull;
import com.github.weisj.darklaf.graphics.PaintUtil;
import com.github.weisj.darklaf.ui.util.DarkUIUtil;
import com.github.weisj.darklaf.util.AlignmentExt;
@ -34,7 +36,6 @@ import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.graphics.GraphicsContext;
import com.github.weisj.darklaf.util.graphics.GraphicsUtil;
import com.github.weisj.swingdsl.visualpadding.VisualPaddingProvider;
import org.jetbrains.annotations.NotNull;
/** @author Jannis Weis */
public class DarkButtonBorder implements Border, UIResource, VisualPaddingProvider {

5
core/src/main/java/com/github/weisj/darklaf/ui/splitbutton/DarkSplitButtonListener.java

@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2019-2021 Jannis Weis
* Copyright (c) 2019-2022 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,
@ -79,7 +79,8 @@ public class DarkSplitButtonListener implements ActionListener, PropertyChangeLi
@Override
public void stateChanged(final ChangeEvent e) {
ui.splitButton.repaint();
if (!ui.splitButton.hasFocus() && ui.arrowButton.getModel().isPressed()) {
if (!ui.splitButton.hasFocus() && ui.arrowButton.isRequestFocusEnabled()
&& ui.arrowButton.getModel().isPressed()) {
ui.splitButton.requestFocusInWindow();
}
}

Loading…
Cancel
Save