Swing Issues and Examples

May 3, 2004

Use a Hyperlink to Invoke a Dialog in a JEditorPane

I once wrote an HTML custom-tag editor that required that a dialog box pop-up in response to a click on one of the hyperlinks. Here's the technique that I developed to accomplish that task.

April 17, 2004

Synchronized JScrollPanes

The trick to synchonizing two JScrollPanes to a single JScrollBar is to synchronize their JScrollBar data models. This example should be adaptable to JSliders and JProgressBars.

November 11, 2003

Create a Full Screen JFrame

Ever wanted to have a Kiosk-style JFrame running in full screen without a menu or title bar? You can do it by removing all decorations from the frame and setting its size to the screen size like this:

August 5, 2003

Sharing Actions Between JMenuBar and JToolBar

This example application illustrates a technique for sharing actions between JToolBars, JMenuBars and JPopups.

May 5, 2001

Using the Swing Text HTML Parser

You can use the swing text package to parse HTML documents. Here is an example that parses a webpage and prints all the IMG tags to standard out.

December 1, 2000

Get the Document Title from an HTMLDocument

How do you access the title of an HTMLDocument? Here's a hint: HTMLDocument stores the title as a property.

November 17, 2000

Recursive Traversal of a JTree

Here is a simple recursive method for traversing a JTree and printing all the leaf nodes.