2016-08-07 1 views
0

Nimbus Look and Feel에서 구성 요소의 이미지를 사용자 정의하려면 어떻게해야합니까?모양과 느낌 사용자 지정 Nimbus

스크롤바 버튼 노브 스크롤바 엄지 손가락 스크롤바 스크롤바 트랙

감사 : 나는 포토샵에서 이미지를 생성하고 일부 후광 봐에 를 배치하고 구성 요소를 느껴 싶습니다,이 내가 변경하고자하는 구성 요소는 !

답변

1

nimbus에 가장 적합한 리소스는 Oracle 웹 사이트 here입니다. 그러나 대부분 API를 통해 테마를 사용자 정의하고 xml을 통해 프로그램을 벗어난 구성 요소를 사용자 정의 할 수 있습니다. 여기에서 다른 게시물을 인용하십시오.

참조하는 요소에 액세스하여 수정하려면 here 다음은 이와 같은 방식으로 원하는 변경 사항을 적용하기 위해 UI 매니저를 호출 할 수

UIManager.put("nimbusBase", new Color(...)); UIManager.put("nimbusBlueGrey", new Color(...)); UIManager.put("control", new Color(..

은 다시 UI에 색상 등을 적용 detail.about 더 들어가는 유용한 링크 here있다.

이미지를 사용하여 테마를 수정하는 방법에 대한 게시물이 많습니다.이 설명서의 내용은 다음과 같습니다.

<style id="buttonStyle"> 
    <insets top="15" left="20" right="20" bottom="15"/> 
    <state> 
     <imagePainter method="buttonBackground" path="images/button.png" 
     sourceInsets="10 10 10 10"/> 
    </state> 
</style> 
<bind style="buttonStyle" type="region" key="button"/> 

및 테마와 리소스를 얻을 :

private static String synthFile = "buttonSkin.xml"; 
private static void initLookAndFeel() { 
     // String lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; 
     SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); 


      try { 
       lookAndFeel.load(SynthApplication.class.getResourceAsStream(synthFile), 
            SynthApplication.class); 
       UIManager.setLookAndFeel(lookAndFeel); 
      } 

      catch (Exception e) { 
       System.err.println("Couldn't get specified look and feel (" 
            + lookAndFeel 
            + "), for some reason."); 
       System.err.println("Using the default look and feel."); 
       e.printStackTrace(); 
      } 

    } 

전체 샘플을 사용할 수 here