1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
package swing;
import java.awt.*;
import javax.swing.*;
/** Tiny example showing the main differences in using
* JApplet instead of Applet: using the content pane,
* getting Java (Metal) look and feel by default, and
* having BorderLayout be the default instead of FlowLayout.
* 1998-99 Marty Hall, http://www.apl.jhu.edu/~hall/java/
*/
public class JAppletExample extends JApplet {
/**
*
*/
private static final long serialVersionUID = 1063042045343679140L;
public void init() {
//Windows_es.setNativeLookAndFeel();
final Container content = getContentPane();
content.setBackground(Color.white);
content.setLayout(new FlowLayout());
content.add(new JButton("Button 1"));
content.add(new JButton("Button 2"));
content.add(new JButton("Button 3"));
}
} |
Partager