diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java index c7a233f0..d8a43223 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java @@ -165,8 +165,8 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { String text = layout(b, c, SwingUtilities2.getFontMetrics(b, g), b.getWidth(), b.getHeight()); paintIcon(g, b, c); + config.restoreClip(); paintText(g, b, text); - config.restore(); } protected void paintButtonBackground(final Graphics g, final JComponent c) { diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java index 84fab9ee..6a5a07cb 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java @@ -35,7 +35,6 @@ import javax.swing.plaf.basic.BasicLabelUI; import sun.swing.SwingUtilities2; import com.github.weisj.darklaf.graphics.GraphicsContext; -import com.github.weisj.darklaf.graphics.GraphicsUtil; import com.github.weisj.darklaf.graphics.PaintUtil; import com.github.weisj.darklaf.ui.cell.CellUtil; import com.github.weisj.darklaf.util.DarkUIUtil; @@ -84,7 +83,7 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener @Override public void paint(final Graphics g, final JComponent c) { - GraphicsContext config = GraphicsUtil.setupAntialiasing(g); + GraphicsContext config = new GraphicsContext(g); JLabel label = (JLabel) c; String text = label.getText(); Icon icon = getIcon(label); @@ -98,6 +97,7 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener if (icon != null) { icon.paintIcon(c, g, paintIconR.x, paintIconR.y); + config.restoreClip(); } PaintUtil.drawString(g, c, clippedText, paintTextR, fm, (g2, c2, rect, t) -> { @@ -107,7 +107,6 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener paintDisabledText(label, g2, t, rect.x, rect.y); } }); - config.restore(); } @Override diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java index 3c702645..a26096cb 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java @@ -41,6 +41,7 @@ import sun.swing.SwingUtilities2; import com.github.weisj.darklaf.components.tabframe.JTabFrame; import com.github.weisj.darklaf.components.tabframe.TabFrameTab; import com.github.weisj.darklaf.components.tabframe.TabFrameTabLabel; +import com.github.weisj.darklaf.graphics.GraphicsContext; import com.github.weisj.darklaf.graphics.PaintUtil; import com.github.weisj.darklaf.icons.RotatableIcon; import com.github.weisj.darklaf.listener.HoverListener; @@ -79,6 +80,7 @@ public class DarkTabFrameTabLabelUI extends DarkLabelUI implements PropertyChang @Override public void paint(final Graphics g, final JComponent c) { + GraphicsContext config = new GraphicsContext(g); g.setColor(getBackground(tabComponent)); g.fillRect(0, 0, tabComponent.getWidth(), tabComponent.getHeight()); @@ -95,6 +97,7 @@ public class DarkTabFrameTabLabelUI extends DarkLabelUI implements PropertyChang if (icon != null) { icon.paintIcon(c, g, paintIconR.x, paintIconR.y); + config.restoreClip(); } PaintUtil.drawString(g, c, clippedText, paintTextR, fm, (g2, c2, rect, t) -> {