From: frebourg@cui.unige.ch (FREBOURG Fabrice)
Subject: Mapping between Ada95 (AppletMagic from Intermetrics Inc) and Java
Date: 1997/01/10
Date: 1997-01-10T00:00:00+00:00 [thread overview]
Message-ID: <5b62s2$80g@uni2f.unige.ch> (raw)
Hello,
I've a problem to execute an applet with Ada95. (cross-compilator AppletMagic)
I've created a quit button on a frame. When I'm clicking on such a button, I must
normally trigger is its associate operation. This operation is called action.
If I'm cliking on my button, there is nothing. It's as if my function action wasn't
take by the event manager. Do you know how I can lay my action function to the event
manager in order to execute an exit of my applet. (In Ada, I've got any problem to compile.)
In Java, here is the following code:
public boolean action(Event e,Object arg) {
if ("Quit".equals(arg)) {
dispose();
System.exit(0);
return true;
}
return false;
} // action
other way
private Button quit_button;
.
.
.
public boolean action(Event e,Object arg) {
if (e.target == quit_button ) then
dispose();
System.exit(0);
return true;
} // end if
return false;
} // action
In Ada 95, I'm suggesting this code which is correct, but It does nothing:
with interfaces.java; use interfaces.java;
with java.lang; use java.lang;
with java.lang.String; use java.lang.String;
with java.awt.Frame; use java.awt.Frame;
with java.awt.Event; use java.awt.Event;
with java.awt.Container; use java.awt.Container;
with java.awt.Component; use java.awt.Component;
with java.awt.Button; use java.awt.Button;
.
.
.
function action(Obj : access Button_Obj;
evt : Event_Ptr;
what : Object_Ptr)
return boolean is
Quit:constant String_Ptr:=+"Quit";
begin
if ( Quit.all = what.all )then
exit_op(0);
return true;
end if;
return false;
end action;
other way
quit_button: Button_Ptr:= new_Button(+"Quit");
.
.
.
function action(Obj : access Button_Obj;
evt : Event_Ptr;
what : Object_Ptr)
return boolean is
begin
if evt.target = quit_button then
-- Problem: it doesn't exist such "=" operator between Object_Ptr
exit_op(0);
return true;
end if;
return false;
end action;
next reply other threads:[~1997-01-10 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-10 0:00 FREBOURG Fabrice [this message]
1997-01-11 0:00 ` Mapping between Ada95 (AppletMagic from Intermetrics Inc) and Java Craig E. Ransom
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox