Browse Source

Everywhere: Move calls to internal API SwingUtilities2::clipStringIfNecessary into SwingUtil.

pull/245/head
weisj 4 years ago
parent
commit
e5a5bfda7f
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java
  2. 13
      core/src/main/java/com/github/weisj/darklaf/util/SwingUtil.java

2
core/src/main/java/com/github/weisj/darklaf/ui/tabbedpane/DarkTabbedPaneUIBridge.java

@ -484,7 +484,7 @@ public abstract class DarkTabbedPaneUIBridge extends TabbedPaneUI implements Swi
String clippedTitle = title;
if (!scrollableTabLayoutEnabled() && isHorizontalTabPlacement()) {
clippedTitle = SwingUtilities2.clipStringIfNecessary(null, metrics, title, textRect.width);
clippedTitle = SwingUtil.clipStringIfNecessary(null, metrics, title, textRect.width);
}
paintText(g, tabPlacement, font, metrics, tabIndex, clippedTitle, textRect, isSelected);

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

@ -52,6 +52,15 @@ public final class SwingUtil {
SwingUtilities2.setSkipClickCount(comp, count);
}
public static int stringWidth(final JComponent c, final FontMetrics fm, final String string) {
return SwingUtilities2.stringWidth(c, fm, string);
}
public static String clipStringIfNecessary(final JComponent c, final FontMetrics fm,
final String string, int availTextWidth) {
return SwingUtilities2.clipStringIfNecessary(c, fm, string, availTextWidth);
}
public static FontMetrics getFontMetrics(final JComponent c, final Graphics g) {
if (g == null) throw new IllegalArgumentException("Graphics must not be null");
return getFontMetrics(c, g.getFont());
@ -66,10 +75,6 @@ public final class SwingUtil {
return c.getFontMetrics(font);
}
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)

Loading…
Cancel
Save