[2004] in java-interest
is *anyone* doing beta1 code?
daemon@ATHENA.MIT.EDU (Scott D. Yelich)
Thu Sep 21 15:31:27 1995
Date: Thu, 21 Sep 95 10:31:52 MDT
From: scott@santafe.edu (Scott D. Yelich)
To: java-interest@java.sun.com
PLEASE REPLY TO SCOTT@SANTAFE.EDU
hello? is *anyone* doing beta1 code? where is the source?
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.
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.
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.
Scott
// pseudo code
myCLASS extends Applet
init
Font f;
f = new font; // etc
fm = getFontMetrics(f); // works fine
blah = new someotherclass(f);
fm = getFontMetrics(f); // works fine
someotherclass [extends Applet? Component? Graphics?]
someotherclass (Font f) { // constructor
fm = getFontMetrics(f); // *ALWAYS* *RETURNS* *NULL*
Java is doing some magic.. that's apparently undocumented... I've
tried many combinations of calls and subclassing... but nothing will
make the getfontmetrics call work in a constructor for a second class.
Scott
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com