http://l2fprod.com/skinlf/download/index.php --> skinlf 받는곳
http://javootoo.l2fprod.com/plaf/skinlf/themepacks/index.html --> themepacks 받는곳
import java.awt.*;
import javax.swing.*;
import com.l2fprod.gui.plaf.skin.Skin;
import com.l2fprod.gui.plaf.skin.SkinLookAndFeel;
import java.awt.event.*;
public class LookAndFeelTest extends JFrame
{
private String str[] = { "자바기본", "UNIX", "윈도우즈","윈도우즈classic","aqua"};
private UIManager.LookAndFeelInfo looks[];
private JRadioButton radio[];
private ButtonGroup group;
private JButton button;
private JLabel label;
public LookAndFeelTest()
{
super( "Look-and-Feel 테스트" );
setDefaultCloseOperation(EXIT_ON_CLOSE);
JPanel northPanel = new JPanel();
northPanel.setLayout( new GridLayout( 3, 1, 0, 5 ) );
label = new JLabel(" 메탈(자바기본) look-and-feel");
add("Center",label);
northPanel.add(label );
button = new JButton( "컴포넌트의 모양 - JButton" );
northPanel.add( button );
add("Center", northPanel);
JPanel southPanel = new JPanel();
radio = new JRadioButton[str.length ];
group = new ButtonGroup();
southPanel.setLayout(new GridLayout( 1, radio.length ) );
for ( int i = 0; i < radio.length; i++ )
{
radio[ i ] = new JRadioButton( str[ i ] );
radio[ i ].addItemListener( new ItemHandler() );
group.add( radio[ i ] );
southPanel.add( radio[ i ] );
}
add("South", southPanel);
try {
Skin theSkinToUse = SkinLookAndFeel.loadThemePack("aquathemepack.zip"); //외부 aqua 스킨
SkinLookAndFeel.setSkin(theSkinToUse);
} catch (Exception e1) {
e1.printStackTrace();
}
try {
UIManager.installLookAndFeel("aqua", new SkinLookAndFeel().getClass().getName()); //외부 aqua 배열등록
} catch (Exception e) {
e.printStackTrace();
}
looks = UIManager.getInstalledLookAndFeels(); // 등록된 look 앤 필을 가져오는데 외부 aqua도 가져옴
// 기본적으로 등록되어있는것은 1.5 기준으로 metal,CDE/Motif,Windows,Windows Classic 이다
System.out.println(looks.length);
setSize( 350, 200 );
setVisible(true);
radio[0].setSelected( true );
}
private void changeTheLookAndFeel( int value )
{
try
{
UIManager.setLookAndFeel(looks[ value ].getClassName() );
SwingUtilities.updateComponentTreeUI( this );
}
catch ( Exception e )
{
e.printStackTrace();
}
}
public static void main( String args[] )
{
new LookAndFeelTest();
}
private class ItemHandler implements ItemListener
{
public void itemStateChanged( ItemEvent e )
{
for ( int i = 0; i < radio.length; i++ )
if ( radio[ i ].isSelected() )
{
label.setText(str[ i ] + " look-and-feel" );
changeTheLookAndFeel( i );
}
}
}
}