NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => misc => Topic started by: Fu-Kwun Hwang on October 07, 2006, 01:33:59 pm



Title: function plot
Post by: Fu-Kwun Hwang on October 07, 2006, 01:33:59 pm
You can use this applet to draw y(x) or x(t),y(t) function plot
-*-


Title: Re: function plot
Post by: lookang on September 03, 2007, 11:14:42 pm
can enable the load ejs applet xml file ?

i trying to learn how to make a quadratic equation  ;D

thanks


Title: Re: function plot
Post by: Fu-Kwun Hwang on September 05, 2007, 12:17:38 am
Sorry! I forgot to upload the xml file. It is done. You should be able to load it now.
I am working on another EJS web  interface so that it will be easy to read the EJS source (without loading the java and show similar interface). May be add editable function later on. It is a work in progress.


Title: Re: function plot
Post by: lookang on September 05, 2007, 12:46:21 am
the current system you have is good, i have learned much here.

will give back to the community here  ;D

thanks


Title: Re: function plot
Post by: lookang on September 05, 2007, 01:21:44 pm
strange, is the xml file working ?


Generating simulation file
  D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java ...
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:331: <identifier> expected
  public javax.swing.JPanel Y(x);
                               ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:331: ')' expected
  public javax.swing.JPanel Y(x);
                                ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:336: <identifier> expected
  public javax.swing.JLabel Y(x)=;
                               ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:336: ')' expected
  public javax.swing.JLabel Y(x)=;
                                 ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:349: <identifier> expected
  public javax.swing.JPanel X(t),Y(t);
                               ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:349: ')' expected
  public javax.swing.JPanel X(t),Y(t);
                                     ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:355: <identifier> expected
  public javax.swing.JLabel X(t);
                               ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:355: ')' expected
  public javax.swing.JLabel X(t);
                                ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:360: <identifier> expected
  public javax.swing.JLabel Y(t);
                               ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:360: ')' expected
  public javax.swing.JLabel Y(t);
                                ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:558: illegal start of expression
    Y(x)= = (javax.swing.JLabel)
          ^
D:\EasyJavaSimulation\Ejs3.46_070428\Ejs\Simulations\_apps\_examples\functionplot.app\functionplot.java:644: ';' expected
    X(t),Y(t) = (javax.swing.JPanel)
        ^
12 errors
Compilation produced an error!


Title: Re: function plot
Post by: lookang on September 05, 2007, 01:29:26 pm
i did it!!!

need to rename the the "labels" for the panels.

after changing them, it works!!

think it is due to a stricter naming system employed by EJS 3.46 compared to 3.40.

the trick is look out for () =, the new naming convention in EJS 3.46 disallows :)

yeah!!


Title: Re: function plot
Post by: Fu-Kwun Hwang on September 06, 2007, 07:26:03 pm
Ejs use the label for your element to define variable name for the created code.
So please use old standard name convention (beginning with an alphabetic character. and containing letters or numbers only.)

If you define a label as f(x) for a TextField. EJS will generate something like
TextField f(x);
The java will interprete f(x) as a function need to be called (instead of variable name).
That is why it produce error message when compiling the code.