set title to JFrame

不打扰是莪最后的温柔 提交于 2019-12-01 05:00:26

问题


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 :'(


回答1:


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




回答2:


- Inside the MyClassExp class's constructor use this.setTitle(String title) method.




回答3:


Just use setTitle("yourTitleName");

for example:

setTitle("Currency Converter");
textField.addKeyListener(this);
combo.addItemListener(this);
label.addMouseListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


来源:https://stackoverflow.com/questions/13322306/set-title-to-jframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!