FileDocCategorySizeDatePackage
MetalThemeMenu.javaAPI DocExample2028Sat Sep 12 03:01:00 BST 1998None

MetalThemeMenu

public class MetalThemeMenu extends JMenu implements ActionListener
This class describes a theme using "green" colors.
version
1.2 02/05/98
author
Steve Wilson

Fields Summary
MetalTheme[]
themes
Constructors Summary
public MetalThemeMenu(String name, MetalTheme[] themeArray)

    super(name);
    themes = themeArray;
    ButtonGroup group = new ButtonGroup();
    for (int i = 0; i < themes.length; i++) {
        JRadioButtonMenuItem item = new JRadioButtonMenuItem( themes[i].getName() );
	group.add(item);
        add( item );
	item.setActionCommand(i+"");
	item.addActionListener(this);
	if ( i == 0)
	    item.setSelected(true);
    }

  
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

    String numStr = e.getActionCommand();
    MetalTheme selectedTheme = themes[ Integer.parseInt(numStr) ];
    MetalLookAndFeel.setCurrentTheme(selectedTheme);
    try {
	UIManager.setLookAndFeel("com.sun.java.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
        System.out.println("Failed loading Metal");
	System.out.println(ex);
    }