Tristate Checkbox for Swing

One modern GUI feature notably absent from Java Swing is the tristate checkbox, i.e. a checkbox that has a third or “null” state in addition to the checked and unchecked states. This is typically visualized as a square or dash in the checkbox, where the checked state would be a checkmark and the unchecked state … Continue reading “Tristate Checkbox for Swing”

MIME Browser 2.1 Released

Version 2.1 of MIME Browser, my free EML message viewer, is now available for download. This is a bugfix release prompted by a user report that double-clicking on a folder entry could select an entirely different file in the same folder. Turns out I had forgotten to translate between display and model row indices of … Continue reading “MIME Browser 2.1 Released”

Myriarch 2.1 for Swing Released

Version 2.1.0 of Myriarch, a simple real-time simulator for pre-gunpowder tactical combat, is now available for download. As with previous project updates, the Myriarch GUI is now based on Swing due to the removal of JavaFX from Oracle’s Java SE distributions. The minimum Java requirement was consequently lowered to Java SE 8, although note that … Continue reading “Myriarch 2.1 for Swing Released”

Java Swing JComboBox Tips

This post is a sequel to Java Swing Tips which formerly contained a shorter version of these tips concerning JComboBox. I decided to extract them into their own post as they got rather long, and the section on custom rendering was not quite correct. As before I’m using Oracle OpenJDK 10 on Windows 10 for … Continue reading “Java Swing JComboBox Tips”

Star Chess 2.1 for Swing Released

Version 2.1.0 of Star Chess, my free mini space conquest game built to demonstrate a multiplayer turn prediction algorithm, is now available for download. As with previous updates to MIME Browser and Tektosyne, the big change is again due to the removal of JavaFX from Oracle’s Java SE distributions: Star Chess is now based on … Continue reading “Star Chess 2.1 for Swing Released”

Swing Hyperlink Labels

JavaFX has a convenient Hyperlink control that’s functionally a button styled as an underlined label, just like an HTML hyperlink. Java Swing has clickable hyperlinks in its JEditorPane control but does not provide them as a separate lightweight control. Fortunately it’s quite easy to roll your own, and that’s what the code below does. JHyperlink … Continue reading “Swing Hyperlink Labels”

Vertical Swing Labels

One limitation of Java AWT/Swing is the inability to rotate controls such as labels, although you can freely rotate elements in a custom-drawn graphics context. I did try invoking a label’s paint method in a paintComponent override after rotating the graphics context but couldn’t get it to work, probably because of the label’s built-in assumptions … Continue reading “Vertical Swing Labels”

Tektosyne 6.3 for Swing Released

Tektosyne 6.3.0 is now available for download. This is an unusual release as there are no functional changes whatsoever to the core library. Instead, the GUI demo application has been entirely rewritten, motivated of course by the recent removal of JavaFX from Oracle’s Java SE distributions. Here’s an overview of the changes. You can find … Continue reading “Tektosyne 6.3 for Swing Released”

Swing High DPI Properties

When Java AWT/Swing got JavaFX-style automatic high DPI scaling in Java SE 9, there were also several new system properties to control that scaling. Unfortunately, as with the various* properties of JavaFX (see e.g. here) they are not officially documented. You need to check the developer mailing list and the JDK test sources to … Continue reading “Swing High DPI Properties”