воскресенье, 23 января 2011 г.

GTK, Windows or other LookAndFeel

public static void setLookAndFeel() {
try {
  UIManager.setLookAndFeel(new GTKLookAndFeel());
} catch (UnsupportedLookAndFeelException ex) {
  try {
    UIManager.setLookAndFeel(new WindowsLookAndFeel());
  } catch (UnsupportedLookAndFeelException e) {
     try {
       UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
     } catch (Exception exc) {
       throw new RuntimeException(exc);
     }
   }
 }
}

1 комментарий:

  1. try {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (ClassNotFoundException ex) {
    ex.printStackTrace();
    } catch (InstantiationException ex) {
    ex.printStackTrace();
    } catch (IllegalAccessException ex) {
    ex.printStackTrace();
    }
    } catch (UnsupportedLookAndFeelException ex) {
    try {
    UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException ex1) {
    System.out.println("Это ж нереально!");
    }
    }

    ОтветитьУдалить