java

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

AlPad - A simple "scratchpad" editor

Over the course of a few hours this past week I created a little “scratchpad” text editor I named AlPad. It’s gone through several names, but since I’m just writing it for me, the name seems appropriate.

It’s not really correct to call AlPad an “editor”; it’s really just an app where I can keep a collection of miscellaneous notes I usually make when I’m working. It has very few features, just some ones I want and can implement easily:

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”.