java 用Graphics2D画出这样的图片,就是彩票号码
1个回答
展开全部
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class aaaaaaa extends JLabel {
/**
*
*/
private static final long serialVersionUID = 1L;
public aaaaaaa() {
super();
repaint();
}
protected void paintComponent(Graphics g) {
g.setColor(Color.RED);
g.fillOval(50, 50, 30,30);
g.setColor(Color.WHITE);
g.drawString("07",60,68);
}
public static void main(String[] args) {
JLabel rectangle = new aaaaaaa();
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(rectangle);
frame.setSize(300, 300);
frame.setVisible(true);
}
}
效果如下:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询