You can customize the appearance of text in the Memory icon via its pop-up menu.
You can also define a series of icons to be displayed in place of the Memory's own contents if you'd like. For an example of how this is done, please see the sample XML file. Use your browser's "view source" command, or download that file to see how it's done. Basically, the XML browser file has a "memoryicon" element that carries various information about where to put the icon, whether it can be selected, etc. Within that element, you can define "memorystate" elements that define what icon to show when the memory has a specific value:
<memoryicon memory="IM20" defaulticon="program:resources/icons/misc/Question-black.gif"> <memorystate value="9" icon="program:resources/icons/misc/Nixie/M9B.gif" /> <memorystate value="8" icon="program:resources/icons/misc/Nixie/M8B.gif" /> </memoryicon>
(That example has been simplified by omitting some stuff from the memoryicon element) In the example, the two memorystate elements ensure that if the Memory contains "9" or "8", certain images will be shown, otherwise a default black question mark icon will be shown.
Unfortunately, JMRI doesn't have a nice GUI tool for defining the icons displayed when using a memory icon this way. You have to edit the XML file by hand, following one of the examples.
Memories are is kept in your layout configuration, along with Turnouts, Sensors, Signal Heads, etc. To store this information on disk, allowing you to reload it next time you run JMRI, see Loading and Storing Your Work.