recent posts related to java, jdbc, spring, etc.

How to get the default system font in a Java/Swing application

I haven’t tested this with other Java components, but if you want/need to get the “system font”, this code gets the default system font from a JEditorPane component:

val outputArea = new JEditorPane
val fontFamily = outputArea.getFont.getFamily

That code is written in Scala, but as you can see, it converts easily to Java. On Mac OS X 10.10, fontFamily ends up being “Lucida Grande”.

Using the Client JVM and controlling RAM when building a Scala/Java/Mac application

For my TypewriterFX application (which plays Mac OS X typewriter sound effects), I wanted/needed to control the JVM that was used to run the application. The way it works, TypewriterFX plays sounds as fast as it can -- as fast as you type -- so I needed the JVM to be more like the old client JVM than a typical server JVM.

The Java PrintFlagsFinal Java/JVM option (maxpermsize, maxheapsize)

As a quick note, I saw the PrintFlagsFinal Java/JVM option today, and thought it was interesting. I saw this command:

java -XX:+PrintFlagsFinal -Xmx64m -Xms32m -version 2>&1 | grep -i -E 'heapsize|permsize|version'

which yielded this output:

Syndicate content