Browse Source

Fixed text not painted for buttons, labels.

pull/170/head
weisj 5 years ago
parent
commit
2f21427283
  1. 2
      core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java
  2. 5
      core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java
  3. 3
      core/src/main/java/com/github/weisj/darklaf/ui/tabframe/DarkTabFrameTabLabelUI.java

2
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) {

5
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

3
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) -> {

Loading…
Cancel
Save