* Ada-Java quick question
@ 1997-03-06 0:00 Kendal Van Dyke
1997-03-09 0:00 ` Tucker Taft
0 siblings, 1 reply; 2+ messages in thread
From: Kendal Van Dyke @ 1997-03-06 0:00 UTC (permalink / raw)
I'm working on an applet where I'd like to use a media tracker prevent
the applet from starting until all the images have been loaded, but I am
running into a slight problem. I don't quite know how to call
new_MediaTracker. Here's the code I have:
procedure init(obj : access tankwar_obj) is
tracker : mediatracker_ptr := new_mediatracker([something]);
begin
...some code here.....
end init;
According to the Ada-Java API [something] has to be of type
component_ptr. In regular Java, it's usually called as
"new MediaTracker(this)". I know that in most cases in Ada-Java you can
use "null" in place of "this" and it will work, but it didn't in this
case. So, in this code, what would I use to fill in the [something]
part?
--
*.........................................*
. |/ .
. |\ENDAL .
. WWW => http://www.cs.fsu.edu/~vandyke .
. EMail => vandyke@cs.fsu.edu .
. Pager => (904) 297-6658 .
. .
*.........................................*
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Ada-Java quick question
1997-03-06 0:00 Ada-Java quick question Kendal Van Dyke
@ 1997-03-09 0:00 ` Tucker Taft
0 siblings, 0 replies; 2+ messages in thread
From: Tucker Taft @ 1997-03-09 0:00 UTC (permalink / raw)
Kendal Van Dyke (kendal@fn3.freenet.tlh.fl.us) wrote:
: I'm working on an applet where I'd like to use a media tracker prevent
: the applet from starting until all the images have been loaded, but I am
: running into a slight problem. I don't quite know how to call
: new_MediaTracker. Here's the code I have:
: procedure init(obj : access tankwar_obj) is
: tracker : mediatracker_ptr := new_mediatracker([something]);
: begin
: ...some code here.....
: end init;
: According to the Ada-Java API [something] has to be of type
: component_ptr. In regular Java, it's usually called as
: "new MediaTracker(this)". I know that in most cases in Ada-Java you can
: use "null" in place of "this" and it will work, but it didn't in this
: case. So, in this code, what would I use to fill in the [something]
: part?
What is a tankwar_obj? If it is derived directly or indirectly
from java.awt.Component.Component_Obj then you can write:
... := new_mediatracker(Component_Ptr(obj));
Otherwise, you will need to pass an additional parameter to "init"
which is some derivative of Component_Obj. Note that
java.applet.Applet.Applet_Obj is derived from Component_Obj,
so if tankwar_obj is the applet object, then you can use that.
Ada 95 requires the explicit conversion to Component_Ptr, because
its type checking model is "stronger" than Java's for access types
(not necessarily helpfully stronger in cases like this).
: *.........................................*
: . |/ .
: . |\ENDAL .
: . WWW => http://www.cs.fsu.edu/~vandyke .
: . EMail => vandyke@cs.fsu.edu .
: . Pager => (904) 297-6658 .
: . .
: *.........................................*
-Tucker Taft stt@inmet.com http://www.inmet.com/~stt/
Intermetrics, Inc. Burlington, MA USA
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-03-09 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-03-06 0:00 Ada-Java quick question Kendal Van Dyke
1997-03-09 0:00 ` Tucker Taft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox