EventQueue.invokeLater and JApplet
File: NotHelloWorldApplet.html
<applet code="NotHelloWorldApplet.class"
width="300" height="100">
</applet>
/*
This program is a part of the companion code for Core Java 8th ed.
(http://horstmann.com/corejava)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* The following HTML tags are required to display this applet in a browser: <applet
* code="NotHelloWorldApplet.class" width="300" height="100"> </applet>
*/
import java.awt.*;
import javax.swing.*;
/**
* @version 1.22 2007-06-12
* @author Cay Horstmann
*/
public class NotHelloWorldApplet extends JApplet
{
public void init()
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
JLabel label = new JLabel("Not a Hello, World applet", SwingConstants.CENTER);
add(label);
}
});
}
}
Related examples in the same category