展开全部
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
class PaintovalPane extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(Color.pink);
g.fillOval(100, 100, 200, 200);
}
}
class PaintovalFrame extends JFrame
{
public PaintovalFrame()
{
setTitle("lamp");
setSize(500,500);
addWindowListener(
new WindowAdapter()
{
public void WindowClosing(WindowEvent e)
{
System.exit(0);
}
});
Container contentPane = getContentPane();
contentPane.add(new PaintovalPane());
}
}
public class Paintoval {
public static void main(String[] args) {
JFrame f = new PaintovalFrame();
f.show();
}
}
这个可是够简单了
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
class PaintovalPane extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(Color.pink);
g.fillOval(100, 100, 200, 200);
}
}
class PaintovalFrame extends JFrame
{
public PaintovalFrame()
{
setTitle("lamp");
setSize(500,500);
addWindowListener(
new WindowAdapter()
{
public void WindowClosing(WindowEvent e)
{
System.exit(0);
}
});
Container contentPane = getContentPane();
contentPane.add(new PaintovalPane());
}
}
public class Paintoval {
public static void main(String[] args) {
JFrame f = new PaintovalFrame();
f.show();
}
}
这个可是够简单了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询