java drawRect的问题
为什么什么都没有显示importjavax.swing.*;importjava.awt.*;publicclassq{publicstaticvoidmain(Stri...
为什么什么都没有显示
import javax.swing.*;
import java.awt.*;
public class q {
public static void main(String[] Args)
{
JFrame frame;
Container cantainer;
Graphics g;
frame=new JFrame("Test");
frame.setSize(300,200);
frame.setLocation(100,100);
frame.setVisible(true);
cantainer=frame.getContentPane();
g=cantainer.getGraphics();
//g.drawLine(50,50,100,30);
g.setColor(Color.blue);
g.drawRect(50,50, 100,30);
//g.drawRoundRect(100,100,80,80,10,10);
}
} 展开
import javax.swing.*;
import java.awt.*;
public class q {
public static void main(String[] Args)
{
JFrame frame;
Container cantainer;
Graphics g;
frame=new JFrame("Test");
frame.setSize(300,200);
frame.setLocation(100,100);
frame.setVisible(true);
cantainer=frame.getContentPane();
g=cantainer.getGraphics();
//g.drawLine(50,50,100,30);
g.setColor(Color.blue);
g.drawRect(50,50, 100,30);
//g.drawRoundRect(100,100,80,80,10,10);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询