Swing links of the week: August 3, 2008

August 4th, 2008

Here are some Swing links that you might have missed during this week:

  • Jon Lipsky is back from a two-year long blogging hiatus and he writes about extending the RelativeLayout from James Elliott’s 2002 article.
  • Santhosh Kumar is back as well (he’s not been blogging about Swing since last August), and this time he brings the auto-snap split pane divider. The solution is very simple, but i’m not sure of the usability of this particular feature. In the past, i always found the different auto-snap behaviors (such as windows in desktop managers or connectors in Visio) to stand in my way most of the time, leading me to fight with the UI. On the other hand, auto-snap in sliders is quite a useful features to restrict the input domain to a small discrete subset.
  • JavaSwing.net continues its series of tutorials on Swing text components, and this time they write an introduction to working with JFormattedTextField component.
  • Gregg Bolinger has an implementation of application wide hotkeys. It uses a custom EventQueue that inspects all KeyEvents and consumes those keystrokes that it sees as the custom hotkey launchers. If you decide to follow this route, be sure to read Hans Muller‘s post on the mailing list of AppFramework project from last October:

The downside is that I’ve spoken with the AWT technical lead and he’s suggested that using EventQueue.push() is deadlock-prone. That is, the area of code that deals with EventQueues is quite complex and there may be unknown bugs that could cause deadlocks.

  • And finally, Ken Orr tracks an interesting problem of providing different visuals for controls in active and inactive windows. His solutions include checking Window.isFocused in various painting methods (such as JPanel.getBorder and JLabel.getForeground) and tracking the changes to “Frame.active” client property.