A Look and Feel Question

Discussion in 'Java' started by WDW, Aug 19, 2004.

  1. WDW

    WDW Guest

    How can I reset the UIDefaults before installing a new theme:?
    I will explain ...
    I set the cuurent theme to my own theme
    MetalLookAndFeel.setCurrentTheme(myTheme);
    with following changes to the UIDfeaults:
    public void addCustomEntriesToTable(UIDefaults table) {
    super.addCustomEntriesToTable(table);
    Color c1 = new Color(255, 0, 255);
    table.put("Button.foreground", c1);
    }
    After changing the theme to another theme - ie DefaultMetalThem - the
    foreground color of the button is still pink ...

    Some help please
    TIA
    Willy
     
    WDW, Aug 19, 2004
    #1
    1. Advertising

  2. WDW wrote:

    >How can I reset the UIDefaults before installing a new theme:?
    >I will explain ...
    >I set the cuurent theme to my own theme
    >MetalLookAndFeel.setCurrentTheme(myTheme);
    >with following changes to the UIDfeaults:
    >public void addCustomEntriesToTable(UIDefaults table) {
    >super.addCustomEntriesToTable(table);
    >Color c1 = new Color(255, 0, 255);
    >table.put("Button.foreground", c1);
    >}
    >After changing the theme to another theme - ie DefaultMetalThem - the
    >foreground color of the button is still pink ...
    >
    >Some help please
    >TIA
    >Willy
    >
    >

    May be
    SwingUtilities.updateComponentTreeUI(yourFrame);
    fixes this.
    See http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html#dynamic

    --
    Thomas<dot>Fritsch<squiggle>ops<dot>de
     
    Thomas Fritsch, Aug 19, 2004
    #2
    1. Advertising

  3. WDW

    zoopy Guest

    On 19-8-2004 12:51, WDW wrote:

    > How can I reset the UIDefaults before installing a new theme:?
    > I will explain ...
    > I set the cuurent theme to my own theme
    > MetalLookAndFeel.setCurrentTheme(myTheme);
    > with following changes to the UIDfeaults:
    > public void addCustomEntriesToTable(UIDefaults table) {
    > super.addCustomEntriesToTable(table);
    > Color c1 = new Color(255, 0, 255);
    > table.put("Button.foreground", c1);
    > }
    > After changing the theme to another theme - ie DefaultMetalThem - the
    > foreground color of the button is still pink ...
    >
    > Some help please
    > TIA
    > Willy



    <untested>
    UIManager.getDefaults().putAll(new MetalLookAndFeel().getDefaults());
    </untested>

    --
    Regards,
    Z.
     
    zoopy, Aug 19, 2004
    #3
  4. On Thu, 19 Aug 2004 13:58:41 +0200, Thomas Fritsch wrote:
    > WDW wrote:
    >
    >>How can I reset the UIDefaults before installing a new theme:?


    <http://www.physci.org/codes/javafaq.jsp#cljg>
    ....
    > May be
    > SwingUtilities.updateComponentTreeUI(yourFrame);
    > fixes this.
    > See http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html#dynamic


    See also a code example of same.
    <http://www.physci.org/test/lnf>
    links to source, and this 'full window' applet example..
    <http://www.physci.org/test/lnf/fullwnd5.html>

    HTH

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology
     
    Andrew Thompson, Aug 19, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick

    Consistent Look and Feel

    Nick, Jan 14, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    432
  2. Marina
    Replies:
    3
    Views:
    418
    Marina
    Jan 28, 2004
  3. Mark
    Replies:
    2
    Views:
    392
    Chris Jackson
    Feb 23, 2004
  4. =?Utf-8?B?Sm9l?=
    Replies:
    4
    Views:
    372
    darrel
    Jan 20, 2005
  5. Zvonko

    Look and feel Question

    Zvonko, Jul 11, 2006, in forum: Java
    Replies:
    2
    Views:
    461
    Zvonko
    Jul 12, 2006
Loading...

Share This Page