Can I show JFrame/Frame by using Java Scripting 
Author Message
 Can I show JFrame/Frame by using Java Scripting

Hi! Everyone. I would like to know that whether it is possible or not to
show a Frame or JFrame by using Java Scripting in VRML. I guess this should
work but I tried this for many times and it's unable to create a frame.

Many thanks.

Raymond



Tue, 07 Oct 2003 09:11:25 GMT  
 Can I show JFrame/Frame by using Java Scripting

Quote:
> Hi! Everyone. I would like to know that whether it is possible or not to
> show a Frame or JFrame by using Java Scripting in VRML. I guess this
should
> work but I tried this for many times and it's unable to create a frame.

you cannot show visible components via the JSAI (Java Script Authoring
Interface, Java classes linked to Script nodes). but you can via the EAI
(External Authoring Interface, allows interaction between a Java applet and
a vrml scene embedded with in the same HTML page). other ppl in the
newsgroup will have more info on the EAI if you want to go that way.
db


Tue, 07 Oct 2003 08:54:50 GMT  
 Can I show JFrame/Frame by using Java Scripting

You extend the event handling class from script in which you declare another
class extended from frame (but I dont think jframe will work). Then, responding
to let say a touchtime from a touchsensor, you call the other class show()
method.

This from a sample in java for 3d and vrml book (old but useful):

import vrml.*;
import vrml.node.*;
import vrml.field.*;

import java.util.*;

public class OpenSesame extends Script {
   OpenDialog myDialog;  // This is the other class you extend from frame
   SFTime startTime = null;
   Date date = null;

   public void initialize(){
      myDialog = new OpenDialog(this);
      startTime = (SFTime)getEventOut("startTime");
      date = new Date();
   }

   public void processEvent(Event ev){ //maybe you'll have to qualifie
vrml.Event here
      if(ev.getName().equals("entered")){
         ConstSFBool v = (ConstSFBool)ev.getValue();
         if(v.getValue()){
            myDialog.show();
         } else {
            myDialog.hide();
         }
      }
   }

   public void openDoor(){
      startTime.setValue((double)((date.getTime()/1000.0)+1.0));
   }

Quote:
}

I could even get a FileDialog that way...

Sylvain Carette
VRML designer-composer

Quote:

> Hi! Everyone. I would like to know that whether it is possible or not to
> show a Frame or JFrame by using Java Scripting in VRML. I guess this should
> work but I tried this for many times and it's unable to create a frame.

> Many thanks.

> Raymond



Tue, 07 Oct 2003 16:23:33 GMT  
 Can I show JFrame/Frame by using Java Scripting
Yes you can and in fact its lot more powerful than EAI since you are not
limited (crippled) by extending from applet which dont let do nothing..... You
can start remote connection, open file dialog, display panel, throw virus,
etc...

Sylvain Carette
VRML designer-composer

Quote:

> > Hi! Everyone. I would like to know that whether it is possible or not to
> > show a Frame or JFrame by using Java Scripting in VRML. I guess this
> should
> > work but I tried this for many times and it's unable to create a frame.

> you cannot show visible components via the JSAI (Java Script Authoring
> Interface, Java classes linked to Script nodes). but you can via the EAI
> (External Authoring Interface, allows interaction between a Java applet and
> a VRML scene embedded with in the same HTML page). other ppl in the
> newsgroup will have more info on the EAI if you want to go that way.
> db



Tue, 07 Oct 2003 16:31:11 GMT  
 Can I show JFrame/Frame by using Java Scripting
oops...
db


Tue, 07 Oct 2003 18:58:25 GMT  
 Can I show JFrame/Frame by using Java Scripting

Thanks Sylvain, could you find any examples that they are practically work on the net.

My lecturer has done a very simple JSAI but the Frame does not shown on my screen.
http://www.cs.bham.ac.uk/courses/SEM334/VRLectures2001/index1.htm

If you could show me the reason that JSAI doesnt work, I would be greatly appreciated.

Cheers,

Raymond


You extend the event handling class from script in which you declare another class extended from frame (but I dont think jframe will work). Then, responding to let say a touchtime from a touchsensor, you call the other class show() method.
This from a sample in java for 3d and vrml book (old but useful):
import vrml.*;
import vrml.node.*;
import vrml.field.*;
import java.util.*;
public class OpenSesame extends Script {
   OpenDialog myDialog;  // This is the other class you extend from frame
   SFTime startTime = null;
   Date date = null;
   public void initialize(){
      myDialog = new OpenDialog(this);
      startTime = (SFTime)getEventOut("startTime");
      date = new Date();
   }
   public void processEvent(Event ev){ //maybe you'll have to qualifie vrml.Event here
      if(ev.getName().equals("entered")){
         ConstSFBool v = (ConstSFBool)ev.getValue();
         if(v.getValue()){
            myDialog.show();
         } else {
            myDialog.hide();
         }
      }
   }
   public void openDoor(){
      startTime.setValue((double)((date.getTime()/1000.0)+1.0));
   }

Quote:
}

I could even get a FileDialog that way...
Sylvain Carette
VRML designer-composer
Hi! Everyone. I would like to know that whether it is possible or not to
show a Frame or JFrame by using Java Scripting in VRML. I guess this should
work but I tried this for many times and it's unable to create a frame.
Many thanks.
Raymond


Wed, 08 Oct 2003 21:29:06 GMT  
 Can I show JFrame/Frame by using Java Scripting

You didnt send specific link to the problem.
Actually, there is *many* thing that can cause jsai to not work. I
noticed on the link you send reference to VBScript which would mean
reference to Internet Explorer; this can be a cause. IE doesnt have same
security scheme. So first is to run on netscape/cosmo, then try first a
basic example - kind of "hello frame", then add more functionnality.
JSAI not very stable - as well as EAI - so we enter wizardery world when
dealing with java with vrml. So first put most chance on your side and
use netscape, it have a more "standard" behavior thus more chance
somebody can help. If you really cant make it work I can send small
example I know that work.

Sylvain Carette
VRML designer-composer

Quote:

> Thanks Sylvain, could you find any examples that they are practically
> work on the net.

> My lecturer has done a very simple JSAI but the Frame does not shown
> on my screen.
> http://www.cs.bham.ac.uk/courses/SEM334/VRLectures2001/index1.htm

> If you could show me the reason that JSAI doesnt work, I would be
> greatly appreciated.

> Cheers,

> Raymond



> You extend the event handling class from script in which you declare
> another class extended from frame (but I dont think jframe will work).
> Then, responding to let say a touchtime from a touchsensor, you call
> the other class show() method.
> This from a sample in java for 3d and vrml book (old but useful):
> import vrml.*;
> import vrml.node.*;
> import vrml.field.*;
> import java.util.*;
> public class OpenSesame extends Script {
>    OpenDialog myDialog;  // This is the other class you extend from
> frame
>    SFTime startTime = null;
>    Date date = null;
>    public void initialize(){
>       myDialog = new OpenDialog(this);
>       startTime = (SFTime)getEventOut("startTime");
>       date = new Date();
>    }
>    public void processEvent(Event ev){ //maybe you'll have to qualifie
> vrml.Event here
>       if(ev.getName().equals("entered")){
>          ConstSFBool v = (ConstSFBool)ev.getValue();
>          if(v.getValue()){
>             myDialog.show();
>          } else {
>             myDialog.hide();
>          }
>       }
>    }
>    public void openDoor(){
>       startTime.setValue((double)((date.getTime()/1000.0)+1.0));
>    }
> }
> I could even get a FileDialog that way...
> Sylvain Carette
> VRML designer-composer

> Hi! Everyone. I would like to know that whether it is possible or not
> to
> show a Frame or JFrame by using Java Scripting in VRML. I guess this
> should
> work but I tried this for many times and it's unable to create a
> frame.
> Many thanks.
> Raymond



Sat, 11 Oct 2003 12:29:32 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Java in frame can't get instance of Java EAI + VRML in another frame

2. Using CGI module with 'canned queries'

3. Question about a script node using JAVA

4. Help Needed : Using native methods in Java Script Nodes in Netscape 4.0/Cosmo 2.0

5. Using Java as a script

6. possible to show/hide frames???

7. Mixing Java EAI stuff with Java in Script nodes

8. VRML generated from JAVA, not JAVA script?

9. Fwd: Request for suggestions re: Java or Java Script

10. pop up java frame

11. External Java with frames and CosmoPlayer?

12. Perl script to show dependencies

 

 
Powered by phpBB® Forum Software