packagetestFrame;importjava.awt.Color;importjava.awt.Component;importjava.awt.Frame;importjava.awt.Graphics;importjava.awt.Rectangle;publicclassFrameTestextendsFrame{/***...
package testFrame;
import java.awt.Color;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Rectangle;
public class FrameTest extends Frame {
/**
* @param args
*/
Rectangle rec;
Frame f;
public void paint(Graphics g)
{
super.paint(g);
g.setColor(Color.black);
g.fillRect(100, 100, 30, 30);
try {
Thread.sleep(500);
}
catch (Exception ex) {
ex.printStackTrace();
}
repaint();
}
FrameTest()
{
f=new Frame("title");
f.setLocation(100,100);
f.setSize(600,400);
f.setVisible(true);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
FrameTest ft=new FrameTest();
}
}
为什么我的代码画不出矩形
我的一个朋友说他能画出~~~~~ 我去啊~~
展开