package com.ddChat.graphic;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class PlotPanel extends JPanel
{
Graphics g;
Plot plot;
public PlotPanel()
{
g = this.getGraphics();
System.out.println(g);
plot = new Plot(g);
}
public void paint(Graphics g)
{
System.out.println("paint called");
g.translate(100, 100);
g.drawOval(-5, -5, 10, 10);
plot.setG(g);
plot.draw();
}
public static void main(String args[])
{
JFrame jf = new JFrame();
PlotPanel pp = new PlotPanel();
pp.setVisible(true);
jf.add(pp);
jf.setSize(600, 600);
jf.setVisible(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
阅读(2358) | 评论(0) | 转发(0) |