Setting Look n' Feel for non subcomponents

Hi, I have a GUI selection on my main application frame that will let the user choose a look n' feel. When that is chosen, the event is fired and the following method is called. Selection is one of course,
"javax.swing.plaf.metal.MetalLookAndFeel"
"com.sun.java.swing.plaf.motif.MotifLookAndFeel" OR
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
void updateLookAndFeel(String selection) {
try {
UIManager.setLookAndFeel(selection);
SwingUtilities.updateComponentTreeUI(this);
catch (Exception ex) {
ex.printStackTrace();
This updates all components that are contained within this frame. In addition, all newly created frames also use the new look and feel. However, any frames that I created before this call continue to have the old look n' feel. An explicit call to repaint from outside those frames would be a tedious fix for the non-static frames , but I also have some that are large and used often that I keep static for speed. Is there a way to update these non-contained frames? Please don't tell me to put listeners on them :-)

I will restrain myself from commenting on the practice of subclassing frame...
If you have a reference to those frames already in your main class, control all the l&f logic in there (where it should be) and then just do something like this:
SwingUtilities.updateComponentTreeUI( frame1 );
SwingUtilities.updateComponentTreeUI( frame2 );
SwingUtilities.updateComponentTreeUI( frame3 );Or better yet, keep all your application's created frames in a collection and iterate through it.

Similar Messages

  • Change look n feel for java???????

    hi frens. can anyone tell me how i can change the look n feel for java. i mean i want to change the default window, buttons, color... say i want to have my the look n feel of my output like classic windows type. pls suggest me. thanks in advance....

    {color:#0000ff}http://java.sun.com/docs/books/tutorial/uiswing/lookandfeel/plaf.html{color}
    db

  • Customised look and feel for B2B/B2C web shop.

    Dear experts,
                I would like to find out if there is an admin page for SAP E-commerce to customise the look and feel of the webshop?
    Thanks.
    Wein

    Hi Wein,
    To change Look and Feel for Web shop is depends on scenario of eCommerce application i.e. B2B or B2C. B2B has different structure than B2C.
    Web Channel application comes in SAP standard with SAP look and Feel. You have to change look and feel as per client requirement.
    To change look and feel of Both B2B/B2C scenario you have to deal with files like CSS, JSP, Properties, XLF and some time you have to add your custom JAVA, JSP, CSS, Properties files etc...
    To change standard SAP logo youhave to make change in CSS files. Also you have to consider Browser type while changing look and feel because to display your B2B/B2C application correctly in different browser you have to make changes in different CSS.
    You will get better idea with example how to change look and feel in "Dev & Ext. Guide" for Web Shop. You will get this from Service Market place.
    eCommerce Developer.

  • Setting the Brushed Metal look and feel for macs using Java.

    Hello,
    I am relatively new to Java and I am new to Mac-specific java stuff. Anyways, when I try to set the look and feel of my classes to the "apple.awt.brushMetalLook" look and feel, I am unable to. It works if I have System.setProperty("apple.awt.brushMetalLook", "true"); written before I create any swing component. This would be fine, except that means that it is impossible to extend any swing component, such as JFrame or JApplet. Is there a way around this?
    Thanks!

    This might answer your question:
    http://lists.apple.com/archives/Java-dev/2003/Apr/msg00829.html

  • Problem setting look and feel

    It seems like I'm not able to change the windows xp look and feel, I'm using this code to change it but nothing happens, the window comes out with windows LAF:
    " public static void main(String[] args)
    try {
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception e) { System.out.println(e.getMessage()); }
    new Ventana();
    Maybe... Am I missing some code? or a specific class needs to be downloaded?
    I'd apreciate any help

    That was not the problem, but thank you...
    I finally noticed the problem, what I was trying to do was actually done by writting this:
    JComponent.setDefaultLookAndFeelDecorated(true);
    Sets the OceanTheme feel on, but I noticed that when you try to use it with a Jdialog and a JFileChooser you get some ugly colors. Orange/Brown with JDialogs and Green with JFileChoosers. Is this a bug or it's ment to do that?
    Does somebody know how to fix it?
    Thanks for your support

  • Look'n'feel for handheld applications

    Dear Experts,
    Could someone explain me how to redefine a new look'n'feel style/theme for the WebDynpro handheld Client on MI7.10? Indeed, the standard SAP UI Theme doen't fit to our Usability Policy.
    Thanks and Regards,
    Ludovic

    For 7.1 OCA SP03, we were given this for our development.
    default
         stylesheet.default.backgroundcolor
         stylesheet.default.foreground
         stylesheet.default.font.name
         stylesheet.default.font.size
         stylesheet.default.height
         stylesheet.default.bordercolor
    brandingarea     
         stylesheet.brandingarea.backgroundcolor
         stylesheet.brandingarea.bordercolor
         stylesheet.brandingarea.font.size
         stylesheet.brandingarea.foreground
         stylesheet.brandingarea.height
         stylesheet.brandingarea.brandingtext
    button     
         stylesheet.button.backgroundcolor
         stylesheet.button.font.size
         stylesheet.button.foreground
         stylesheet.button.height
    label     
         stylesheet.label.backgroundcolor
         stylesheet.label.font.size
         stylesheet.label.foreground
         stylesheet.label.height
    caption     
         stylesheet.caption.backgroundcolor
         stylesheet.caption.font.size
         stylesheet.caption.foreground
         stylesheet.caption.height
    inputfield     
         stylesheet.inputfield.backgroundcolor
         stylesheet.inputfield.font.size
         stylesheet.inputfield.foreground
    radionbutton     
         stylesheet.radiobutton.radiobutton
    linktoaction     
         stylesheet.linktoaction.backgroundcolor
         stylesheet.linktoaction.font.size
         stylesheet.linktoaction.foreground
         stylesheet.linktoaction.height
    statusbar     
         stylesheet.status.backgroundcolor
         stylesheet.status.errorcolor
         stylesheet.status.messagecolor
         stylesheet.status.warningcolor
    table     
         header
         stylesheet.table.header.backgroundcol
         stylesheet.table.header.foreground
         stylesheet.table.header.height
         stylesheet.table.header.font.size
         content
         stylesheet.table.content.backgroundcolor
         stylesheet.table.content.foreground
         stylesheet.table.content.height
         stylesheet.table.content.font.size
         footer
         stylesheet.table.footer.backgroundcolor
         stylesheet.table.footer.foreground
         stylesheet.table.footer.height
         stylesheet.table.footer.font.size
    imagebutton     
         stylesheet.imagebutton.backgroundcolor
         stylesheet.imagebutton.font.size
         stylesheet.imagebutton.foreground
    image     
         stylesheet.image.backgroundcolor
    You might have to test and see if the same applies for the version you are using, I have not seen anything published as to what stylesheet properties are supported by NWM.
    We are trying to move to SP7 - but we are having troubles with look 'n' feel
    All our eSWT custom controls within Interactive Forms all got set to a fixed height which did not happen in SP3, it used the height set within NWDS' View Editor.

  • Can i perform SDK 7 Compilation while maintaining SDK6 look and feel for my App

    In our organization we test the App using visual specs and our existing visual specs are aligned with SDK 6 look and feel. When i compile my app with SDK 7 the visual display of the App changes completely and is no longer in sync with the visual specs used for testing. As SDK 7 compilation is a mandate for post Feb 1 submission, is it possible to compile the code with SDK 7 while maintaining SDK 6 visual look and feel?

    What i am actually trying to do is to maintain the existing SDK6 UI Look and Feel on iOS7. Apple has issued a mandate to have all Apps compiled with SDK7 for App Store submission post Feb1, 2014. If i compile with SDK7, even if i set the deployment target as iOS6, when my app runs on iOS7 it will have the new Apple's iOS7 look and feel. How can i accomplish this?

  • Changing look and feel for one INSTANCE of a component

    I am trying to change the look and feel of just ONE instance of a component. In particular, I want to change the color of the JScrollBar thumb on a certain JScrollPane. I want this change to not affect any other component, either before or after. How can I do this?? Any help would be much appreciated.
    AC

    Hi acalvin3!
    I have a solution. Use the UIManagers database. You should overwrite the default settings for the resource you want to change, the code is self explaining:
          UIManager.put( "Button.margin", commonMargin );
          UIManager.put( "Button.focusInputMap", commonInputMap );
          UIManager.put( "Button.font", buttonFont );To reset values you only have to use
          UIManager.put( "Button.margin", null );
          UIManager.put( "Button.focusInputMap", null );
          UIManager.put( "Button.font", null );Set values before you create your component and reset values immedeately after you created your component, otherwise you may affect other components too.
    With following code you can find out default values for the whole UIManagers database:
          Hashtable defaultProps = UIManager.getDefaults();
          Enumeration enum = defaultProps.keys();
          while (enum.hasMoreElements()) {
             Object key = enum.nextElement();
             System.out.println( "key: '" + key + "'\t value: '" + defaultProps.get(key) + "'" );
          }You just have to look for the output for the component you want to change the look and feel.
    Have fun...

  • How do I get a more modern look and feel for a compiled help file

    I gather from reading various posts that there is no easy way
    to generate a .chm file with a more modern look and feel (am I
    right about this?). Are there no plug-ins available from Adobe that
    will enable us to generate a help file that looks more modern?
    I hesitate to move to flash help or something like that
    because, of course, then the developers would have to hookup the
    hundreds of dialog boxes we have in our product to the new files. I
    also think that having one file is way easier to manage in terms of
    getting updated help to the customers. What are online Help
    developers generally delivering for apps where users are not
    connected to the Internet except perhaps periodically while using
    the software? I'm a writer (not a developer) so need soemthing that
    is easy to implement :-)
    Thanks for your help. It is much appreciated.

    To add to the advice already offered, you can apply a skin to
    a CHM file which allows you to customise it. However as with most
    things there are issues with this approach. You can read about this
    by downloading Rick Stone's excellent
    tips
    'n tricks file. Just look in the index under "skins". Something
    else you may want to look at is the beta of Adobe's
    AIR.

  • How to change the look and feel for Heading of quick launch menu in project server 2010

    Hi
    can someone tell me how to change the look and feel of Header names in quick launch.
    I want the header to be displayed in Bold with Underline to it.
    could this be possible for just header in quick launch in project server 2010. 

    Hi Rohan
    It does not work this way. You have to use a content editor webpart.
    See references below that might help you starting with this customisation:
    Http://go4answers.webhost4life.com/Example/sharepoint-2010-quick-launch-look-feel-78379.aspx
    Http://m.sharepointpromag.com/sharepoint/four-ways-add-or-remove-quick-launch-menu-control
    Hope this helps.
    Guillaume Rouyre - MBA, MCP, MCTS

  • Setting Look and Feel gives error

    Hi,
    I get error when I use,
    JFrame.setDefaultLookAndFeelDecorated(true);
    cannot resolve symbol
    symbol: method setDefaultLookAndFeelDecorated (boolean)
    location : class javax.swing.JFrame
         JFrame.setDefaultLookAndFeelDecorated(true);
         ^
    1 error
    I am running the example for JFrame in the site . PLease help!!

    Hi,
    that was solved!
    thank u 4 ur time!
    Do you know how to use aqua look and feel??
    I have downloaded the files. demo.bat works fine! and I tested Aqua by editing demo.bat, but how to use it i nmy program?? what is the name to be given for setLookAndFeel(??)

  • Cant Set System Locale (language for non-Unicode programs)

    Im trying to deploy custom image wherein Input language and location should be English Australia , BUT system locale (language for non-Unicode programs) should be English-us. The requirement is as below
    Standards and Formats: English (Australia)
    Location: Australia
    Default input language: English (Australia) – US
    Installed input languages: English (Australia) – US
    Time zone: Cen. Australia Standard Time
    System Locale
    Language for non-Unicode programs: Default - English (United States)
    Below is my CS.ini
    SkipLocaleSelection=YES
    UserLocale=en-AU
    SystemLocale=en-US
    UIlanguage=en-AU
    KeyboardLocale=0c09:00000409
    SkipTimeZone=YES
    TimeZoneName=Cen. Australia Standard Time
    when image is deployed the language for non-Unicode is also getting set to en-AU while it should be en-US, other language setting are as per the requirement. what should I do :(
    thanks a lot
    Sanju.
     

    that is a little-known known issue
    Check this post:
    http://myitforum.com/cs2/blogs/smslist/archive/2009/01/12/mssms-userlocale-in-mdt-sccm-also-changes-system-locale-9a532hdf.aspx
    He details how to modify the ZTIConifgure.xml file.

  • How come setting look and feel not successful

    class gameble{
    public static void main(String argv[])throws Throwable{
    try {
    UIManager.setLookAndFeel(
    UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (Exception e) { }
    console cs = new console();
    cs.addWindowListener(new GenericWindowListener(cs.tv));
    cs.setLocation(320,0);
    cs.show();
    with the above codes, i want java look&feel, but it still shows me window look & feel. need your help!!

    CroosPlatformLookAndFeelClassName looks almost exactly like the java default look and feel.
    You can try other L&F like:
    try{
    UIManager.setLookAndFeel(getSystemLookAndFeelClassName());
    //this will take the look and feel of the OS you are working with
    catch(Exception e){
    System.err.println(e.getMessage());
    or
    try{
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotiveLookAndFeel");
    //this will take the look and feel of the Unix OS
    catch(Exception e){
    System.err.println(e.getMessage());

  • Setting Look and Feel in Netbeans 4.1

    I'm trying to change my program's Look&Feel to the XP Look&Feel, but I can't find any way to change the post-init code for a JFrame. Surely this is possible, but the Code tab for JFrames is very limited and for the life of me I can't find any other way to customize the initialization of one.
    How would one go about doing this?
    Thanks,
    Jick

    Well, I managed to solve my own problem. For reference, I'll explain the process.
    My searches involved looking through the NetBeans interface to change the proper implementation code, but this was actually not necessary. NetBeans' code is very strictly protected by its code-locking mechanism, but the right place to insert the code to change the UI is immediately before the initComponents() method call in your JFrame's constructor.
    Example:
    public class SmartMoverGUI extends javax.swing.JFrame {
    public SmartMoverGUI() {
    try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch(Exception e) {}
    initComponents();
    /* Rest of code below */
    Hope this helps someone. :)

  • Can't set look and feel?

    It's been a while since I've done GUIs. I thought I followed all the instructions, but I just keep getting windows defaults:
    public class CVSCompare extends JFrame
      public CVSCompare()
      { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setJMenuBar(stdMenuBar());
      public static void main(String[] args)
        try
        { UIManager.setLookAndFeel(
            "javax.swing.plaf.metal.MetalLookAndFeel");
        } catch (Exception e) { }
        CVSCompare c = new CVSCompare();
        c.pack();
        c.show();
    }

    If there is a problem occuring when the L&F is set the following will show it......
    try    {
        UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel");   
    catch (Exception e)
    e.printStackTrace();
    }if this doesn't show anything then you must be setting the L&F somewhere else later on...
    nes

Maybe you are looking for