Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
Swing / AWT / SWT
Look and Feel
Jeremy Hooie
Ranch Hand
Posts: 38
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How can I change the Look and Feel of my application between Metal, Motif, and Windows? Ultimately, I would like for the end user to switch between L&F designs. Is this an easy process or a massive undertaking?
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
try something like this. Just put it in an ActionEvent on a Button to press or a menu option.
Sorry about the rough code.
if (e.getActionCommand().equals("Metal")) { lnfName = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (e.getActionCommand().equals("Motif")) { lnfName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else { lnfName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"; } try { UIManager.setLookAndFeel(lnfName); SwingUtilities.updateComponentTreeUI(frame); } catch (UnsupportedLookAndFeelException ex1) { System.err.println("Unsupported LookAndFeel: " + lnfName); } catch (ClassNotFoundException ex2) { System.err.println("LookAndFeel class not found: " + lnfName); } catch (InstantiationException ex3) { System.err.println("Could not load LookAndFeel: " + lnfName); } catch (IllegalAccessException ex4) { System.err.println("Cannot use LookAndFeel: " + lnfName); }
------------------
Happy Coding,
Gregg Bolinger
Jeremy Hooie
Ranch Hand
Posts: 38
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks! Works Great.
Jeremy
You can thank my dental hygienist for my untimely aliveness. So tiny:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JPanel
JFileChooser customizing
Passed SCJD 149/155
Please run the program in pure Unix Box
How to set color of scrollbar in scrollpane?
More...