[2134] in java-interest

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

Re: is *anyone* doing beta1 code?

daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Tue Sep 26 00:19:33 1995

Date: Mon, 25 Sep 1995 13:43:48 -0800 (PDT)
From: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Reply-To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
To: "Scott D. Yelich" <scott@santafe.edu>
Cc: java-interest@java.Eng.Sun.COM



Hi Scott,

> hello?

Hi?

>  is *anyone* doing beta1 code?  

Yes.

> where is the source?

To what?
 
> I've been working for nearly a week trying to convert some textbox
> class to beta1. 
> 
> I am running into a problem where I get a "null" in return for a
> getFontMetrics call.  The (lousy) docs for getFontMetrics say it will
> return null if the component is not on the screen, but this doesn't
> answer why the call seems to work everywhere else other than a
> constructor.

The getFontMetrics call will only return a FontMetrics object once the
component has been "realized", i.e. has been made visible on the screen.

> I can get a value for getFontMEtrics in an applet.init() or most any
> other place, other than a constructor for another class.  This is
> really frustrating because this is the *only* place where I *need* the
> getFontMetrics call.

Your applet class really should not have a constructor. You should do
all your constructing in the init() method instead.

> Does anyone have an example of a call that calls a constuctor for
> another class where the second class has a call to getFontMetrics?
> 
> I'm about ready and willing to kill for any beta1 code that actually
> works.

There are lots of examples of applets (with source) in the JDK release.

Have fun,

	Arthur van Hoff


-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

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