
Science SPORE Prize
November 2011

The Open Source Physics Project is supported by NSF DUE-0442581.
|
dotted and dashed lines
post and replies
Return to the dotted and dashed lines thread
Login to post to this thread
|
How to make dotted or dashed 2D lines
- Feb 5 at 5:08PM
|
Paul DeYoung
86 Posts
|
It seems like this should be straight forward but my searching has turned up little of use. Is there an easy way within EJS (in particular within the EJS GUI) to make a line dotted or dashed? Sorry if I missed something obvious.
Thanks Paul DeYoung
Paul A. DeYoung
|
|
Re: How to make dotted or dashed 2D lines - Feb 05 5:45PM
|
Francisco Esquembre
71 Posts
|
Hi Paul,
No. It is not obvious.
There are two possibilities of doing this.
- The first one is using a deprecated version of the 2D drawables that accept any kind of java.awt.Strokes. There is nothing wrong with this. They are old, and I recommend the later versions, but they still work.
- The second one is that you use the new (still experimental) EJS that I have just compiled and in which I have added this feature to any 2D drawable.
See attached an example which uses both possibilities. But, again, you need an EJS older than 130205 to run it (otherwise, the code that illustrates the second possibility will cause a compile error). Run the simulation to see the stroke working. (In this example, the stroke is computed in the initialization.)
You can find the new EJS at http://fem.um.es/EjsWiki/uploads/Download/EJS_4.3.7_130205.zip
Any future release of EJS will have this feature.
You can learn about Strokes here , for instance: http://docstore.mik.ua/orelly/java-ent/jfc/ch04_05.htm
Paco
Attached File: ejs_StrokeExample.zip
|
|