josh.earth
  • Blog
  • Apps
  • Portfolio
  • About
  • ← All projects

    Swing Hacks

    an O'Reilly book teaching you how to hack the Swing Java UI toolkit one step beyond.

    Personal · Book · Java · Java · Swing · Sun · Oreilly

    In 2005, I co-wrote the O'Reilly book Swing Hacks with Chris Adamson. The book shows you how to push what is possible with Swing, the then popular UI toolkit for desktop Java applications.

    Swing Hacks Listing on Amazon in 2005

    O'reilly's listing

    Swing Hacks was a success by tech book standards, was translated into Japanese and Portuguese (Java was huge in Brazil then) and still pays me royalties two decades later.

    Japanese translation

    Amazon's listing for the Japanese translation

    Swing Hacks covered how to do extreme things with the UI toolkit, things the original authors never intended to build but gave developers the hooks to do it themselves. Crazy things like weirdly styled JLabels, transparent windows, and magnifying glasses using the screen capture API.

    christmas countdown jlabel

    transparent window

    magnifying glass

    Swing Hacks was my first large writing project and directly led to be being hired by Sun to work on the Swing team itself, where I improved Swing, the Netbeans GUI editor, and then worked on Swing's successor, JavaFX.

    Though 20 years old it has still inspired other developers. Here's a reworked example from 2019.