Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Change Look & Feel in open JFrame s & JDialog s

Reply
Thread Tools

Change Look & Feel in open JFrame s & JDialog s

 
 
Guest
Posts: n/a
 
      09-29-2004
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


 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      09-29-2004
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
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      09-29-2004
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>
 
Reply With Quote
 
Babu Kalakrishnan
Guest
Posts: n/a
 
      09-30-2004
<- 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.M etalLookAndFeel");
SwingUtilities.updateComponentTreeUI(frame);
frame.pack(); // If necessary

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


BK

 
Reply With Quote
 
G Winstanley
Guest
Posts: n/a
 
      09-30-2004
On Wed, 29 Sep 2004 23:05:41 +0300, the cup of "<- Chameleon ->"
<(E-Mail Removed)> 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
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      09-30-2004
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
 
Reply With Quote
 
G Winstanley
Guest
Posts: n/a
 
      10-01-2004
On Thu, 30 Sep 2004 18:55:02 GMT, the cup of Andrew Thompson
<(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving To JDialog From JFrame: NetBeans Design View Has JFrameWithout A Variable Name clusardi2k@aol.com Java 3 08-27-2012 02:58 PM
Event when JFileChooser, JDialog, or JFrame is setVisible'd, eithertrue or false Ross Java 1 08-19-2011 09:25 AM
about resizeable problem in JFrame/JDialog!!! James Java 1 09-20-2004 04:17 PM
Change look and feel on the fly? fishfry Java 2 03-01-2004 08:13 AM
JDialog to JFrame - thoughts pls Ike Java 0 02-27-2004 12:48 PM



Advertisments