본문 바로가기

Dev Ref/Java

Swing Look&Feel 라이브러리 사용 및 적용방법



Look&Feel Library in Java[Swing]

공식 오라클 사이트 : https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html


본문 내용 출처 : https://blog.naver.com/sungback/90138574984


사용된 지난 포스팅 내용

2018/06/24 - [Java/Open source] - JFrame/swing 배경이미지 넣는 방법


[사용 방법]

public static void main(String[] args) {

    try {

        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");

    }  catch (Exception e) { }

    MyFrame f = new MyFrame(); // <-- MyFrame 은 JFrame을 상속받은 클래스

}


자바 스윙 룩앤필 사용 방법

  ( Win7, JDK jdk1.7.0_03, Eclipse IDE for Java Developers(Indigo 3.7.2) 에서 테스트 )


0. 첨부 파일 참조


1. lib 폴더 생성

    프로젝트 -> 우클릭 -> New -> Folder -> lib - [Finish]


2. Look and Feel jar 파일들 복사

    *.jar 파일들을 lib 폴더에 복사


3. 라이브러리 등록

    프로젝트 -> 우클릭 -> Build Path -> Config Build Path... -> Labraries 탭

    -> [Add JARs...] -> lib 폴더의 *.jar 선택


4. 사용법 : 

public static void main(String[] args) {

  try {

 // 1. 자바 내장 룩앤필

 // UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");

 // 2. quaqua.jar : Quaqua Look and Feel

  UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");

  JFrame.setDefaultLookAndFeelDecorated(true);


 // 3. liquidlnf.jar : Liquid Look and Feel

 // UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");


 // 4. idw-gpl.jar : InfoNode Look and Feel

 // UIManager.setLookAndFeel("net.infonode.gui.laf.InfoNodeLookAndFeel");


 // 5. JTattoo.jar : JTattoo Look and Feel

 // UIManager.setLookAndFeel("com.jtattoo.plaf.smart.SmartLookAndFeel");

 // UIManager.setLookAndFeel("com.jtattoo.plaf.mcwin.McWinLookAndFeel");

  }  catch (Exception e) { }

  // 파일 명이 MyFrame(JFrame 상속한 클래스) 인 경우

  MyFrame f = new MyFrame();

}