Education Prize Logo
Science SPORE Prize
November 2011

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

formatted output in field post and replies

Return to the formatted output in field thread
Login to post to this thread

Problems understanding Format - Sep 6, 2012 at 4:12AM
Ivo Gienal
9 Posts

I want to display in an output field a number, who can change between say 0 an 100 during the simulation. The output should be in the form 24.568. How should the format entry look? If I leave it blank, the display, after the simulation is paused, is 4.856. When I resize the Window, then the display shows 24.856. The same when I use format 0.000.

Replies to Problems understanding Format

Re: Problems understanding Format - Sep 06 2012 4:43AM
Francisco Esquembre
216 Posts


The format you want can be either 0.000 (the default) or 0.### The difference is that 0.000 will display 24.4 as such 24.400, while 0.### would do it as 24.4.

The problem you report is not with the format, but with the SIZE of the field. I suggest that you set the "Columns" property of the field to something like 6 or 7. This is not exactly the number of digits to show, but close to it (actually a bit larger - that's something Java decides, not me). Or you can also set the property size of the field to something appropriated. Though the columns property is better because it is more reliable in case of change of fonts.


The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics