yes, it is difficult for me to do this properly as well as i have some java scalarfield objects that could perhaps use this and a alternative display method for scalar field.
perhaps you can look at this? https://www.tu-chemnitz.de/physik/THUS/tmp/OSP/org/opensourcephysics/display2d/ByteRaster.html
OK. Sorry for the delay. Here are some hints and a working example.
A ByteRaster is a 2D element to visualise a 2D array of ints using a color code. The color code can be a predefined palette or a number of colors that you specify.
If you palette has n colors, the Data int[][] array must contain values from 0 to n-1.
The NumColors is what I call n above.
The Default palette is a range of shades from red to blue, if I am not wrong. You can choose the following Strings: "SPECTRUM" "GRAYSCALE" "DUALSHADE" "RED" "GREEN" "BLUE" "BLACK" play with the values to see what they mean.
Alternatively, you can specify an array of HTML colors with NumColors in it. (A color in HTML is a String, such as "rgb(255,0,0)" - which equals "red".)
Finally, changing Data does not automatically updates the display (because it is time-consuming), unless the AutoUpdate is set to true.
There is a question in [Position and Size]. I can define "SizeX" that I want. For example, define SizeX= 10 , the "ByteRaster" length of x is 10. When I changed or typed some value in "SizeY", but nothing happened.
What am I doing wrong?
Please see attached file.
Many thanks.
I am trying to display stress distribution in specific size (beam or plate) . Can "ByteRaster" or "Mesh2D" do that?