コード例 #1
0
  static void initLookAndFeel() {
    MetalLookAndFeel mlf = new MetalLookAndFeel();
    mlf.setCurrentTheme(new SipCommunicatorColorTheme());

    try {
      UIManager.setLookAndFeel(mlf);
    } catch (UnsupportedLookAndFeelException ex) {
      console.error("Failed to set custom look and feel", ex);
    }
  }
コード例 #2
0
 public MetalworksFrame() {
   super("Metalworks");
   final int inset = 50;
   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   setBounds(inset, inset, screenSize.width - inset * 2, screenSize.height - inset * 2);
   buildContent();
   buildMenus();
   this.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           quit();
         }
       });
   UIManager.addPropertyChangeListener(new UISwitchListener((JComponent) getRootPane()));
 }
コード例 #3
0
  /**
   * ������ѡ����
   *
   * @param cp ����Ҫ�ı�Ŀؼ�
   * @param style ���ܽ����±�
   * @return ���سɹ��������
   */
  public static boolean setUI(Component cp, int style) {

    try {
      switch (style) {
        case 0:
          UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "windows.WindowsLookAndFeel");
          break;
        case 1:
          UIManager.setLookAndFeel("javax.swing.plaf." + "metal.MetalLookAndFeel");
          break;
        case 2:
          UIManager.setLookAndFeel("com.sun.java.swing.plaf." + "motif.MotifLookAndFeel");
          break;
        case 3:
          UIManager.setLookAndFeel(
              "com.sun.java.swing.plaf." + "windows.WindowsClassicLookAndFeel");
          break;
        case 4:
          UIManager.setLookAndFeel("com.incors.plaf." + "alloy.AlloyLookAndFeel");
          break;
        case 5:
          UIManager.setLookAndFeel("soft.wes.feels." + "GlassThemeAlloyLookAndFeel");
          break;
        case 6:
          UIManager.setLookAndFeel("soft.wes.feels." + "AcidThemeAlloyLookAndFeel");
          break;
        case 7:
          UIManager.setLookAndFeel("soft.wes.feels." + "BedouinThemeAlloyLookAndFeel");
          break;
        case 8:
          UIManager.setLookAndFeel("soft.wes.feels." + "DefaultThemeAlloyLookAndFeel");
          break;
        case 9:
          UIManager.put("swing.boldMetal", Boolean.FALSE);
          // �����öԻ������
          JDialog.setDefaultLookAndFeelDecorated(true);
          // �������������
          JFrame.setDefaultLookAndFeelDecorated(true);
          Toolkit.getDefaultToolkit().setDynamicLayout(true);
          System.setProperty("sun.awt.noerasebackground", "true");
          UIManager.setLookAndFeel(new MetalLookAndFeel());
          break;
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(null, "����ʧ��,��ԭ�����ʾ");
      return false;
    }
    SwingUtilities.updateComponentTreeUI(cp);
    cp.repaint();

    return true;
  }