3个回答
展开全部
package test;
import javax.swing.JPanel;
import java.awt.*;
import java.awt.event.WindowAdapter;
import javax.swing.JFrame;
class PaintovalPane extends JPanel {
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.pink);
g.fillOval(300, 300, 100, 100);
}
}
class PaintovalFrame extends JFrame {
public PaintovalFrame() {
setTitle("圆");
setSize(1000, 1000);
addWindowListener(new WindowAdapter() {
});
Container contentPane = getContentPane();
contentPane.add(new PaintovalPane());
}
}
public class Paintoval {
public static void main(String[] args) {
JFrame f = new PaintovalFrame();
f.show();
}
}
运行没问题,采纳吧,兄弟~~
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询