Re: how to set a different LooAndFeel?



IchBin wrote:
Scirious wrote:
Well, I dont't want to change the look of the IDE itself, but the look of my applications. And, since Netbeans doesn't allow me to edit it's generated code I don't know how to do it.

OK..here is Sun's tutorial "How to Set the Look and Feel":
http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html

Or another:
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-LAF.html


Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

Just for the heck of it. I keep a utility method that handles all of the LAF's I use:

public void setSwingLAF(JFrame frame, String targetTheme)
{
String method = new Throwable().getStackTrace()[0].getMethodName() + ": ";
//
// Set the User Profile LAF
JBookMarksPrefs.setLaf(targetTheme);
try
{
if (targetTheme.equalsIgnoreCase(NATIVE))
{

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(frame);
return;
} else if (targetTheme.equalsIgnoreCase(KUNSTSTOFF))
{
UIManager.setLookAndFeel(new com.incors.plaf.kunststoff.KunststoffLookAndFeel());
SwingUtilities.updateComponentTreeUI(frame);
return;
} else if (targetTheme.equalsIgnoreCase(JAVA))
{

UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
SwingUtilities.updateComponentTreeUI(frame);
return;
} else if (targetTheme.equalsIgnoreCase(MOTIF))
{

UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
return;
} else if (targetTheme.equalsIgnoreCase(METAL))
{

UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
return;
} else if (targetTheme.equalsIgnoreCase(GTK))
{

UIManager.setLookAndFeel("org.gtk.java.swing.plaf.gtk.GtkLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
return;
} else if (targetTheme.equalsIgnoreCase(METOUIA))
{
UIManager.setLookAndFeel(new MetouiaLookAndFeel());
SwingUtilities.updateComponentTreeUI(frame);
return;
}
else if (targetTheme.equalsIgnoreCase(WINDOWSCLASSIC)){

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
return;
}
else if (targetTheme.equalsIgnoreCase(MACOSX_WRAP)){
System.setProperty("Quaqua.tabLayoutPolicy","wrap" );

UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
return;
}
else if (targetTheme.equalsIgnoreCase(MACOSX_SCROLL)){
System.setProperty("Quaqua.tabLayoutPolicy","scroll" );

UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
return;
}
// Load the Goodies LAF Color
if (targetTheme.equalsIgnoreCase(BROWNSUGAR))
Plastic3DLookAndFeel.setMyCurrentTheme(new BrownSugar());
else if (targetTheme.equalsIgnoreCase(DARKSTAR))
Plastic3DLookAndFeel.setMyCurrentTheme(new DarkStar());
else if (targetTheme.equalsIgnoreCase(DESERTBLUE))
Plastic3DLookAndFeel.setMyCurrentTheme(new DesertBlue());
else if (targetTheme.equalsIgnoreCase(DESERTBLUER))
Plastic3DLookAndFeel.setMyCurrentTheme(new DesertBluer());
else if (targetTheme.equalsIgnoreCase(DESERTGREEN))
Plastic3DLookAndFeel.setMyCurrentTheme(new DesertGreen());
else if (targetTheme.equalsIgnoreCase(DESERTRED))
Plastic3DLookAndFeel.setMyCurrentTheme(new DesertRed());
else if (targetTheme.equalsIgnoreCase(DESERTYELLOW))
Plastic3DLookAndFeel.setMyCurrentTheme(new DesertYellow());
else if (targetTheme.equalsIgnoreCase(EXPERIENCEBLUE))
Plastic3DLookAndFeel.setMyCurrentTheme(new ExperienceBlue());
else if (targetTheme.equalsIgnoreCase(EXPERIENCEGREEN))
Plastic3DLookAndFeel.setMyCurrentTheme(new ExperienceGreen());
else if (targetTheme.equalsIgnoreCase(SILVER))
Plastic3DLookAndFeel.setMyCurrentTheme(new Silver());
else if (targetTheme.equalsIgnoreCase(SKYBLUE))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyBlue());
else if (targetTheme.equalsIgnoreCase(SKYBLUER))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyBluer());
else if (targetTheme.equalsIgnoreCase(SKYBLUERTAHOMA))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyBluerTahoma());
else if (targetTheme.equalsIgnoreCase(SKYKRUPP))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyKrupp());
else if (targetTheme.equalsIgnoreCase(SKYPINK))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyPink());
else if (targetTheme.equalsIgnoreCase(SKYRED))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyRed());
else if (targetTheme.equalsIgnoreCase(SKYYELLOW))
Plastic3DLookAndFeel.setMyCurrentTheme(new SkyYellow());

// Load the Goodies LAF
Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true);
UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
UIManager.put(com.jgoodies.plaf.Options.DEFAULT_ICON_SIZE_KEY,
new Dimension(18, 18));
SwingUtilities.updateComponentTreeUI(frame);

} catch (Exception e)
{
Error.message("setSwingLAF",e);
}
}

Naturally, here are the hard codded vars:


final public String LOOK_AND_FEEL = "Look & Feel";
final public String GOODIES = "Goodies";

final public String NATIVE = "Native";
final public String JAVA = "Java";
final public String MOTIF = "Motif";
final public String METAL = "Metal";
final public String KUNSTSTOFF = "Kunststoff";
final public String METOUIA = "Metouia";
final public String WINDOWSCLASSIC = "WindowsClassic";
final public String GTK = "GTK";
final public String MACOSX = "Mac OS X";
final public String MACOSX_WRAP = "Wrap Tabs";
final public String MACOSX_SCROLL = "Scroll Tabs";

final public String BROWNSUGAR = "BrownSugar";
final public String DARKSTAR = "DarkStar";
final public String DESERTBLUE = "DesertBlue";
final public String DESERTBLUER = "DesertBluer";
final public String DESERTGREEN = "DesertGreen";
final public String DESERTRED = "DesertRed";
final public String DESERTYELLOW = "DesertYellow";
final public String EXPERIENCEBLUE = "ExperienceBlue";
final public String EXPERIENCEGREEN = "ExperienceGreen";
final public String SILVER = "Silver";
final public String SKYBLUE = "SkyBlue";
final public String SKYBLUER = "SkyBluer";
final public String SKYBLUERTAHOMA = "SkyBluerTahoma";
final public String SKYKRUPP = "SkyKrupp";
final public String SKYPINK = "SkyPink";
final public String SKYRED = "SkyRed";
final public String SKYYELLOW = "SkyYellow";

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
.