Пример #1
0
 /** Switch to a new Look&Feel */
 private void newLookAndFeel(String landf) {
   try {
     UIManager.setLookAndFeel(landf);
     SwingUtilities.updateComponentTreeUI(this);
   } catch (Exception e) {
     System.err.println(e);
   }
 }
Пример #2
0
  /** Create a menu which allows the user to select a different look and feel at runtime. */
  public JMenu createLookAndFeelMenu() {
    CommandMenu menu = new CommandMenu("Look'n'Feel");

    UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();

    for (int i = 0; i < lafs.length; i++) {
      final String lnfClassName = lafs[i].getClassName();
      Command cmd =
          new AbstractCommand(lafs[i].getName(), this) {
            public void execute() {
              newLookAndFeel(lnfClassName);
            }
          };
      menu.add(cmd);
    }
    return menu;
  }