java在JFrame上加文字Demo,用重写JPanel的public void paint(Graphics g)方法实现即可,主要代码:
@Override
public void paint(Graphics g)
{
super.paint(g);
Font font = new Font("宋体",Font.PLAIN,30);
g.setColor(Color.RED);
g.setFont(font);
g.drawString("30pt 宋体",50,200);
}
2022-02-25 15:51:57
3KB
java
1