Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29578

Re: UIDefaults key?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <eternal@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: UIDefaults key?
Date Wed, 06 Aug 2014 11:17:51 -0700
Organization A noiseless patient Spider
Lines 39
Message-ID <lrtrgc$jcu$1@dont-email.me> (permalink)
References <lrtkud$1ea$1@dont-email.me> <lrtopb$tth$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Wed, 6 Aug 2014 18:17:48 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="aba33539224e5c782fe0c4053f7756fd"; logging-data="19870"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oRSQkWYL2WQDGxUjySSk1"
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0
In-Reply-To <lrtopb$tth$1@dont-email.me>
Cancel-Lock sha1:l5UvFQCNCF/DKZZvybHZzYTTos4=
Xref csiph.com comp.lang.java.programmer:29578

Show key headers only | View raw


On 8/6/2014 10:31, Eric Sosman wrote:
> On 8/6/2014 12:25 PM, Knute Johnson wrote:
>> JComponent has a method, getUIClassID(),  to return the UIDefaults key
>> for the ComponentUI subclass.  A JTextField returns a key of
>> TextFieldUI.  A typical subclass is
>> javax.swing.plaf.metal.MetalTextFieldUI.
>>
>> All the interesting details in the UIDefaults however use keys such as
>> TextField.foreground, TextField.border, TextField.margin etc.  Is there
>> any way to get the prefix, TextField, from the component other than
>> stripping the UI off the end of the UIClassID?
>
>      Climbing the class hierarchy from MetalTextFieldUI up to
> BasicTextFieldUI, I find the method
>
>      /**
>       * Fetches the name used as a key to lookup properties through the
>       * UIManager.  This is used as a prefix to all the standard
>       * text properties.
>       *
>       * @return the name ("TextField")
>       */
>      protected String getPropertyPrefix() {
>          return "TextField";
>      }
>
> ... which sort of looks like what you're after.  (But I haven't
> researched any other delegate classes, so it's possible they're
> different.)
>

I think that is the answer Eric but I just not sure how to get there 
from here yet :-).

Thanks,

-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

UIDefaults key? Knute Johnson <eternal@knutejohnson.com> - 2014-08-06 09:25 -0700
  Re: UIDefaults key? Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-06 13:31 -0400
    Re: UIDefaults key? Knute Johnson <eternal@knutejohnson.com> - 2014-08-06 11:17 -0700
      Re: UIDefaults key? Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-06 14:38 -0400
        Re: UIDefaults key? Knute Johnson <eternal@knutejohnson.com> - 2014-08-06 13:00 -0700
          Re: UIDefaults key? Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-06 16:52 -0400

csiph-web