Change Look & Feel in open JFrame s & JDialog s

G

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
 
A

Andrew Thompson

B

Babu Kalakrishnan

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
 
G

G Winstanley

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
 
A

Andrew Thompson

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
 
G

G Winstanley

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top