Java 응용 프로그램에 모양과 느낌을 추가합니다
-
20-09-2019 - |
문제
나는 함께 일하고있다 Netbeans 6.5 IDE.
Look and Feel Jar 파일을 다운로드하고 Palette Manager가 NetBeans를 추가했습니다.
내 응용 프로그램에서 어떻게 사용합니까?
해결책 2
답장을 보내 주셔서 감사합니다. 아래 코드를 사용하면 모든 모양과 느낌 클래스 이름을 얻을 수 있습니다.
UIManager.LookAndFeelInfo[] lookAndFeelInfos = UIManager.getInstalledLookAndFeels();
for (int i = 0; i < lookAndFeelInfos.length; i++) {
UIManager.LookAndFeelInfo lookAndFeelInfo = lookAndFeelInfos[i];
//
// Get the name of the look and feel
//
String name = lookAndFeelInfo.getName();
System.out.println("name = " + name);
//
// Get the implementation class for the look and feel
//
String className = lookAndFeelInfo.getClassName();
System.out.println("className = " + className);
}
다른 팁
이 Sun 튜토리얼을 따라갈 수 있습니다 L & F를 Java로 설정합니다
L & F를 변경할 수 있습니다
setLookAndFeel
프로그램의 GUI가 보인 후에도.
기존 구성 요소가 새로운 L & F를 반영하기 위해SwingUtilities
updateComponentTreeUI
방법 최상위 컨테이너 당 한 번.
그런 다음 각 최상위 컨테이너 크기를 조정하여 포함 된 구성 요소의 새로운 크기를 반영 할 수 있습니다. 예를 들어:
UIManager.setLookAndFeel(lnfName);
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
제휴하지 않습니다 StackOverflow