5
Contributors
8
Replies
20
Views
6 Years
Discussion Span
Last Post by dodo11
0

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

0

What class is the program derived from?

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

Edited by NormR1: n/a

0

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
0

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.

Edited by NormR1: n/a

0

try this code in init() method

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

1

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?

Votes + Comments
yes
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.