将标题设置为JFrame [英] set title to JFrame

查看:153
本文介绍了将标题设置为JFrame的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java的新手。我的问题是我有一个类名MyClassExp。我已经从JFrame扩展了它。在类中,我启动了另一个名为TabbedFrame的类的对象。 TabbedFrame还扩展了一个类DemoFrame。在DemoFrame中,我使用关键字'super'设置页面的标题,如:

  super(Some Title); 

现在,当我运行MyClassExp,即使在创建JFrame之后:

 新的JFrame(新标题); 

我仍然拥有相同的标题,即某些标题。有没有办法解决这个问题?我尝试了很多东西来解决它,但是失败了:'(

解决方案

使用API​​方法 public void setTitle(String title)


I am new to Java. My problem is that I have a class names MyClassExp. I have extended it from JFrame. Inside the class, I initiate an object of another class named TabbedFrame. TabbedFrame also extends a class DemoFrame . In DemoFrame, I have the title of the page set using keyword 'super' like:

super("Some Title");

Now when I run my MyClassExp, even after creating a JFrame as:

new JFrame("New Title"); 

I'm still getting the same title i.e Some Title. Is there any way to solve this problem? I've tried a lot to solve it but failed :'(

解决方案

Use the API method public void setTitle(String title).

这篇关于将标题设置为JFrame的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆