[simple ImagePane PIC] Chapter 6.5.   Shapely (non-rectangular) Applications


[ This chapter does not appear in the book. ]

A lot rests on appearances, and the first thing a user sees is the application window. Java allows the look-and-feel of an application to be varied, but you're still stuck with the same old rectangular frame, with iconify, maximize/minimize and close buttons in a title bar. The ImagePane application shown in the image on the right is typical of this same-old-look-and-feel.

[TV ImagePane PIC] In this chapter we throw away the rectangular look, recasting an application into any shape you like. For example, the second image shows the "hand held TV" look-and-feel for ImagePane, and the third image uses a "hand mirror".

We aim to deceive - the application underneath is the same in all three figures. The user clicks on the "Open File" button to load a GIF or JPEG file into the scrollable pane.

A 'shapely' window (my name, and I'm sticking to it) has iconify and close 'icons', but no ability to minimize or maximize. The window can be moved around by the user dragging any part of the visible frame. A shapely window is a non-rectangular window.


[mirror ImagePane PIC] This chapter describes the development of the 'hand mirror' version of the image viewer, called ShapelyImagePane. However, the coding approach can easily handle different appearances and applications. For example, the frame's shape can be changed from the hand mirror to the TV by modifying just a few lines of code. Changing the application means changing the GUI elements, which are located in a single JPanel subclass.




Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page