Skip to content

Commit

Permalink
Everywhere: Remove calls to internal API SwingUtilities2::shouldIgnore.
Browse files Browse the repository at this point in the history
  • Loading branch information
weisJ committed May 18, 2021
1 parent 1d7127a commit 88cbd8a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.github.weisj.darklaf.util.LazyActionMap;
import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.SwingUtil;

/**
* An extensible implementation of {@code ListUI}.
Expand Down Expand Up @@ -2469,7 +2470,7 @@ public void valueChanged(final ListSelectionEvent e) {
public void mouseClicked(final MouseEvent e) {}

public void mousePressed(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, list)) {
if (SwingUtil.shouldIgnore(e, list)) {
return;
}

Expand Down Expand Up @@ -2562,7 +2563,7 @@ protected void adjustSelection(final MouseEvent e) {
}

public void mouseReleased(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, list)) {
if (SwingUtil.shouldIgnore(e, list)) {
return;
}

Expand Down Expand Up @@ -2591,7 +2592,7 @@ public void dragStarting(final MouseEvent me) {
}

public void mouseDragged(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, list)) {
if (SwingUtil.shouldIgnore(e, list)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.github.weisj.darklaf.ui.DragRecognitionSupport;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.SwingUtil;

/** The type Table ui bridge. */
public abstract class TableUIBridge extends BasicTableUI {
Expand Down Expand Up @@ -573,7 +574,7 @@ public void keyTyped(final KeyEvent e) {
public void mouseClicked(final MouseEvent e) {}

public void mousePressed(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, table)) {
if (SwingUtil.shouldIgnore(e, table)) {
return;
}

Expand Down Expand Up @@ -607,7 +608,7 @@ public void mousePressed(final MouseEvent e) {
}

public void mouseReleased(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, table)) {
if (SwingUtil.shouldIgnore(e, table)) {
return;
}

Expand Down Expand Up @@ -855,7 +856,7 @@ public void dragStarting(final MouseEvent me) {
}

public void mouseDragged(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, table)) {
if (SwingUtil.shouldIgnore(e, table)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.MouseEvent;

import javax.swing.JComponent;
import javax.swing.SwingUtilities;

import sun.swing.SwingUtilities2;

Expand Down Expand Up @@ -59,4 +61,10 @@ public static void drawString(final JComponent c, final Graphics g, final String
public static int stringWidth(final JComponent c, final FontMetrics fm, final String string) {
return SwingUtilities2.stringWidth(c, fm, string);
}

public static boolean shouldIgnore(final MouseEvent me, final JComponent c) {
return c == null || !c.isEnabled()
|| !SwingUtilities.isLeftMouseButton(me)
|| me.isConsumed();
}
}

0 comments on commit 88cbd8a

Please sign in to comment.