You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9 KiB
Java

package org.twopm.laf;
import java.util.prefs.Preferences;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.metal.MetalLookAndFeel;
import static javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme;
import static javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme;
import org.openide.util.NbPreferences;
/**
* @author Edward M. Kagan <pagan@tabor.one>
*/
public class TitanLookAndFeel extends MetalLookAndFeel {
public static boolean self_install ()
{
UIManager.LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels();
for (UIManager.LookAndFeelInfo lafi : installedLookAndFeels)
{
String laf_name = "[2pm.tech] Titan"; //NOI18N
if (lafi.getName().equals(laf_name))
{
System.out.println("LAF Persist - no install.");
return false;
}
}
System.out.print("NO LAF - installing... ");
UIManager.installLookAndFeel(new UIManager.LookAndFeelInfo("[2pm.tech] Titan" , TitanLookAndFeel.class.getName()) ); //NOI18N
System.out.println("OK");
System.out.print("Applying LAf... ");
Preferences prefs = NbPreferences.root().node( "laf" ); //NOI18N
prefs.put( "laf", TitanLookAndFeel.class.getName() ); //NOI18N
System.out.println("OK");
return true;
}
@Override
public String getName() {
return "[2pm.tech] Titan"; //NOI18N
}
@Override
protected void createDefaultTheme() {
super.createDefaultTheme();
if( !(getCurrentTheme() instanceof TitanTheme) )
setCurrentTheme( new TitanTheme() );
}
@Override
public UIDefaults getDefaults() {
UIDefaults defaults = super.getDefaults();
return defaults;
}
@Override
public void initialize() {
super.initialize();
}
}