用java自带的抗锯齿画圆角矩形,效果比不开好很多!
主要代码:
@Override
public void paint(Graphics g)
{
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(Color.blue);
g2d.drawRoundRect(0, 0, 150, 30, 10, 10);
}
2022-05-17 18:59:02
4KB
java
1