你可以不写,但它也得自动调用父类的无参构造函数的,
public Frame(String title):
Constructs a new, initially invisible Frame object with the specified title
public Frame(String title):
Constructs a new, initially invisible Frame object with the specified title
解决方案 »
- 求日期正则表达式
- 有些不知所措
- 快疯啦!!!CommPortIdentifier.getPortIdentifiers()方法取出的值为空
- JButton获取Enter事件?
- jcombobox里面的文本怎么根据窗口大小自动换行
- [JMF RTP]在使用JMF进行网络RTP实时媒体播放的时候总是会出现ControllerErrorEvent
- 帮我看看这个web.xml文件,明明没有错,就是提示"<web-app>"应该有结束标志"</web-app>"才行
- 借了本struts的书,不知怎么用?
- 求一个正则表达式
- 还想问一个问题……
- java如何设置windows默认打印机???急呀。。。
- 想用JAVA做一个程序的启动界面
但是这样就会调用没有参数的 Frame(), 那 MYframe(String str)里的str就没有作用了。即 MYframe fr=new MYframe("Hello OUt There!");
--------------------- 这里无论输入什么,结果都一样。
import java.awt.*;
public class MYframe extends Frame{
public static void main(String arg[]){
MYframe fr=new MYframe("Hello OUt There!");
Panel pan=new Panel();
fr.setSize(200,200);
fr.setBackground(Color.blue);
fr.setVisible(true);
pan.setSize(100,100);
pan.setBackground(Color.green);
fr.add(pan);
}
public MYframe(String str){
super(str);} public MYfrmae(){ //提供无参构造函数
super();}
}