62,614
社区成员
发帖
与我相关
我的任务
分享
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JPanel;
public class BtnImgBgPanle extends JPanel
{
/**
*
*/
private static final long serialVersionUID = 1L;
private int comWidth;
private int comHeight;
public BtnImgBgPanle()
{
this.comWidth = 100;
this.comHeight = 30;
}
@Override
public void paint(Graphics g)
{
g.setColor(Color.blue);
g.fillRoundRect(0, 0, comWidth, comHeight, 10, 10);
}
}
@Override
public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
// 设置抗锯齿
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.blue);
g.fillRoundRect(0, 0, comWidth, comHeight, 10, 10);
}