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...

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.

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.

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.