FileDocCategorySizeDatePackage
TopLevelDemo.javaAPI DocExample920Tue Dec 12 18:59:20 GMT 2000None

TopLevelDemo

public class TopLevelDemo extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] s)

        JFrame frame = new JFrame("TopLevelDemo");

        frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });

        JLabel yellowLabel = new JLabel("");
        yellowLabel.setOpaque(true);
        yellowLabel.setBackground(Color.yellow);
        yellowLabel.setPreferredSize(new Dimension(200, 180));

        JMenuBar cyanMenuBar = new JMenuBar();
        cyanMenuBar.setOpaque(true);
        cyanMenuBar.setBackground(Color.cyan);
        cyanMenuBar.setPreferredSize(new Dimension(200, 20));

        frame.setJMenuBar(cyanMenuBar);
        frame.getContentPane().add(yellowLabel, BorderLayout.CENTER);

        frame.pack();
        frame.setVisible(true);