Java News from Thursday, June 2, 2005

Here's a problem that's been bugging me for a while. I need a resizable Swing JFrame, but only at a fixed ratio based on one of its components That is, if the height of the component is doubled the width must be exactly doubled as well. Imagine, for instance, that the window contains a picture. The user should be able to click and drag the usual grow box to expand or shrink the window. As the user does this, the picture in the window should grow or shrink accordingly. However, the user cannot increase the height of the window without increasing the width proportionately and vice versa. In other words the ratio of the component restricts how the user can grow the window. A couple of key points:

Any ideas? I'll offer a free copy of Java Network Programming (or another one of my books of your choosing) to the first reader who responds with a real solution to the problem.

R. Rawson-Tetley has posted SwingWT 0.87, an open source, "100% pure Java library which very closely resembles the interface of Swing. The difference is that instead of using the Swing library, it drives native peer widgets from SWT" (the Eclipse GUI toolkit). With this library, Java/Swing applications can be compiled natively under Linux using gcj. It also allows Swing apps to use native widgets. This release improves JFileChooser and DefaultTreeCellEditor, adds many compatibility methods, improves font support, and fixes many bugs. SwingWT is dual licensed under the Common Public License and the LGPL.

Andrei Kouznetsov has posted a beta of Unified I/O 2.3, an open source (BSD license) class library that "allows random access to any data or stream (even over HTTP), and gives a clear difference between read only and read/write access." 2.3 adds support for explicit memory management.