Change Look & Feel in open JFrame s & JDialog s

Discussion in 'Java' started by Guest, Sep 29, 2004.

  1. Guest

    Guest Guest

    I have 3 open JFrame s and from a JDialog which is "Options" of my program,
    I change Look & Feel from "Windows" to "Metal".

    How can I change Look & Feel of opened JFrame s without .dispose() and
    recreate?

    thanks
     
    Guest, Sep 29, 2004
    #1
    1. Advertising

  2. On Wed, 29 Sep 2004 23:05:41 +0300, <- Chameleon -> wrote:

    > I have 3 open JFrame s ... (snip)


    <http://www.physci.org/codes/javafaq.jsp#clj>

    > How can I change Look & Feel of opened JFrame s .. (snip)


    <http://www.physci.org/test/lnf/>
    Chase the first link to 'View _source_' for the applet code.
    (The code runs as a frame as well.)

    HTH

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.lensescapes.com/ Images that escape the mundane
     
    Andrew Thompson, Sep 29, 2004
    #2
    1. Advertising

  3. On Wed, 29 Sep 2004 20:34:57 GMT, Andrew Thompson wrote:

    >> I have 3 open JFrame s ... (snip)

    >
    > <http://www.physci.org/codes/javafaq.jsp#clj>


    Ooops!
    <http://www.physci.org/codes/javafaq.jsp#cljg>
     
    Andrew Thompson, Sep 29, 2004
    #3
  4. <- Chameleon -> wrote:
    > I have 3 open JFrame s and from a JDialog which is "Options" of my program,
    > I change Look & Feel from "Windows" to "Metal".
    >
    > How can I change Look & Feel of opened JFrame s without .dispose() and
    > recreate?
    >


    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    SwingUtilities.updateComponentTreeUI(frame);
    frame.pack(); // If necessary

    The last 2 lines needs to be repeated for every Frame in your application.


    BK
     
    Babu Kalakrishnan, Sep 30, 2004
    #4
  5. Guest

    G Winstanley Guest

    On Wed, 29 Sep 2004 23:05:41 +0300, the cup of "<- Chameleon ->"
    <> overfloweth with the following:

    > I have 3 open JFrame s and from a JDialog which is "Options" of my program,
    > I change Look & Feel from "Windows" to "Metal".
    >
    > How can I change Look & Feel of opened JFrame s without .dispose() and
    > recreate?
    >
    > thanks
    >


    See the other people's posts. HOWEVER, I have encountered numerous problems
    getting this to work reliably. Certain L&F switches do not work as expected,
    not all widgets get changed, etc. Sun HIGHLY recommend that you do not allow
    this in your applications due to the results being unpredictable. I have
    since removed the capability from the application I have been writing, but I
    leave an option to select the default L&F which takes effect at new launch
    time.

    Stan
     
    G Winstanley, Sep 30, 2004
    #5
  6. On Thu, 30 Sep 2004 18:53:28 +0100, G Winstanley wrote:

    > See the other people's posts. HOWEVER, I have encountered numerous problems
    > getting this to work reliably.


    AFAIU, there is a known issue flipping from the Metal PLAF
    to other PLAFs based on MetalTheme. The way to avoid this
    is not offer the DefaultMetalTheme as an option.

    I would be interested in seeing any SSCCE that can
    reproducibly cause other problems.

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.lensescapes.com/ Images that escape the mundane
     
    Andrew Thompson, Sep 30, 2004
    #6
  7. Guest

    G Winstanley Guest

    On Thu, 30 Sep 2004 18:55:02 GMT, the cup of Andrew Thompson
    <> overfloweth with the following:

    > On Thu, 30 Sep 2004 18:53:28 +0100, G Winstanley wrote:
    >
    > > See the other people's posts. HOWEVER, I have encountered numerous problems
    > > getting this to work reliably.

    >
    > AFAIU, there is a known issue flipping from the Metal PLAF
    > to other PLAFs based on MetalTheme. The way to avoid this
    > is not offer the DefaultMetalTheme as an option.
    >
    > I would be interested in seeing any SSCCE that can
    > reproducibly cause other problems.



    My bad experiences were primarily switching from Windows PLAF to Metal PLAF,
    usually when the application was launched in Windows one and then an attempt
    made to switch over to Metal. If Metal was initially active and I then
    switched to Windows and back to Metal I generally encountered few problems.
    That said, the exact component dimensions were slightly different in the
    Windows PLAF if it had been switched to rather than launched that way. The
    most obvious different component was the depth of JTable headers.

    Stan
     
    G Winstanley, Oct 1, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ike
    Replies:
    0
    Views:
    3,487
  2. fishfry
    Replies:
    2
    Views:
    863
    Tom N
    Mar 1, 2004
  3. James
    Replies:
    1
    Views:
    794
    Paul Lutus
    Sep 20, 2004
  4. Jonathon McKitrick

    How to change tkinter GUI look-and-feel?

    Jonathon McKitrick, May 6, 2004, in forum: Python
    Replies:
    3
    Views:
    1,626
    j_mckitrick
    May 7, 2004
  5. Martin

    Change Tkinter Look and Feel?

    Martin, Jul 17, 2004, in forum: Python
    Replies:
    1
    Views:
    565
    klappnase
    Jul 17, 2004
Loading...

Share This Page