Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

how to set a different LooAndFeel?

Thread view: 
Scirious - 16 Jun 2006 03:05 GMT
People, how do I set a different LookAndFeel for may projects in Netbeans?

TIA,
Scirious.
IchBin - 16 Jun 2006 04:37 GMT
> People, how do I set a different LookAndFeel for may projects in Netbeans?
>
> TIA,
> Scirious.

If you mean the Netbeans IDE? You can do it presently two ways.

- Download the Substance laf as a external module.
   http://www.netbeans.org/kb/50/substance-look-and-feel.html
   https://substance-netbeans.dev.java.net

- Pass a different LAF to Netbeans, when you execute it via a startup
command:   -Dswing.defaultlaf=YourLafYouWantToUse

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-)
IchBin - 16 Jun 2006 04:48 GMT
>> People, how do I set a different LookAndFeel for may projects in
>> Netbeans?
[quoted text clipped - 10 lines]
> - Pass a different LAF to Netbeans, when you execute it via a startup
> command:   -Dswing.defaultlaf=YourLafYouWantToUse

Sorry not sure if using the Java "-Dswing.defaultlaf=" works nowadays. I
use to use it to change the LAF of Netbeans.

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-)
Scirious - 16 Jun 2006 04:59 GMT
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.
IchBin - 16 Jun 2006 05:29 GMT
> 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-)
IchBin - 16 Jun 2006 05:37 GMT
>> 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
[quoted text clipped - 13 lines]
> '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-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.