Main Content

GUI design - Sketch it out first! (Java / Swing example)

Archive - Originally posted on "The Horse's Mouth" - 2007-08-30 16:36:58 - Graham Ellis

"A picture paints a thousand words" ... and so it is when you're planning a graphic user interface, and implementing it. Yesterday, I picked up an old example of a dialer written in Java - you can see the actual window it generates on the right - and was looking to work out how it hung together.


A JFrame called Dialer has a Container called cp contains two Swing Jpanels called upper and lower, which are layed out with gridLayouts. Upper contains 3 components - Jlabels, one of which has no name and the other is called Result, and a JButton called OK,

The lower JPanel contains a further 12 JButtons, each of which has a temporary name of current assigned to it as its being defined ....


I did say that "A picture paints a Thousand words", didn't I? All this is shown in the diagram to the left. If you would like to see the source code, its available in full here