Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Question about EJS and Objects

Return to the EJS Modeling forum
Login to post to this thread

Adjusting the font for plot axis labels - Dec 11, 2011 at 2:32PM
Larry Engelhardt
15 Posts

Is it possible to modify the font that is used for the axis labels of plots?

I see that PlottingPanel view elements have a setFont method, so I tried the following lines of code:

Font f = new Font(Font.SERIF, Font.PLAIN, 30);
_view.plottingPanel.setFont(f);

However, this does not seem to do it.

Thanks!


Current Replies - View all
Re: Adjusting the font fo...   (Francisco Esquembre - Dec 11, 2011 at 5:30PM)
Re: Adjusting the font fo...   (Francisco Esquembre - Jan 21, 2012 at 12:18PM)
Re: Adjusting the font fo...   (james adam (DS) - Jan 24, 2012 at 7:54AM)
Re: Re: Adjusting the fon...   (Francisco Esquembre - Jan 25, 2012 at 4:18PM)
Rotation of a 2Dshape - Dec 9, 2011 at 7:18AM
Iannis Avramopoulos
4 Posts

Hello,

I have a 2Dshape and I want to rotate it by a variable angle, say "theta", which I have already declared in the variables panel.

So I try to input my variable to the dialog box that accompanies the cell "Transform".  I type "theta", in the cell next to the button "Rotation" and press the button. The line on the bottom reads "ro:thetad" which seems to me wrong syntax and it appears that it actually is, because in the output area reads

"Incorrect value for transformation: ro:thetad
java.lang.NumberFormatException:For input string:"theta"
at.sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1242)
....
..."
many more lines,   you get the idea

and of course it's not rotating when I run the simulation.

I can't figure out what's wrong with the syntax, as my programming skills are below average and I have little knowledge of java .

Thank you in advance

Iannis


Current Replies - View all
Re: Rotation of a 2Dshape   (Francisco Esquembre - Dec 9, 2011 at 8:29AM)
Re: Re: Rotation of a 2Ds...   (Iannis Avramopoulos - Dec 10, 2011 at 12:15PM)
Elements in a ShapeSet - Nov 6, 2011 at 3:41PM
Eduardo Garcia
13 Posts

Hello:


Related to my other post, I am looking for a way to adress an element in a ShapeSet.

For example I have a ShapeSet of 8 elements, and I want to change the color of the single element that the user clicked. How can I get the Object with which the user has interacted from the ShapeSet?


Thank you for your time and patience.


Current Replies - View all
Re: Elements in a ShapeSe...   (Francisco Esquembre - Nov 7, 2011 at 1:10PM)
Re: Re: Elements in a Sha...   (Eduardo Garcia - Nov 12, 2011 at 7:46PM)
Objects in EJS - Oct 28, 2011 at 1:46AM
Eduardo Garcia
13 Posts

Hello.

I am making a simulation on EJS, but I am having problem with my custom code. I don't undestand how I can get the Object of a button or a 2dShape I make so I can use the class functions with it.

For example, I have created a 2Dshape.  I want to be able to change its color when I click on it, by using  the function "setColor()" of the class.. I cant seem to get the object of the 2DShape. I used the functions "_view.getvisual("shape")" to no avail. I don't have so much knowledge in programming.


Thank you for yout time and patience.

Post edited October 30, 2011 at 4:48 PM EST.


Current Replies - View all
Re: Objects in EJS   (Francisco Esquembre - Oct 28, 2011 at 2:25PM)
Re: Re: Objects in EJS   (Eduardo Garcia - Oct 30, 2011 at 4:49PM)
Re: Re: Re: Objects in EJ...   (Francisco Esquembre - Oct 30, 2011 at 5:12PM)
Re: Re: Re: Re: Objects i...   (Eduardo Garcia - Nov 1, 2011 at 12:52AM)
Re: Re: Re: Re: Re: Objec...   (Francisco Esquembre - Nov 1, 2011 at 3:50PM)
Re: Re: Re: Re: Re: Objec...   (lookang - Nov 2, 2011 at 10:43AM)
Re: Re: Re: Re: Re: Re: O...   (Eduardo Garcia - Jun 13, 2012 at 10:16AM)
The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics