2013-10-19 2 views
1

약간의 도움이 필요합니다. Java L & Fs로 실험 중이며 실제로 모양과 느낌을 변경하는 Netbeans을 얻는 방법을 전혀 모른다. 나는 Synthetica 블루 아이스 L & F를 사용하고, 그리고 넷빈즈는 후광 LF 코딩 한 코딩, 나는 후광 세트를 주석 한 이것은 (원본 코드에서 발췌) 나는 삽입 된 것입니다 :Netbeans를 사용하여 사용자 정의 Look & Feel 추가하기

import de.javasoft.plaf.synthetica.SyntheticaBlueIceLookAndFeel; 
import javax.swing.*; 
import java.awt.*; 

public MainMenu() { 
      initComponents(); 
      try { 
       UIManager.addAuxiliaryLookAndFeel(new SyntheticaBlueIceLookAndFeel()); 
       UIManager.setLookAndFeel(new SyntheticaBlueIceLookAndFeel()); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 
    } 
넷빈즈가 자신의 룩을 삽입하고 코딩을 느껴

, 나는 그것을 주석했는데 그것은 다음과 같습니다 : 나는 응용 프로그램을 실행할 때

public static void main(String args[]) { 
      /* Set the Nimbus look and feel */ 
      //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> 
      /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 
      * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
      */ 

      try { 
       UIManager.addAuxiliaryLookAndFeel(new SyntheticaBlueIceLookAndFeel()); 
       UIManager.setLookAndFeel(new SyntheticaBlueIceLookAndFeel()); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 

//   try { 
//    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 
//     JOptionPane.showMessageDialog(null, info.getClassName()); 
//     if ("Nimbus".equals(info.getName())) { 
//       javax.swing.UIManager.setLookAndFeel(info.getClassName()); 
//       break; 
//     } 
//    } 
//   } catch (ClassNotFoundException ex) { 
//    java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
//   } catch (InstantiationException ex) { 
//    java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
//   } catch (IllegalAccessException ex) { 
//    java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
//   } catch (javax.swing.UnsupportedLookAndFeelException ex) { 
//    java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 
//   } 
//   } 
//   catch (Exception e){ 
//    java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.logging.Level.SEVERE, null, e); 
//   } 

      //</editor-fold> 

      /* Create and display the form */ 
      java.awt.EventQueue.invokeLater(new Runnable() { 
       public void run() { 
        new MainMenu().setVisible(true); 
       } 
      }); 
    } 

아직, 여전히 기본 LF와 같은 보인다. 나는 확인하고 LFS 내가 설치 한 것을 볼 수있는 스크립트를 실행했습니다, 이것은 내가 가진 것입니다 :

javax.swing.plaf.metal.MetalLookAndFeel 
javax.swing.plaf.nimbus.NimbusLookAndFeel 
com.sun.java.swing.plaf.motif.MotifLookAndFeel 
com.sun.java.swing.plaf.windows.WindowsLookAndFeel 
com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel 

내가 디자인 팔레트에서의 Look & Feel 탭있을 것으로 나타났습니다. Synthetica가 왜 거기에 보이지 않습니까?

답변

1

사용하기 전에 UIManager.addAuxiliaryLookAndFeel(LookAndFeel) 으로 전화해야합니다.

  1. 는 보조적인 Look 목록에 LookAndFeel를 추가하고 느낀다. 보조적인 Look & Feel는, 다중 UI를 작성할 경우에, 디폴트의 LookAndFeel 클래스에 가세 해, 컴퍼넌트 인스턴스의 다른 클래스 LookAndFeel가 사용되는 것을 멀티플렉서의 Look & Feel에 통지합니다. 이 변경은 새 UI 클래스가 만들어 지거나 구성 요소 인스턴스에서 기본 모양과 느낌이 변경된 경우에만 적용됩니다. 더 나은 도움을

+1

@Johan 직전 빨리, @mKorbel을 [SSCCE] (http://sscce.org/), 짧은 실행 가능한, 컴파일 가능한, 코드 라인은 아무것도에 대해 이야기하기 때문에 중요한 – mKorbel

+0

감사를 게시 - 진부한 스마트 폰으로 타이핑하고있어. Aux Look & Feel을 추가하려고했지만 여전히 작동하지 않습니다. 생성자에서 추가 행을 추가했습니다 :'UIManager.addAuxiliaryLookAndFeel (new SyntheticaBlueIceLookAndFeel());'그리고 자동 생성 된 Look & Feel 섹션에도 복사했습니다. 아직, 아직 작동하지 않습니다. –

+0

* "진부한 스마트 폰을 통해 타이핑하고 있습니다."* 문제는 아닙니다. SSCCE를 게시 할 수없는 경우 가능하면 언제든지 연락하십시오. –

관련 문제