[4564] in java-interest

home help back first fref pref prev next nref lref last post

Re: b2 Component changes?

daemon@ATHENA.MIT.EDU (Jim Graham)
Sat Jan 6 20:26:35 1996

Date: Sat, 6 Jan 1996 14:51:16 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, pat@icon-stl.net

Hi Pat,

> The b2 Component class now seems to go directly to the default Toolkit
> for otherwise peer related resources if the peer isn't established yet.
> 
> What does this mean?

This was done for convenience.  So many people were complaining that
they tried to use these methods and were getting null pointers back
and it confused them.  So the decision was made that since all Components
eventually make a default assumption about what Toolkit they will be
realized with, and since 99+% of all programmers had no intention of
overriding those default choices, that we go ahead and make these methods
work based on what the Component would choose if it was forced to choose
at that point in time.

Now the responsibility lies with the <1% of programmers who might want
to override the default decisions.  They should make sure they specify
the alternate Toolkit before they call any of these routines.

> How can it make sense to do a prepareImage(), createImage(), or 
> getFontMetrics() on the default toolkit if that might not be the toolkit of
> the components peer???

The idea is that if you haven't overidden the mechanisms that make the
choice of the Component's peer by the time you call these methods, then
you probably aren't going to.  And meanwhile, we remove a source of much
confusion by making the frequently accurate default assumption.

				...jim

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post