Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #13792
| From | Jan Burse <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: swing component? |
| Date | 2012-04-22 17:12 +0200 |
| Organization | albasani.net |
| Message-ID | <jn175o$9u8$1@news.albasani.net> (permalink) |
| References | <24010092.561.1335104359317.JavaMail.geo-discussion-forums@pbckz3> |
Peter Cheung schrieb:
> Hi All, does swing component provide something like:
>
> component.setProperty("whatever", "value"); ??
>
> thanks
> from Peter (cmk128@hotmail.com)
Hi,
You can attach client data to a Swing component.
The methods are:
public class JComponent {
/**
* Adds an arbitrary key/value "client property" to this component.
*/
public void putClientProperty(Object key, Object value);
/**
* Returns the value of the property with the specified key.
*/
public Object getClientProperty(Object key);
}
But you must assure that the key does not clash
with a key already used internally by Swing.
Easiest is to use a key that resembles in the prefix
one of your package names.
For example:
myTable.putClientProperty("com.mycompany.mypackage.mykey", "value");
Bye
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
swing component? Peter Cheung <cmk128@gmail.com> - 2012-04-22 07:19 -0700
Re: swing component? markspace <-@.> - 2012-04-22 07:47 -0700
Re: swing component? "Qu0ll" <Qu0llSixFour@gmail.com> - 2012-04-23 01:05 +1000
Re: swing component? Jan Burse <janburse@fastmail.fm> - 2012-04-22 17:12 +0200
Re: swing component? Jan Burse <janburse@fastmail.fm> - 2012-04-22 17:18 +0200
Re: swing component? markspace <-@.> - 2012-04-22 10:10 -0700
Re: swing component? Peter <mcheung63@gmail.com> - 2012-04-24 06:44 -0700
Re: swing component? Roedy Green <see_website@mindprod.com.invalid> - 2012-04-27 05:06 -0700
Re: swing component? Roedy Green <see_website@mindprod.com.invalid> - 2012-04-24 08:52 -0700
csiph-web