/* * ============================================================== * DemoCheckBoxMenuItem.java : Create checkbox menu iterms. * * Adapted from : Pantham S., Pure JFC Swing, 1999. * Modified by : Mark Austin March, 2001 * ============================================================== */ import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; public class DemoCheckBoxMenuItem extends JApplet { public void init() { // 1. Get the handle on the applet's content pane. Container container = this.getContentPane(); // 2. Create a menu bar and add it to the applet. JMenuBar menuBar = new JMenuBar(); menuBar.setBorder(new BevelBorder(BevelBorder.RAISED)); //menuBar.setBorderPainted(true); container.add(menuBar, BorderLayout.NORTH); // 3. Create and add the File menu and its menu items. JMenu fileMenu = new JMenu("File", true); menuBar.add(fileMenu); // 4. Create the Edit menu and its menu items // and add them to the menu bar. JMenu editMenu = new JMenu("Edit"); menuBar.add(editMenu); // 5. Create the Options menu, submenus, and their items. JMenu optionsMenu = new JMenu("Options"); menuBar.add(optionsMenu); // 6. Create and add the Fonts options menu to the // Options menu. JMenu fontsOptionsMenu = new JMenu("Fonts"); optionsMenu.add(fontsOptionsMenu); // 7. Create radio button menu items and add them // to the Fonts option menu. JRadioButtonMenuItem rbItem; ButtonGroup group = new ButtonGroup(); String[] rbLabels = {"Dialog", "Monospaced", "SansSerif"}; for (int i=0; i