myeclipse运行时怎么没有任何反应,也没有报错,是程序出问题了吗?请大虾指点!
importjava.awt.*;importjavax.swing.*;publicclassDemo10extendsJFrame{MyPanelmp=null;/*...
import java.awt.*;
import javax.swing.*;
public class Demo10 extends JFrame{
MyPanel mp=null;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Demo10 demo10=new Demo10();
}
public void Demo10()
{
mp=new MyPanel();
this.add(mp);
this.setSize(300,300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
class MyPanel extends JPanel
{
public void Paint(Graphics g)
{
super.paint(g);
g.drawRect(10, 10, 40, 40);
}
}
} 展开
import javax.swing.*;
public class Demo10 extends JFrame{
MyPanel mp=null;
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Demo10 demo10=new Demo10();
}
public void Demo10()
{
mp=new MyPanel();
this.add(mp);
this.setSize(300,300);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
class MyPanel extends JPanel
{
public void Paint(Graphics g)
{
super.paint(g);
g.drawRect(10, 10, 40, 40);
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询