Skip to content

Commit

Permalink
SplitButton: Respect JComponent#isRequestFocusEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
weisJ committed May 2, 2022
1 parent c89d617 commit 6c875ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@
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;
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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -79,7 +79,8 @@ public void propertyChange(final PropertyChangeEvent evt) {
@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();
}
}
Expand Down

0 comments on commit 6c875ec

Please sign in to comment.