0

Hi! I'm working on a notepad project and like original notepad i want the form title set by the name of the file that has been openned so how can i do that?!
thanks...

3
Contributors
3
Replies
12
Views
4 Years
Discussion Span
Last Post by JamesCherrill
1

WHat class are you using for your "form" - if it's a JFrame you can call its setTitle method any time to change the title.

0

so, the title has to be the name of the class the form is in?
well, you can find the name through the native class Class, there are some methods in there to retrieve the name in several formats
just check how you need it and implement it.
http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html

if you mean, it has to have the name of the file in which the file of the form is instantiated, nobody is stopping you from passing it as a parameter to the constructor, I guess.

0

I think he means the name of the file that was the source of the content displayed in the form - so there's some kind of file open dialog from which a chosen file is opened in the form, and the chosen file name should be in the form's title. Is that right?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.