graphics画的图不显示
importjava.awt.Color;importjava.awt.Frame;importjava.awt.Graphics;importjavax.swing.J...
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import javax.swing.JFrame;
public class game1_1 extends JFrame {
private JFrame jf;
public game1_1(){
jf=new JFrame("画图");
jf.setBounds(100, 100, 500, 400);
jf.setVisible(true);
}
public void paint(Graphics g) {
g.drawLine(100, 100,200, 200);
g.drawRect(40, 80, 100,90 );
g.drawString("周雨欣", 100, 200);
}
public static void main(String []args){
new game1_1();
}
}
这是代码 展开
import java.awt.Frame;
import java.awt.Graphics;
import javax.swing.JFrame;
public class game1_1 extends JFrame {
private JFrame jf;
public game1_1(){
jf=new JFrame("画图");
jf.setBounds(100, 100, 500, 400);
jf.setVisible(true);
}
public void paint(Graphics g) {
g.drawLine(100, 100,200, 200);
g.drawRect(40, 80, 100,90 );
g.drawString("周雨欣", 100, 200);
}
public static void main(String []args){
new game1_1();
}
}
这是代码 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询