厦门市双十中学初中部:package javamyframe;请大家帮忙看看,我菜的不行了
来源:百度文库 编辑:高校问答 时间:2024/07/08 11:46:40
package javamyframe;
/**
*
* @author Administrator
*/
import java.awt.*;
public class Main {
/** Creates a new instance of Main */
public class MyFrame extends Frame{
/**
* @param args the command line arguments
*/
public void main(String[] args) {
// TODO code application logic here
MyFrame fr;
fr=new MyFrame("Hello Out There!");
fr.setSize(400,300);
fr.setBackground(Color.blue);
fr.setVisible(true);
}
}
}
/**
*
* @author Administrator
*/
import java.awt.*;
public class Main {
/** Creates a new instance of Main */
public class MyFrame extends Frame{
/**
* @param args the command line arguments
*/
public void main(String[] args) {
// TODO code application logic here
MyFrame fr;
fr=new MyFrame("Hello Out There!");
fr.setSize(400,300);
fr.setBackground(Color.blue);
fr.setVisible(true);
}
}
}
请将你的嵌入类放在外面描述,修改后如下:
import java.awt.*;
class MyFrame extends Frame
{
public MyFrame(String title)
{
super(title);
}
}
public class Main
{
public static void main(String[] args)
{
// TODO code application logic here
MyFrame fr;
fr = new MyFrame("Hello Out There!");
fr.setSize(400, 300);
fr.setBackground(Color.blue);
fr.setVisible(true);
}
}