Results 1 to 6 of 6
  1. #1
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default change Look and feel in Netbeans 6.8

    Few years ago, I code java with notepad++ and want to change L&F java, I could try with codes after main():
    Java Code:
    try {
    UIManager.setLookAndFeel("name L&F");
    } catch (Exception e) {}
    Now, I create a project Java Destop Application by Netbeans 6.8. Although I try it, but I can't change L&F to my favourite L&F.
    I try to search in this subforum but I can't find any information to help me.
    Please help me? Thanks for reading

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  3. #3
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default

    I create new Java Desktop App project in Netbeans 6.8. I try to change L&F by follow code after main() method:
    Java Code:
    try {
    UIManager.setLookAndFeel("...");
    } catch (...){}
    When I build & run this project, my app's interface doesn't change to my L&F. It's my trouble.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    At what time you did this? You should set LookAndFeel before any swing component initialized. And also you have to check what are the available LookAndFeel on your platform. UIManager gives the available list, check on Java DOC how to use it.

    And more suitable,

    Java Code:
    try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } 
    catch (Exception e) {
            // Handle the error
    }

  5. #5
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default

    Hi Eranga, many thanks for your advance. Few years ago, I usually insert this code to the first call in main() method and no problem. Now I try to insert code to before initComponent() method as you said and success. Sorry for my bad knowledge.
    Can you mark [SOLVED] to this topic? I can't edit the header's topic
    Last edited by banhbaochay; 04-12-2010 at 07:17 PM.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    You are welcome. :)

    Actually it's better to mark the thread solved by you. Check on Thread Tools menu on top of the first post in thread. Click on it, you can find the option to mark the thread solved option.

Similar Threads

  1. Replies: 1
    Last Post: 01-21-2010, 10:20 AM
  2. Replies: 0
    Last Post: 03-26-2009, 02:23 AM
  3. About look and feel
    By makpandian in forum AWT / Swing
    Replies: 6
    Last Post: 02-13-2009, 03:55 AM
  4. Look and Feel
    By Stein in forum New To Java
    Replies: 10
    Last Post: 10-03-2008, 05:07 AM
  5. Look and Feel
    By arun_kumar in forum AWT / Swing
    Replies: 1
    Last Post: 11-17-2007, 07:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •