Link to home
Start Free TrialLog in
Avatar of miraShamiera
miraShamiera

asked on

Java in VRML

hello... can u tell me how to make run java successful in vrml?... i have try the example but java still failed call vrml class.. So what the setting should i do... It is about CLASSPATH....

to use both of the language what should i do.....
Avatar of girionis
girionis
Flag of Greece image

Can you tell us the error message?
Avatar of miraShamiera
miraShamiera

ASKER

the error is " java can't define the vrml class.... means java can't import vrml package..... i do not know?....
below the example i have :




*******TonggleScript.java ******
import vrml.*;
import vrml.field.*;
import vrml.node.*;

/*toggle an integer between 0 to 1 every time a time event is received*/

public class TonggleScript extends Script{ // declare clase as public utk interact with vrml package
       SFInt32 which_changed;
       public void intialize (){
            which_changed = (SFInt32) getEventOut ("which_changed");
            which_changed.setValur(0);
      }

      public void processEvent (Event e){
            String name = e.getName();
            if (name.equals("touch")){
                  which_changed.setvalue(1-which_changed.getValue());
            }
      }
}









***************ScriptLogic.java***********************
import vrml.*;
import vrml.field.*;
import vrml.node.*;

/*receives set_b1/2/3 events, when correct combination is received outputs a startTime event*/
//#Latihan dalam buku m/s 273


public class ScriptLogic extends Script{
int b1;
int b2;
int b3;
SFTime startTime;

public void intialize(){
      startTime = (SFTime) getEventOut ("startTime");
}

public void proceesEvent(Event e){ //method dipanggil bila terima event
      String name =e.getName();
      if(name.equals("set_b1")){
            b1=((ConstSFInt32)e.getValue()).getValue();
      }

      else if (name.equals("set_b2")){
            b2=((ConstSFInt32)e.getValue()).getValue();

    }

      else if (name.equals("set_b3")){
            b3=((ConstSFInt32)e.getValue()).getValue();

      }

      if ((b1==1)&&(b2==0)&&(b3==1))
            startTime.setValue(e.getTimeStamp());
    }
}






********************button.wrl****************************
#VRML V2.0 utf8

#Latihan dalam buku m/s 273

PROTO  Button[
      exposedField SFNode      geom NULL
      eventOut SFInt32 state_changed]

      {
            Group {
                  children [
                        DEF      TOS TouchSensor      {}
                        DEF      Toggle Script {
                              eventIn      SFTime touch
                              eventOut SFInt32 which_changed IS state_changed
                              url      ["javascript:
                                  function initialize(){
                                          //initialize to 0th child at load time
                                       which_changed=0;
                                 }

                                 function touch(value,time){
                                       //Toggle the button value
                                       which_changed=!which_changed;
                                 }"

                                 #or java
                                 "TonggleScript.class"]
                           }

                           DEF SW Switch {
                                 whichChoice 0
                                 choice [
                                       Shape {       #choice 0- "off"
                                             geometry      IS geom
                                             appearance DEF A2 Appearance      {
                                                   material      Material {diffuseColor .3 0 0}
                                             }
                                       }

                                       Shape { #choice 1- "on"
                                             geometry      IS  geom
                                             appearance DEF A1 Appearance      {
                                                   material      Material {diffuseColor 1 0 0}
                                             }
                                       }
                                 ]
                           }
                     ]}

                     ROUTE TOS.touchTime  TO Toggle.touch
                     ROUTE Toggle.which_changed TO SW.set_whichChoice
               } #end of Toggle prototype



               #now, create 3 buttons and wire together with a script
               Transform {
                     translation -3 0 0
                     children      DEF      B1 Button {geom      Cone {}}
               }

               DEF B2 Button{geom Sphere {}}
               Transform {
                     translation 3 0 0
                     children      DEF      B3 Button {geom      Cone {}}
               }

               DEF ThreeButtons Script {
                     field SFInt32 b1 0
                     field SFInt32 b2 0
                     field SFInt32 b3 0
                     eventIn SFInt32 set_b1
                     eventIn SFInt32 set_b2
                     eventIn SFInt32 set_b3
                     eventOut      SFTime startTime
                     url ["javascript:
                           function set_b1(value,time){
                                 b1=value;
                                 if((b1==1)&&(b2==0)&&(b3==1)) startTime=time;
                           }

                          function set_b2(value,time){
                                 b2=value;
                                 if((b1==1)&&(b2==0)&&(b3==1)) startTime=time;
                           }

                          function set_b3(value,time){
                                 b3=value;
                                 if((b1==1)&&(b2==0)&&(b3==1)) startTime=time;
                           }"


                     #or java:
                     "ScriptLogic.class"]

               }


               DEF T Transform {
                     children      [
                           Shape {geometry Sphere {radius 0.1}}
                           DEF SI PositionInterpolator {
                                 key [0.0 1.0]
                                 keyValue      [0.01 0.01 0.01,300.0 300.0 300.0]
                           }

                           DEF TS TimeSensor {}
                           NavigationInfo {type      "EXAMINE"}
               ]}

               ROUTE B1.state_changed TO ThreeButtons.set_b1
               ROUTE B2.state_changed TO ThreeButtons.set_b2
               ROUTE B3.state_changed TO ThreeButtons.set_b3
               ROUTE ThreeButtons.startTime      TO TS.startTime
               ROUTE TS.fraction_changed TO      SI.set_fraction
               ROUTE SI.value_changed TO T.set_translation




the programme will success if i use Jscript but when i command the jScript and use the java.class when compile the error msg will appear.... Can u help me... maybe it more about vrml.....

                                



So is the problem solved?
the problem still not working... Can u tell me how can i make the suceesful connection between javaApplet and vrml.... it is use EAI... but how?...

Now i hava contona and cosmoplayer2.0 for the vrml plugin n the IE.... so, what the solution... Please... I don't have enough time.... just about 3 weeks before submit my project....

Really hope
First of all ask a moderator to reopen the question for you. Ask a question for zero points here: http://www.devx.com/getHelpOn/10MinuteSolution/20447 and next time please do not accept an answer if the problem is not solved.

Secondly you didn't tell me the exact error message you are getting.
oooh... i dont know.. So how can i contact the moderator to open my Question?..... Please tell me....

erm......the error is java cannot read/define vrml?....
Can i know where can i see the porogrammer who are know about vrml??????
Doh... Sorry I posted the wrong link above :(

Post a message here: https://www.experts-exchange.com/questions/21100047/Java-experts-please-subscribe.html and Venabili should be able to help you.
Thanks for help.... So, can i know how to solve the problem.... Can i get the step how to make VRML can interact with java(java Applet).....
> So, can i know how to solve the problem....

What is the problem? You still haven't told me.
hi girionis....

 i'm doing my project use vrml and java... The problem is java Class can't define vrml node(when java import.vrml.external.Node)...Before this, i have read article on web said, i must set the ClassPath, but still failed...

The problem is, when i run the java the error will tell me that java fail to define node vrml package... Do you know about EAI?.. or how to make them can know each other.... I also have try many example on web use vrml and javaApplet, the applet failed to load... THats the problem....

Do you know where can i see person expert in VRML-virtual reality modeling language?....

thanks..:)
1) Post the exact error message.
2) Post your current classpath.
3) Post the location of the jar file that has the vrml classes.
1)error msg like this:
[code]
D:\MAKLUMAT PSM\PSM\PSM-vrml\source CODE\cth2-VRML(switch on,off)\ScriptLogic.java:1: package vrml does not exist
import vrml.*;
^
[/code]

2) how to post to my current classpath(i use cortona n jdk1.4.2-05)

3)jar file?... where can i found it....

from the website link :http://www.vruniverse.com/vrdj/article1/tutorial1.html#vrmlbear
tell me that if i want to use vrml and combine with java, i must set the classpath... But until now still not settle the problem... So, all the applet with vrml cannot load....
for more understand my problem is can u visit this website : http://javaboutique.internet.com/Vrml/ there have example use vrml and applet... when i try to my pc, applet failed to load...
The example is .. Vrml.java.... hope can help me...

Thanks
You need to have the VRML package available in your classpath in order for it to compile and work.Where did you find the above code you are trying to compile?
it is vrml package get from the like cortona folder/else...like from this directory-->C:\Program Files\Common Files\ParallelGraphics\Cortona\classes.zip?.....

How to set the CLASSPATH, like java we need jdk right?.. so after we installer jdk1.4.2-05...the jdk will automaticly can run... So, how can set the ClassPath... Must set like this:START-->Run-->sysedit(AUTOEXE)--> set cLASSPAT....... ?.....
I have try, stiill wrong...

i get the source code from VRML book reference....WHY... do you have the other example use vrml+java together?... can u share with me?????....
How do you compile your programme? Try this:

javac -classpath C:\Program Files\Common Files\ParallelGraphics\Cortona\classes.zip <your java file>
i just run the program java using textpad. I do not use command Prompt to run the program.....

i have try but failed.... the error said:
[error msg]
C:\Program Files\Common Files\ParallelGraphics\Cortona\classes>javac TonggleScri
pt
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Common Files\ParallelGraphics\Cortona\classes>java TonggleScrip
t
Registry key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion'
has value '1.3', but '1.4' is required.
Error: could not find java.dll
Error: could not find Java 2 Runtime Environment.
[/error msg]....

so how?....

C:\Program Files\Common Files\ParallelGraphics\Cortona\classes.zip <your java file>.....
--> when i run classes.zip, it can't work... so i unzip the classes.zip.... is it right?.....
There is some conflict between java versions. First thing I suggest you do is to uninstall java and do a fresh install from sratch. This will probably eliminate the "has value '1.3', but '1.4' is required" problem. You can also take a look here: http://forum.java.sun.com/thread.jsp?thread=207173&forum=32&message=706252
for your information, in my drive C: , i have j2sdk1.4.1_03, j2sdk1.4.2_05 and inside JBuilder in my pc also have jdk1.3.1. So, which want i must unInstall then install agains... I will use 1.4.2_05...

While i use Textpad and run the java Classes, it told me that the compile use jdk 1.4.2_05... In control panel also show the plug in java use jdk1.4.2-05....

so.... what should i do?.... i have try do what the step from java forum... but, how to know either it work or not?... :)
 
and when i try run javac : the error msg show -->

[errormsg]
C:\Program Files\Common Files\ParallelGraphics\Cortona\classes\vrml>javac Tonggl
eScript.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
[/errormsg].....

i not unInstall the jdk yet..
Can you tell me the exact location where you installed you jdk 1.4.2_05?
ok... now i unInstall all the jdk.. And i use jdk 1.3.1 which have inside JBuilde6....

my local jdk is : C:\JBuilder6\jdk1.3.1

thats the directory........
OK try this:

javac -classpath C:\Program Files\Common Files\ParallelGraphics\Cortona\classes.zip <your java file>

and tell me if it works.
ops... i 'm try the step... But while i write \classes.zip__> it display winzip .... so, must i unzip the classes.zip first?...
> ops... i 'm try the step... But while i write \classes.zip__> it display winzip .... so, must i unzip the classes.zip first?...

Nope, you shouldn't do. What do you mean it displays winzip? When you try the above line on command line the winzip starts up?
the winzip start up when i write --> C:\Program Files\Common Files\ParallelGraphics\Cortona\classes.zip
There is some settings on the Windows that make it load the winzip as soon as a zip file is inputted. I can't help you on this, it is a Windows issue.
so, must i unzip the classes.zip first?....
You can do that yes. But before you do it, try something else:

C:\JBuilder6\jdk1.3.1\bin\javac -classpath C:\Program Files\Common Files\ParallelGraphics\Cortona\classes.zip <your java file>

and tell me if it works.

i have run a this but the command prompt display :
{
C:\>JBuilder6\jdk1.3.1\bin\javac -classpath C:\Program Files\Common Files\Parall
elGraphics\Cortona\classes.zip TonggleScript.java
javac: invalid argument: Files\Common
Usage: javac <options> <source files>
where possible options include:
  -g                        Generate all debugging info
  -g:none                   Generate no debugging info
  -g:{lines,vars,source}    Generate only some debugging info
  -O                        Optimize; may hinder debugging or enlarge class file

  -nowarn                   Generate no warnings
  -verbose                  Output messages about what the compiler is doing
  -deprecation              Output source locations where deprecated APIs are us
ed
  -classpath <path>         Specify where to find user class files
  -sourcepath <path>        Specify where to find input source files
  -bootclasspath <path>     Override location of bootstrap class files
  -extdirs <dirs>           Override location of installed extensions
  -d <directory>            Specify where to place generated class files
  -encoding <encoding>      Specify character encoding used by source files
  -target <release>         Generate class files for specific VM version
}.......

so?
The problem is porbably the space in the file names (for example Program Files). Can you move the classes.zip file in a folder without spaces and try again? Or maybe do:

C:\>JBuilder6\jdk1.3.1\bin\javac -classpath "C:\Program Files\Common Files\Parall
elGraphics\Cortona\classes.zip" TonggleScript.java
one i error [error]
C:\>JBuilder6\jdk1.3.1\bin\javac -classpath "C:\Program Files\Common Files\Paral
lelGraphics\Cortona\classes.zip" TonggleScript.java
error: cannot read: TonggleScript.java
1 error

[/error]

waits.... i want to know, the TonggleScript.java must put in folder Cortona { C:\Program Files\Common Files\ParallelGraphics\Cortona ----->TonggleScript.java
}      right?

Where do you have the TonggleScript.java? It does not matter where it is as long as we give it the full path.
okey... here i give u the source code......

**************************************************
[vrml code: RandLight.wrl]
#VRML V2.0 utf8

Viewpoint { 0 -1 5 }
NavigationInfo{headlight FALSE}
DEF RandomBulb Directionalight {-1 -1 -1}

Transform{
 children[
       DEF Touch-me TouchSensor{}
       Shape{
         geometry Sphere{}
        }
   ]
  }



  DEF Randomizer Script{
     url"RandLight.class"
     eventIn SFBool click
     eventOut SFFloat brightness
  }

  ROUTE Touch-me.isActive TO Randomizer.click
  ROUTE Randomizer.brightness TO RandomBulb.intensity

[/vrml code: RandLight.wrl]

***********************************************

[code: RandLight.java]
import vrml.*;
import vrml.field.*;
import vrml.node.*;
import java.util.*;


public class RandLight extends Script{

      Random generator = new Random()
      SFFloat brightness;

      public void initialize(){
            brightness=(SFFloat) getEventOut("brightness");
            brightness.getValue(0.0);
      }


      public void processEvent(Event ev){
          if(ev.getName().equals("click")){
          ConstSFBool value = (ConstSFBool) ev.getValue()
          if ((value.getValue()==false){
            brightness.setValue(generator.nextFloat()):

           }

         }

      }
  }

[/code: RandLight.java]
*************************************************

the souce code (java n wrl) i put in folder "vrmlEai".. so the directory/path is ----C:\Program Files\Common Files\ParallelGraphics\Cortona\vrmEai



Try this:

C:\>JBuilder6\jdk1.3.1\bin\javac -classpath "C:\Program Files\Common Files\Parall
elGraphics\Cortona\classes.zip" C:\Program Files\Common Files\ParallelGraphics\Cortona\vrmEai\TonggleScript.java

although spaces might cause problem again. If they do try to put the whole path to the java file into double quotes:

C:\>JBuilder6\jdk1.3.1\bin\javac -classpath "C:\Program Files\Common Files\Parall
elGraphics\Cortona\classes.zip" "C:\Program Files\Common Files\ParallelGraphics\Cortona\vrmEai\TonggleScript.java"
can u run the programme on your pc?... i still have the problem.....
The sorce code sabove i give are the new project between Randlight.wrl and Randlight.java.... i want the vrml can display and intect with url. Randlight.class...

Thats the problem...
When i run the Randlight.java in textpad (compile-many error and focusly at vrml node...)

PLEASE.......
I cannot run it since I need the vrml classes. Does the programme compile fine? I see you are using a different file now.
the programme compile still not working.....
Now i use different file, because it just 2file only-1.wrl n1.java.....

I don't know how to run java n vrml, until now still have problem... Do you have cortona?... can u run it for me.. look either get the programme run successful?
RandLight.java.......................................

import vrml.*;
import vrml.field.*;
import vrml.node.*;
import java.util.*;


public class RandLight extends Script{

      Random generator = new Random()
      SFFloat brightness;

      public void initialize(){
            brightness=(SFFloat) getEventOut("brightness");
            brightness.getValue(0.0);
      }


      public void processEvent(Event ev){
          if(ev.getName().equals("click")){
          ConstSFBool value = (ConstSFBool) ev.getValue()
          if ((value.getValue()==false){
            brightness.setValue(generator.nextFloat()):

           }

         }

      }
  }
**************************************************

RandLight.wrl..........................

#VRML V2.0 utf8

Viewpoint {position 0 -1 5 }
NavigationInfo{headlight FALSE}
DEF RandomBulb DirectionalLight {-1 -1 -1}

Transform{
 children[
       DEF Touch-me TouchSensor{}
       Shape{
         geometry Sphere{}
        }
   ]
  }



  DEF Randomizer Script{
     url"RandLight.class"
     eventIn SFBool click
     eventOut SFFloat brightness
  }

  ROUTE Touch-me.isActive TO Randomizer.click
  ROUTE Randomizer.brightness TO RandomBulb.intensity
> the programme compile still not working.....

How exactly is not working?
applet can't read vrml package...
Why not? Do you get any error messages?
okey.. lets me explain....

follow the example above, there have 2 codeone in java n another in vrml)... Both of them, use together when i run the programme...
When i run the file .*wrl (it have error) and when i run the java use textpad( run) it also get the error...

So, what must i do... Do you know how to run vrml file which use other support language like java... Please.. It is URGENT...
girionis....

 can u visit to this link :
http://tecfa.unige.ch/guides/vrml/examples/eai/tiny3D-2/tiny3D-2.html
..... maybe it can help you about my problem.... PLEASE....

the problem is java not load also vrml fail not display..
It cannot find the Tiny3D class, that's why it fails. Can you run the applet in the appletviewer?
i also can run the applet...So, do u know how can i solve my problem with vrml and java.. Please?... i don't enough time... My due project just around the corner. But i still face problem to connection between java n vrml?..

 Do u have friend who know about vrml?... Please
The console says that it cannot find the Tiny3D class, that's why it's failing.

> i also can run the applet...

Do you mean that you can run the applet in the appletviewer witout problems?
the applet viewer is appear but, when i push the button like sphere/ cube... nothing happen?... so...Do u get the same situation?....

in that website, there have Tiny3D class.. but it still have problem..
> Do u get the same situation?....

No, I cannot even see the button. Do you get any error messages?
Okey, just left it behind... Do you know how to make applet can read vrml node( classes).. base on my example Randlight code above... Please??>>
No, sorry I have never used VRML. MAybe this link will help you: http://dlp.cs.vu.nl/~ctv/vrml/ it has tutorials on Java and VRML.
so... can u introduce i to somebody who can help me.... plzzzzzzzzzzzzzz
Now I get a different error: java.lang.NoClassDefFoundError: vrml/external/exception/InvalidEventInException it is a problem with the classpath, it is missing soem files. You have to include all files in the applet archive in order for it to work.
but how.... i need someone who know how to set Classpath....

Please, .......
do you know how to make java n vrml can work together?... Please....URGENT!!!!!!!!!!!!!!!!!!.....

i really need your help or others..  
try look at this link :
http://javaboutique.internet.com/Vrml/

this are the example which use java n vrml....
also look at this link :http://www.frontiernet.net/~imaging/games_with_java3d.html

i want to do like this in my project
The first thing you have to do is to be able to run your applet, otherwise you can't go further. I tried to run it again and I got the following error:

java.lang.NoClassDefFoundError: vrml/external/exception/InvalidEventInException

which means that it cannot find the InvalidEventInException class, which is part of the VRML package. You have to tell the plugin how to load this class and this can be done by putting it in the "archive" attribute of the applet tag. Take a look at the following link for help on how to do it:

http://java.sun.com/docs/books/tutorial/applet/
http://java.sun.com/docs/books/tutorial/applet/appletsonly/html.html

Also let me know the name of the vrml jar file and the location you have it. The applet tag should look like:

<applet code="Tiny3D.class" ARCHIVE="<your vrml jar fiel here>" width ="600" height="300">
</applet>

i use jdk 1.3.1 n the directory is : C:\jdk1.3.1.....
Okey, so the example file i save at

and vrml browser is cortona and it location in :
C:\Program Files\Common Files\ParallelGraphics\Cortona--(inside of the cortona folder there have classes.zip and corteai.zip....

So, how to make the TINY3D can run?... please..

the jar file have in C:\jdk1.3.1\bin\jar.... so?...

what must i do?...
in html code there is code like this :

<html>
<head>
<title>Tiny3D!</title>
</head>

<center>
<embed src="root.wrl" border=0 height="250" width="600">
</center>

<applet code="Tiny3D.class" mayscript>
</applet>

</html>
when i run the applet, it still have  error msg like this :

[error msg]:
java.lang.NoClassDefFoundError: com/ms/activeX/ActiveXControl
<applet code="Tiny3D.class" ARCHIVE="<your vrml jar fiel here>" width ="600" height="300">
</applet>

where can i get the vrml jar?
> the jar file have in C:\jdk1.3.1\bin\jar.... so?...

You should have it in the same folder you have your applet, i.e. where you have your Tiny3D class.

>when i run the applet, it still have  error msg like this :
>
>[error msg]:
>java.lang.NoClassDefFoundError: com/ms/activeX/ActiveXControl

Are you using any ms classes? Make sure they are also included in the archive attribute.

> where can i get the vrml jar?

You should already have it otherwise you wouldn't be able to compile it. You now need to add it in your archive attribute.
>You should already have it otherwise you wouldn't be able to compile it. You now need to add it in your archive attribute

but how to create it... i have read some example and they not use .jar file but the programme still work...


>[error msg]:
>java.lang.NoClassDefFoundError: com/ms/activeX/ActiveXControl
 i still get this error msg..
Are you using microsoft's jvm?
i use jdk 1.4 n there just have run environment... What is jvm?... i have listen about it and do not know what n how to use n where can i found it...
jvm is the java virtual machine. Are you trying to use COM objects or ActiveX in your Java programme?
COM
You need the jar file that has the ActiveXControl class and put it in your classpath.
but how?... i do know?.. please tell me..
Just include it as well in the "archive" tag of the applet, like you did with the vrml jar file.
i did not have any jar file.. i just have applet.class(java) n vrml file (wrl)....

So, how can i get jar file..means i must code in programming to make the jar file?...
what do you means... how to make the jar file...
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
actually, i do not use jar file in my code... can ?
can i know... do you know about algorithm shortest path?.. Dijkstra?... can u tell me ////
i still face the problem when i want to use EAI :
java.lang.NoClassDefFoundError: com/ms/activeX/ActiveXControl
hello... how to read the pass value from "return" function from different classes.....
>  actually, i do not use jar file in my code... can ?

You use classes of the jar in your code.

>  can i know... do you know about algorithm shortest path?.. Dijkstra?... can u tell me ////

That's a completely new question and better ask a new one.

> i still face the problem when i want to use EAI :
>java.lang.NoClassDefFoundError: com/ms/activeX/ActiveXControl

As I already said before, add the ajr fiel that contains the ActiveXControl class in your "archive" attribute of your <appelt> tag.

i'm not use any jar file... i just use java applet n vrml plugin( cortona)... can u help me... right now,
What is your classpath?

jdk1.3.1 n i use cortona... that is my classpath
Can you post it here?
ermmm.... try this source code n can u help me how to pass the value when i click button "generate vrml" ?.. to other class

[code]

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;


/********************************************************************
                                          class DijkstraMia
 ********************************************************************/



public class DijkstraMia extends java.applet.Applet implements ActionListener

{
      Label blok1;
      Label blok2;
      Label blok3;
      Label blok4;
      Label blok5;
      Label blok6;
      Label blok7;

      Button vrml;

/********************************************************************
                                          void init()
 ********************************************************************/
  //initializes the layout
  public void init() {
        setLayout(new BorderLayout(0,0));
        setSize(800,310);//saiz window applet
      setBackground(Color.gray);

      //for (int i = 0; i<8; i++)
      for (int i = 0; i<29; i++)
         balls[i]=0;

      //for (int i=0; i<10; i++)
      for (int i=0; i<33; i++)
         lines[i]=0;
      count = 0;
      first =0;
      second = 0;
      step = 0;

      blok1=new Label("Radioterapi");
        blok1.setBounds(360, 200, 60, 15); //blok1


        blok2=new Label("Wad Bersalin");
        blok2.setBounds(220, 230, 80, 15); //blok2

        blok3=new Label("Kaji Saraf");
        blok3.setBounds(230, 180, 60, 15); //blok3

        blok4=new Label("Wad Kecemasan");
        blok4.setBounds(200,65, 100, 15); //blok4

        blok5=new Label("Urologi");
        blok5.setBounds(360,40, 60, 15); //blok5

        blok6=new Label("Perkhidmatan Darah");
        blok6.setBounds(200,20, 120, 15); //blok6

        blok7=new Label("UKM");
        blok7.setBounds(100,200, 60, 15); //blok7

       vrml=new Button("Generate VRML");
         vrml.setBounds(500, 200, 100, 30);
         //add(vrml);
         vrml.addActionListener(this);




   }//end init()



/********************************************************************
                        public void actionPerformed(ActionEvent e)
 ********************************************************************/



public void actionPerformed(ActionEvent e){ //call dr "addActionListener"
               /* if(e.getSource() == go){
                    finder.findPath(map);
                }*/

              }  //end of actionPerformed








/********************************************************************
                              boolean handleEvent(Event evt)
 ********************************************************************/
   //handles events
  public boolean handleEvent(Event evt)   {
      if (evt.id == Event.WINDOW_DESTROY) System.exit(0);
      return super.handleEvent(evt);

   }



/********************************************************************
                      boolean mouseDown(Event evt, int x, int y)
 ********************************************************************/
  //for mouse clicks

 public boolean mouseDown(Event evt, int x, int y) {
       if (count == 0) {   //count=0,    pilihan utk tekan bola mana nak pilih

       /* if(400 < x && x < 420 && 280 < y && y < 300)  { s0: titik start
            if(count == 0)
               first = 1;
            else if (count == 1)
               second = 1;
            count++;
            repaint();
            return true;
         }*/


       if( 380 < x && x < 400 && 220 < y && y < 240)  { //b1
            if(count == 0)
               first = 2;
            else if (count == 1)
               second = 2;
            count++;
            repaint();
            System.out.println("blok1 telah dipilih");
            return true;
         }


         else if(280 < x && x < 300 && 250 < y && y < 300){ //b2
            if(count == 0)
               first = 3;
            else if (count == 1)
               second = 3;
            count++;
            repaint();
            System.out.println("blok2 telah dipilih");
            return true;
         }


         else if(280 < x && x < 300 && 200 < y && y < 220){ //b3
            if(count == 0)
               first = 4;
            else if (count == 1)
               second = 4;
            count++;
            repaint();
            System.out.println("blok3 telah dipilih");
            return true;
         }

         else if(250 < x && x < 270 && 80 < y && y < 100){ //b4
            if(count == 0)
               first = 5;
            else if (count == 1)
               second = 5;
            count++;
            repaint();
            System.out.println("blok4 telah dipilih");
            return true;
         }
         else if(370 < x && x < 390 && 60 < y && y < 80){ //b5
            if(count == 0)
               first = 6;
            else if (count == 1)
               second = 6;
            count++;
            repaint();
            System.out.println("blok5 telah dipilih");
            return true;
         }
         else if(210 < x && x < 230 && 40< y && y < 60){ //b6
            if(count == 0)
               first = 7;
            else if (count == 1)
               second = 7;
            count++;
            repaint();
            System.out.println("blok6 telah dipilih");
            return true;
         }

         else if(100 < x && x < 120 && 230 < y && y < 250){ //b7
              if(count == 0)
                 first = 8;
              else if (count == 1)
                 second = 8;
              count++;
              repaint();
              System.out.println("blok7 telah dipilih");
              return true;
              }


         /*else if(125 < x && x < 145 && 75 < y && y < 95)  {
            if(count == 0)
               first = 8;
            else if (count == 1)
               second = 8;
            count++;
            repaint();
            return true;
         }
         */
      }// end of (if count==0)


      if (count == 3) {//count=3,pilihan utk reset
          if(500 < x && x < 800 && 0 < y && y < 15 ||
             500 < x && x < 800 && 60 < y && y < 75 )  {
            init();
            repaint();
            return true;
         }
      }
      else {
         if(500 < x && x < 800 && 0 < y && y < 15)  {
            init();
            repaint();
            return true;
         }
         else if(500 < x && x < 800 && 60 < y && y < 75)  {
            step=1;
            count=3;
            repaint();
            return true;
         }
      }

      return true;

   }// end of mouseDown(Event evt, int x, int y)





/********************************************************************
                          public void paint( Graphics g )
 ********************************************************************/


   public void paint( Graphics g )
   {
      add(vrml);
      g.setColor(Color.lightGray);
      g.fillRect(500, 0, 300, 310); // draw text box on the right
      g.setFont(new Font("Times Roman", Font.BOLD, 13));
      g.setColor(Color.blue);     // draw text on the right "RESET"
      g.drawString("Reset", 522, 15);

      g.setColor(Color.black);
      if(count == 0) {

         g.drawString("**********************************************************", 505, 60);
         g.drawString("klik pada lokasi yang hendak dituju", 505, 70);
         //g.drawString("point and", 505, 45);
        // g.drawString("I will find", 505, 60);
         //g.drawString("the path", 505, 75);
         //g.drawString("closest to", 505, 90);
         //g.drawString("the blue point", 505, 105);
      }
      else if (count == 3) {
         g.drawString("click", 522, 60);
         g.drawString("to reset", 515, 90);
         g.drawString("the area", 515, 105);
         g.setColor(Color.blue);
         g.drawString("here", 525, 75);
      }
      else {
         g.drawString("click", 522, 60);
         g.drawString("to see the", 511, 90);
         g.drawString("shortest path", 506, 105);
         g.setColor(Color.blue);
         g.drawString("here", 525, 75);
      }

      g.setColor(Color.lightGray);    //warna utk line
      //utk menunjukkan laluan yang ada
      g.drawLine(425, 285, 325,285);  //line s0&s1            0
      g.drawLine(325, 285, 325, 255); //line s1&s9            1
      g.drawLine(325, 255, 325, 225); //line s9&s11            2
      g.drawLine(325, 225, 395, 225); //line s11&b1            3
      g.drawLine(325, 255, 285, 255); //line s9&b2            4
     g.drawLine(325, 255, 325, 205); //line s11&s13      5
     g.drawLine(325, 205, 285, 205); //line s13&b3            6
        g.drawLine(325, 205, 325,  85); //line s13&s15      7
        g.drawLine(325,  85, 295,  85); //line s15&s20      8
        g.drawLine(295,  85, 255,  85); //line s20&b4            9
        g.drawLine(325,  85, 325,  65); //line s15&s18      10
        g.drawLine(325,  65, 375,  65); //line s18&b5            11
           g.drawLine(325,  65, 325,  45); //line s18&s17      12
      g.drawLine(325,  45, 295,  45); //line s17&s19      13
        g.drawLine(295,  45, 215,  45); //line s19&b6            14
        g.drawLine(325, 285, 185, 285); //line s1&s2            15
        g.drawLine(185, 285, 185, 255); //line s2&s10            16
        g.drawLine(185, 255, 185, 235); //line s10&s12      17
        g.drawLine(185, 235, 105, 235); //line s12&b7            18
        g.drawLine(185, 285,   5, 285); //line s2&s3            19
        g.drawLine(  5, 285,   5, 235); //line s3&s4            20
        g.drawLine(  5, 235,   5,   5); //line s4&s5            21
        g.drawLine(  5,   5, 425,   5); //line s5&s8            22
      g.drawLine(425,   5, 425, 285); //line s8&s0            23
        g.drawLine(325,  45, 325,   5); //line s17&s7            24
      g.drawLine(295,  85, 325,  45); //line s20&s17      25
      g.drawLine(255,  85, 185,  85); //line b4&s16            26
        g.drawLine(215,  45, 185,  45); //line b6&s21            27
        g.drawLine(285,  205, 185,205); //line b3&s14            28
        g.drawLine(285,  255, 185,255); //line b2&s10            29
        g.drawLine(185,  205, 185,235); //line s14&s12      30
        g.drawLine(185,  205, 185,  5); //line s14&s6            31
        g.drawLine(105,  235,   5,235); //line b7&s4            32

      if (step == 1) {//step mula
         g.setColor(Color.green);

      //sambungan utk setiap blok(b) utk digenerate laluan
      if(first == 2){  //b1
        g.drawLine(325, 225, 395, 225); //line s11&b1            3
        g.drawLine(325, 255, 325, 225); //line s9&s11            2
        g.drawLine(325, 285, 325, 255); //line s1&s9            1
        g.drawLine(425, 285, 325, 285); //line s0&s1            0
        }

      else if(first == 3){ //b2
            g.drawLine(325, 255, 285, 255); //line s9&b2            4
            g.drawLine(325, 285, 325, 255); //line s1&s9            1
        g.drawLine(425, 285, 325, 285); //line s0&s1            0
            }

         else if(first == 4){ //b3
            g.drawLine(325, 205, 285, 205); //line s13&b3            6
            g.drawLine(325, 255, 325, 205); //line s11&s13            5
              g.drawLine(325, 255, 325, 225); //line s9&s11            2
            g.drawLine(325, 285, 325, 255); //line s1&s9            1
        g.drawLine(425, 285, 325, 285); //line s0&s1            0
            }

        else if(first == 5){ //b4
            g.drawLine(295,  85, 255,  85); //line s20&b4            9
            g.drawLine(325,  85, 295,  85); //line s15&s20            8
            g.drawLine(325, 205, 325,  85); //line s13&s15            7
            g.drawLine(325, 255, 325, 205); //line s11&s13            5
            g.drawLine(325, 255, 325, 225); //line s9&s11            2
            g.drawLine(325, 285, 325, 255); //line s1&s9            1
          g.drawLine(425, 285, 325, 285); //line s0&s1            0
            }

       else if(first == 6){ //b5
            g.drawLine(325,  65, 375,  65); //line s18&b5            11
            g.drawLine(325,  85, 325,  65); //line s15&s18            10
            g.drawLine(325, 205, 325,  85); //line s13&s15            7
            g.drawLine(325, 255, 325, 205); //line s11&s13            5
            g.drawLine(325, 255, 325, 225); //line s9&s11            2
            g.drawLine(325, 285, 325, 255); //line s1&s9            1
          g.drawLine(425, 285, 325, 285); //line s0&s1            0
            }

      else if(first == 7){ //b6
            g.drawLine(295,  45, 215,  45); //line s19&b6            14
            g.drawLine(325,  45, 295,  45); //line s17&s19            13
            g.drawLine(325,  65, 325,  45); //line s18&s17            12
            g.drawLine(325,  85, 325,  65); //line s15&s18            10
            g.drawLine(325, 205, 325,  85); //line s13&s15            7
            g.drawLine(325, 255, 325, 205); //line s11&s13            5
            g.drawLine(325, 255, 325, 225); //line s9&s11            2
            g.drawLine(325, 285, 325, 255); //line s1&s9            1
          g.drawLine(425, 285, 325, 285); //line s0&s1            0
            }

      else if(first == 8){ //b7
            g.drawLine(185, 235, 105, 235); //line s12&b7            18
            g.drawLine(185, 255, 185, 235); //line s10&s12            17
            g.drawLine(185, 285, 185, 255); //line s2&s10            16
            g.drawLine(325, 285, 185, 285); //line s1&s2            15
          g.drawLine(425, 285, 325, 285); //line s0&s1            0
            }

   //utk simpang

      /*else if(first == 11) //s3
            g.drawLine(185, 285,   5, 285); //line s2&s3            19

      else if(first == 12) //s4
             g.drawLine(  5, 285,   5, 235); //line s3&s4            20

      else if(first == 13) //s5
            g.drawLine(  5, 235,   5,   5); //line s4&s5            21

      else if(first == 16) //s8
            g.drawLine(  5,   5, 425,   5); //line s5&s8            22

      else if(first == 1) //s0
            g.drawLine(425,   5, 425, 285); //line s8&s0            23

      else if(first == 15) //s7
            g.drawLine(325,  45, 325,   5); //line s17&s7            24

      else if(first == 25) //s17
            g.drawLine(295,  85, 325,  45); //line s20&s17            25

      else if(first == 24) //s16
            g.drawLine(255,  85, 185,  85); //line b4&s16            26


      else if(first == 29) //s21
            g.drawLine(215,  45, 185,  45); //line b6&s21            27


      else if(first == 22) //s14
            g.drawLine(285,  205, 185,205); //line b3&s14            28

      else if(first == 18) //s10
            g.drawLine(285,  255, 185,255); //line b2&s10            29


      else if(first == 20) //s12
            g.drawLine(185,  205, 185,235); //line s14&s12            30


      else if(first == 14) //s6
             g.drawLine(185,  205, 185,  5); //line s14&s6            31*/




     }//end step mula






/********************************************************************
                                    //draw the points
 ********************************************************************/

//[simpang=21 & bangunan=7 &starnode,s0=1]==29points

 /*  |s5------------------|s6|--------------|s7|----------|s8|
        |                                |
        |                                |
        |                                |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        |
        s4
        |
        |
        |
        |
        |s3-----------------|s2|--------------|s1|----------|s0|

                    LALUAN HOSPITAL SECARA RINGKAS       */

//draw the points == point utk bangunan

      if(first == 1 || second == 1)
         g.setColor(Color.blue);
      else
         g.setColor(Color.blue);
         g.fillOval(420, 280, 20, 20); //s0

    if(first == 2 || second == 2)
          g.setColor(Color.pink);
         else
           g.setColor(Color.black);
           g.fillOval(380, 220, 20, 20);  //b1
             add(blok1);



      if(first == 3 || second == 3)
           g.setColor(Color.pink);
         else
           g.setColor(Color.black);
           g.fillOval(280, 250, 20, 20);  //b2
           add(blok2);


      if(first == 4 || second == 4)
           g.setColor(Color.pink);
         else
           g.setColor(Color.black);
           g.fillOval(280, 200, 20, 20);  //b3
           add(blok3);

      if(first == 5 || second == 5)
             g.setColor(Color.pink);
         else
             g.setColor(Color.black);
           g.fillOval(250,80, 20, 20);  //b4
           add(blok4);

      if(first == 6 || second == 6)
             g.setColor(Color.pink);
         else
             g.setColor(Color.black);
           g.fillOval(370,60, 20, 20);  //b5
            add(blok5);

      if(first == 7 || second == 7)
             g.setColor(Color.pink);
         else
             g.setColor(Color.black);
           g.fillOval(210,40, 20, 20);  //b6
           add(blok6);

      if(first == 8 || second == 8)
             g.setColor(Color.pink);
         else
             g.setColor(Color.black);
           g.fillOval(100,230, 20, 20); //b7
           add(blok7);

//point utk simpang(sn): s1-s21

      if(first == 9 || second == 9)
             g.setColor(Color.white);
         else
             g.setColor(Color.white);
           g.fillOval(320,280, 10, 10);  //s1

      if(first == 10 || second == 10)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
           g.fillOval(180,280, 10, 10);  //s2

      if(first == 11 || second == 11)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
           g.fillOval(0,280, 10, 10);  //s3


      if(first == 12 || second == 12)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
           g.fillOval(0,230, 10, 10);  //s4

      if(first == 13 || second == 13)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
           g.fillOval(0,0, 10, 10);   //s5

      if(first == 14 || second == 14)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
           g.fillOval(180,0, 10, 10);  //s6

      if(first == 15 || second == 15)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
           g.fillOval(320,0, 10, 10);  //s7

      if(first == 16 || second == 16)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
             g.fillOval(420,0, 10, 10);  //s8

      if(first == 17 || second == 17)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
             g.fillOval(320,250,10, 10);  //s9

      if(first == 18 || second == 18)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
             g.fillOval(180,250,10, 10);  //s10


       if(first == 19 || second == 19)
              g.setColor(Color.white);
             else
              g.setColor(Color.white);
              g.fillOval(320,220,10, 10);  //s11

       if(first == 20 || second == 20)
               g.setColor(Color.white);
              else
               g.setColor(Color.white);
               g.fillOval(180,230,10, 10);  //s12

        if(first == 21 || second == 21)
           g.setColor(Color.white);
          else
           g.setColor(Color.white);
               g.fillOval(320,200,10, 10);  //s13


      if(first == 22 || second == 22)
           g.setColor(Color.white);
          else
           g.setColor(Color.white);
               g.fillOval(180,200,10, 10);  //s14

       if(first == 23|| second == 23)
           g.setColor(Color.white);
          else
           g.setColor(Color.white);
               g.fillOval(320,80,10, 10);  //s15

        if(first == 24 || second == 24)
           g.setColor(Color.white);
          else
           g.setColor(Color.white);
               g.fillOval(180,80,10, 10);  //s16


      if(first == 25 || second == 25)
           g.setColor(Color.white);
          else
           g.setColor(Color.white);
               g.fillOval(320,40,10, 10);  //s17

        if(first == 26 || second == 26)
             g.setColor(Color.white);
            else
             g.setColor(Color.white);
               g.fillOval(320,60,10, 10);  //s18

        if(first == 27 || second == 27)
           g.setColor(Color.white);
         else
           g.setColor(Color.white);
               g.fillOval(290,40,10, 10);  //s19

        if(first == 28 || second == 28)
           g.setColor(Color.white);
         else
           g.setColor(Color.white);
               g.fillOval(290,80,10, 10);  //s20

        if(first == 29 || second == 29)
                 g.setColor(Color.white);
               else
                 g.setColor(Color.white);
               g.fillOval(180,40,10, 10);  //s21


}//end of void paint( Graphics g )

private int balls[] = new int [29]; //bilangan bola
private int lines[] = new int [33];//bilangan line yg ada
private int chosen = 0, count, first, second, step;

}// end of applet
[/code]
I think the original problem is solved. I suggest we keep EE uncluttered and have one question for each problem. Mixing several questions under one is not much of a help to othre peopel who will be looking at the question.
ok...but can u run the java source code?..
the source code i give is what the topic are... hopefully u will help me... please
:)

I will see what I can do.
ooP!!! do u want to help me in that source code?... i really hope it but i just close this section... because i want to post another question.. so, can i still post to u, using this topic?..
It's ok I found the link to your other question :)
but.. u can help me i'm too happy..

can u get the output for that source code?