Browse Source

Everywhere: Remove calls to internal API SwingUtilities2::shouldIgnore.

pull/245/head
weisj 4 years ago
parent
commit
88cbd8a3a3
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 7
      core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java
  2. 7
      core/src/main/java/com/github/weisj/darklaf/ui/table/TableUIBridge.java
  3. 8
      core/src/main/java/com/github/weisj/darklaf/util/SwingUtil.java

7
core/src/main/java/com/github/weisj/darklaf/ui/list/DarkListUIBridge.java

@ -46,6 +46,7 @@ import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.LazyActionMap; import com.github.weisj.darklaf.util.LazyActionMap;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil; import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.SwingUtil;
/** /**
* An extensible implementation of {@code ListUI}. * An extensible implementation of {@code ListUI}.
@ -2469,7 +2470,7 @@ public abstract class DarkListUIBridge extends BasicListUI {
public void mouseClicked(final MouseEvent e) {} public void mouseClicked(final MouseEvent e) {}
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, list)) { if (SwingUtil.shouldIgnore(e, list)) {
return; return;
} }
@ -2562,7 +2563,7 @@ public abstract class DarkListUIBridge extends BasicListUI {
} }
public void mouseReleased(final MouseEvent e) { public void mouseReleased(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, list)) { if (SwingUtil.shouldIgnore(e, list)) {
return; return;
} }
@ -2591,7 +2592,7 @@ public abstract class DarkListUIBridge extends BasicListUI {
} }
public void mouseDragged(final MouseEvent e) { public void mouseDragged(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, list)) { if (SwingUtil.shouldIgnore(e, list)) {
return; return;
} }

7
core/src/main/java/com/github/weisj/darklaf/ui/table/TableUIBridge.java

@ -43,6 +43,7 @@ import sun.swing.SwingUtilities2;
import com.github.weisj.darklaf.ui.DragRecognitionSupport; import com.github.weisj.darklaf.ui.DragRecognitionSupport;
import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyUtil; import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.SwingUtil;
/** The type Table ui bridge. */ /** The type Table ui bridge. */
public abstract class TableUIBridge extends BasicTableUI { public abstract class TableUIBridge extends BasicTableUI {
@ -573,7 +574,7 @@ public abstract class TableUIBridge extends BasicTableUI {
public void mouseClicked(final MouseEvent e) {} public void mouseClicked(final MouseEvent e) {}
public void mousePressed(final MouseEvent e) { public void mousePressed(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, table)) { if (SwingUtil.shouldIgnore(e, table)) {
return; return;
} }
@ -607,7 +608,7 @@ public abstract class TableUIBridge extends BasicTableUI {
} }
public void mouseReleased(final MouseEvent e) { public void mouseReleased(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, table)) { if (SwingUtil.shouldIgnore(e, table)) {
return; return;
} }
@ -855,7 +856,7 @@ public abstract class TableUIBridge extends BasicTableUI {
} }
public void mouseDragged(final MouseEvent e) { public void mouseDragged(final MouseEvent e) {
if (SwingUtilities2.shouldIgnore(e, table)) { if (SwingUtil.shouldIgnore(e, table)) {
return; return;
} }

8
core/src/main/java/com/github/weisj/darklaf/util/SwingUtil.java

@ -24,8 +24,10 @@ package com.github.weisj.darklaf.util;
import java.awt.Font; import java.awt.Font;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
import java.awt.event.MouseEvent;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import sun.swing.SwingUtilities2; import sun.swing.SwingUtilities2;
@ -59,4 +61,10 @@ public final class SwingUtil {
public static int stringWidth(final JComponent c, final FontMetrics fm, final String string) { public static int stringWidth(final JComponent c, final FontMetrics fm, final String string) {
return SwingUtilities2.stringWidth(c, fm, 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();
}
} }

Loading…
Cancel
Save