Do anyone know how to set the title of a program files extends with JApplet?

Where is the title to be displayed? How are you executing the applet?

The frame of the program there, but I didn't extends JFrame. Applet is used for GUI only like drawing all such things.

What class is the program derived from?

Have you read the API doc for that class? Does it have a setTitle method?

Is the main class, but I wanna try to set the title for it.Below is the part of codes from my program.

public class MyFirstApplet extends JApplet{

public void init() {
 setSize(1000,800);
//setTitle("MyFirstApplet");       //cannot set
}

}//end class

Does an applet have a title? Have you read the API doc for Applet? Does it have a setTitle method?
If you want a strip at the top of your applet with a String in it, you could use a label.

try this code in init() method

Frame c = (Frame)this.getParent().getParent();
c.setTitle("Hello World");

A bit late (3 years) don't you think?

Did you try your solution? Do you have a complete minimal executable demo of it in action?

commented: yes +0

Hi @naresh1845, could You tell me how it works?

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.