|
SwingTheme |
|
/*
* JVirus is a PacMan clone, written in Java.
*
* Please read "http://jvirus.sourceforge.net/jvirus_licence.txt" for copyrights.
*
* The sourcecode is designed and created with
* Sun J2SDK 1.3 and Microsoft Visual J++ 6.0
*
* JVirus homepage: http://jvirus.sourceforge.net
*
* autor: Slawa Weis
* email: slawaweis@animatronik.net
*
*/
package org.game.JVirus;
import java.awt.*;
import java.util.*;
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.metal.*;
/**
* black and green Swing theme for JVirus
*/
public final class SwingTheme extends javax.swing.plaf.metal.DefaultMetalTheme
{
// public static final String FONT_DEFAULT = "MS Sans Serif";
public static final String FONT_DEFAULT = "SansSerif";
public static final int FONT_TYP = Font.PLAIN;
public static final int FONT_SIZE = 11;
/**
* hidden constructor
*/
private SwingTheme()
{
}
/**
* the name of this theme: "JVirus Theme"
*/
public String getName()
{
return "JVirus Theme";
}
/**
* static initialiser, called in the main class
*
* @see org.game.JVirus.main
*/
public static void initSwing()
{
Font antFont = new Font(FONT_DEFAULT, FONT_TYP, FONT_SIZE);
SwingTheme theme = new SwingTheme();
MetalLookAndFeel.setCurrentTheme(theme);
try
{
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
catch(ClassNotFoundException e)
{
System.out.println("SwingTheme.initSwing() ClassNotFoundException e: " + e);
}
catch(InstantiationException e)
{
System.out.println("SwingTheme.initSwing() InstantiationException e: " + e);
}
catch(IllegalAccessException e)
{
System.out.println("SwingTheme.initSwing() IllegalAccessException e: " + e);
}
catch(UnsupportedLookAndFeelException e)
{
System.out.println("SwingTheme.initSwing() UnsupportedLookAndFeelException e: " + e);
}
javax.swing.UIManager.put("Label.foreground", black);
}
public static final ColorUIResource primary1 = new ColorUIResource(0, 96, 0);
public static final ColorUIResource primary2 = new ColorUIResource(0, 96, 0);
public static final ColorUIResource primary3 = new ColorUIResource(0, 156, 0);
public static final ColorUIResource secondary1 = new ColorUIResource(0, 255, 0);
public static final ColorUIResource secondary2 = new ColorUIResource(0, 156, 0);
public static final ColorUIResource secondary3 = new ColorUIResource(0, 0, 0);
public static final ColorUIResource black = new ColorUIResource(0, 255, 0);
public static final ColorUIResource white = new ColorUIResource(0, 96, 0);
protected ColorUIResource getPrimary1() { return primary1; }
protected ColorUIResource getPrimary2() { return primary2; }
protected ColorUIResource getPrimary3() { return primary3; }
protected ColorUIResource getSecondary1() { return secondary1; }
protected ColorUIResource getSecondary2() { return secondary2; }
protected ColorUIResource getSecondary3() { return secondary3; }
protected ColorUIResource getBlack() { return black; }
protected ColorUIResource getWhite() { return white; }
public static final FontUIResource font = new FontUIResource(FONT_DEFAULT, FONT_TYP, FONT_SIZE);
public static final FontUIResource font2 = new FontUIResource(FONT_DEFAULT, FONT_TYP, 10);
public FontUIResource getControlTextFont() { return font; }
public FontUIResource getMenuTextFont() { return font; }
public FontUIResource getSubTextFont() { return font2; }
public FontUIResource getSystemTextFont() { return font2; }
public FontUIResource getUserTextFont() { return font; }
public FontUIResource getWindowTitleFont() { return font; }
}
|
SwingTheme |
|