home *** CD-ROM | disk | FTP | other *** search
- import com.sun.java.swing.AbstractButton;
- import com.sun.java.swing.ButtonGroup;
- import com.sun.java.swing.JButton;
- import com.sun.java.swing.JFrame;
- import com.sun.java.swing.JPanel;
- import com.sun.java.swing.JRadioButton;
- import com.sun.java.swing.UIManager;
- import java.awt.Container;
-
- public class SimpleExample extends JPanel {
- static JFrame frame;
- static String metal = "Metal";
- static String metalClassName = "com.sun.java.swing.plaf.metal.MetalLookAndFeel";
- static String motif = "Motif";
- static String motifClassName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
- static String windows = "Windows";
- static String windowsClassName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
- JRadioButton metalButton;
- JRadioButton motifButton;
- JRadioButton windowsButton;
-
- public SimpleExample() {
- JButton var1 = new JButton("Hello, world");
- ((AbstractButton)var1).setMnemonic('h');
- this.metalButton = new JRadioButton(metal);
- this.metalButton.setMnemonic('o');
- this.metalButton.setActionCommand(metalClassName);
- this.motifButton = new JRadioButton(motif);
- this.motifButton.setMnemonic('m');
- this.motifButton.setActionCommand(motifClassName);
- this.windowsButton = new JRadioButton(windows);
- this.windowsButton.setMnemonic('w');
- this.windowsButton.setActionCommand(windowsClassName);
- ButtonGroup var2 = new ButtonGroup();
- var2.add(this.metalButton);
- var2.add(this.motifButton);
- var2.add(this.windowsButton);
- SimpleExample$RadioListener var3 = new SimpleExample$RadioListener(this);
- this.metalButton.addActionListener(var3);
- this.motifButton.addActionListener(var3);
- this.windowsButton.addActionListener(var3);
- ((Container)this).add(var1);
- ((Container)this).add(this.metalButton);
- ((Container)this).add(this.motifButton);
- ((Container)this).add(this.windowsButton);
- }
-
- public void updateState() {
- String var1 = UIManager.getLookAndFeel().getClass().getName();
- if (var1.indexOf(metal) >= 0) {
- this.metalButton.setSelected(true);
- } else if (var1.indexOf(windows) >= 0) {
- this.windowsButton.setSelected(true);
- } else if (var1.indexOf(motif) >= 0) {
- this.motifButton.setSelected(true);
- } else {
- System.err.println("SimpleExample if using an unknown L&F: " + var1);
- }
- }
-
- public static void main(String[] var0) {
- SimpleExample var1 = new SimpleExample();
- frame = new JFrame("SimpleExample");
- frame.addWindowListener(new SimpleExample$1());
- frame.getContentPane().add("Center", var1);
- frame.pack();
- frame.setVisible(true);
- var1.updateState();
- }
- }
-