Results 1 to 10 of 10
  1. #1
    titir is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Question Look and Feel of GUI

    I am using JFrame for my GUI and I am not able to change the appearance of my GUI according to appearance of present OS.
    Please help me to sort out the problem.
    Your kind attention and help would be greatly appreciated.
    Thanks in advance.

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

  3. #3
    titir is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Default

    Thanks a lot for replying.
    I saw the link and I already used
    UIManager.setLookAndFeel(UIManager.getSystemLookAn dFeelClassName());
    and
    UIManager.setLookAndFeel("javax.swing.plaf.metal.M etalLookAndFeel");
    but its not changed at all.
    So can you please suggest me what else can be done.

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default

    If you need further help then you need to create a Short, Self Contained, Correct Example (SSCCE)
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  5. #5
    titir is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Default

    The code is

    import java.awt.event.*;
    import java.io.File;
    import javax.swing.*;
    public class CurveFitting extends JFrame implements ActionListener, FocusListener{

    /**
    * @param args
    */
    public CurveFitting() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException{
    super("My GUI");
    //code to add components
    pack();
    setVisible(true);
    UIManager.setLookAndFeel("javax.swing.plaf.metal.M etalLookAndFeel");
    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);

    }
    p
    public void actionPerformed(ActionEvent e) {
    //to perfom some action
    }

    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
    // TODO Auto-generated method stub
    CurveFitting cf=new CurveFitting();
    }
    }
    but its not changing the appearance at all.

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default

    Doh, read the tutorial, especially the parts about how to set a look and feel after the GUI is visible, or when to set the L&F.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  7. #7
    titir is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Default

    I saw and then I added the line
    UIManager.setLookAndFeel("javax.swing.plaf.metal.M etalLookAndFeel");
    And I'm not able to make out where I'm going wrong.
    Give me some suggestion.

  8. #8
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    7

    Default

    read the tutorial, especially the parts about how to set a look and feel after the GUI is visible, or when to set the L&F.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  9. #9
    Michael Dunn is offline Member
    Join Date
    Jul 2008
    Posts
    62
    Rep Power
    0

    Default

    > I saw and then I added the line
    > UIManager.setLookAndFeel("javax.swing.plaf.metal.M etalLookAndFeel");
    > And I'm not able to make out where I'm going wrong.
    > Give me some suggestion.

    google
    UIManager.setLookAndFeel

    copy/paste/compile/run any of the numerous examples you'll find,
    and if you can't work it out, seriously, apply to macdonalds

  10. #10
    cselic is offline Senior Member
    Join Date
    Apr 2010
    Location
    Belgrade, Serbia
    Posts
    278
    Rep Power
    5

    Default

    I saw and then I added the line
    UIManager.setLookAndFeel("javax.swing.plaf.metal.M etalLookAndFeel");
    And I'm not able to make out where I'm going wrong.
    Give me some suggestion.
    MetalLookAndFeel is by default.
    try with some other look and feel, for example windows look and feel.

    For example if you want Windows look and feel use this code:
    Java Code:
    try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (Exception e) {
                e.printStackTrace();

Similar Threads

  1. About look and feel
    By makpandian in forum AWT / Swing
    Replies: 6
    Last Post: 02-13-2009, 03:55 AM
  2. Look and Feel
    By Stein in forum New To Java
    Replies: 10
    Last Post: 10-03-2008, 05:07 AM
  3. A Look-and-feel switcher
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-26-2008, 08:45 PM
  4. Swing - Look and feel
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-11-2008, 11:53 PM
  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
  •