APS Excellence in Physics Education Award
November 2019

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
Larry Engelhardt
17 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 - )
Re: Adjusting the font fo...   (Francisco Esquembre - )
Re: Adjusting the font fo...   (james adam (DS) - )
Re: Re: Adjusting the fon...   (Francisco Esquembre - )
Rotation of a 2Dshape
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 - )
Re: Re: Rotation of a 2Ds...   (Iannis Avramopoulos - )
Elements in a ShapeSet
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 - )
Re: Re: Elements in a Sha...   (Eduardo Garcia - )
Objects in EJS
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 - )
Re: Re: Objects in EJS   (Eduardo Garcia - )
Re: Re: Re: Objects in EJ...   (Francisco Esquembre - )
Re: Re: Re: Re: Objects i...   (Eduardo Garcia - )
Re: Re: Re: Re: Re: Objec...   (Francisco Esquembre - )
Re: Re: Re: Re: Re: Objec...   (lookang - )
Re: Re: Re: Re: Re: Re: O...   (Eduardo Garcia - )
OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book