NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/
December 18, 2017, 12:53:55 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Peaceful solution is always the best solution. ...Wisdom
Google Bookmarks Yahoo My Web MSN Live Netscape Del.icio.us FURL Stumble Upon Delirious Ask FaceBook

Pages: [1]   Go Down
  Print  
Author Topic: Is it possible to instanciate objects (java obj) in Ejs from custom code?  (Read 6550 times)
0 Members and 1 Guest are viewing this topic. Click to toggle author information(expand message area).
st@lk3r
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
on: March 14, 2009, 10:17:56 pm »

I would like to know if it is possible to instanceate (create them with the "new" constructor) java objects (like drawables,containers) in the custom code pages of ejs, or at least can i import in Ejs classes that do so? e.g. create a class "charge" that extends the Drawable object, import it in a Ejs-created Model-View-Control app and  by pressing one of the View's buttons to add a "charge" in the View's DrawingFrame. More details-> Book->Open Source Physics, chapter 10, Electrodynamics (Gould et al.)
Logged
Fu-Kwun Hwang
Administrator
Hero Member
*****
Offline Offline

Posts: 3080



WWW
«
Embed this message
Reply #1 on: March 14, 2009, 10:56:22 pm » posted from:Taipei,T\'ai-pei,Taiwan

Because EJS is a java code generator, so in principle, you can do whatever can be done with java.

You will need to know the EJS build in function names which can add view elements into EJS _view.
 
If you want to have a look at some examples, you can check out xxxView.java in your output foloder.

But I never did it that way. EJS let you define variable array.
If I need to add many particles in run time, I will define an array of variables and use view or number of element property to change the number of paricles shown.

I would suggest you check out  Charged Particle and Wall . You can add up to 500 particels and build walls in run time.
I think it is better to do it this way.  Wink
Logged
st@lk3r
Newbie
*
Offline Offline

Posts: 1

«
Embed this message
Reply #2 on: March 17, 2009, 04:27:30 pm »

That was very helpful! Thank you very much. By the way, the walls&parts app RoCKs!  Shocked
Logged
Pages: [1]   Go Up
  Print  
Peaceful solution is always the best solution. ...Wisdom
 
Jump to:  


Related Topics
Subject Started by Replies Views Last post
About crashing objects in physlet
Question related to Physics or physics related simulation
jorgenio1 5 8839 Last post January 28, 2015, 01:38:10 pm
by Heihachi07
please help me ,,, source code "java"
Electromagnetics
seemlave 1 6888 Last post January 12, 2009, 11:40:32 pm
by Fu-Kwun Hwang
Spring connect two objects in graviy field
Dynamics
Fu-Kwun Hwang 0 6602 Last post April 12, 2009, 05:58:29 pm
by Fu-Kwun Hwang
Charge Distribution of 2 objects
Request for physics Simulations
lookang 13 14066 Last post November 22, 2009, 06:21:23 pm
by UKLN8860
Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 5.06 seconds with 23 queries.since 2011/06/15