Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java GUI
|
Java GUI Discussions specific to programming Java GUI.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java GUI section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2003, 11:00 AM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default applying custom look and feel for GUI

hello there,

as for the GUI and other stuff, how am i gonna set the L&F for the windows and buttons? as are there any L&F skin that can be downloaded and apply it to the application?

 
Old November 7th, 2003, 12:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the following code snippet for a Windows look and feel:


javax.swing.UIManager.setLookAndFeel(
  "com.sun.java.swing.plaf.windows.WindowsLookAndFee l" );

javax.swing.SwingUtilities.updateComponetTreeUI( this );


Cheers

Martyn
 
Old November 14th, 2003, 06:32 PM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oh, thks for the reply..
but when I put it inside the extended class Jframe I wrote,
which type of exception i should catch? and is it appropriate to include the code inside the constructor?
or some other method's body?

thks..

 
Old November 15th, 2003, 09:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The setLookAndFeel method can throw 4 differnt types of exception. You can catch each one of them individually, catch only the ones you are bothered about, or use Exception to catch them all. Personlly, I would just catch Exception.

It is fine to put the look & feel code into the constructor.


Cheers

Martyn
 
Old November 15th, 2003, 11:02 PM
Authorized User
 
Join Date: Oct 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mrafaqi Send a message via Yahoo to mrafaqi
Default

hi!
i know only that there are three look and feel style,
 1. java native look and feel
 2. motif look and feel
 3. window look and feel (System look and feel)

following is the code which is better if write in main() before creating the object of the class. i know just for two, as java native is default but to switch from one to another i do not know

 but try this

 public static void main(String args[])
 {
   try
   {
      UIManager.setLookAndFeel(UIManager.getSystemLookAn dFeelClassName());
     }
     catch(Exception exp)
      {
           System.out.println(exp);
      }
  }

 above code is for window look and feel, to make motif look and feel just change the argument in setLookAndFeel which is
 a String argument "com.sun.java.swing.plaf.motif.MotifLookAndFee l"

now LookAndFeel will be motif







Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you feel the same? thinkseo123 HTML Code Clinic 0 May 18th, 2007 10:14 AM
XP Look-n-Feel for DataGridBoolColumn bigpg C# 0 December 10th, 2004 08:52 PM
How to change look n feel of button in Datagrid vinod_pawar1 General .NET 5 September 1st, 2004 10:00 AM
component's look and feel in flash2004 mybluecolor Flash (all versions) 1 January 30th, 2004 09:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.