Abbey Workshop

Java: Creating Basic GUI

This is a short example of how to create a basic Swing gui application in Java. (The tip consists mainly of the code shown below.) This example demonstrates a border layout and uses buttons inside of panels to fill in the layout. To build an application from this, simply replace the buttons with gui components of your choosing.

You will notice a method is used to create and launch a frame. We do not extend JFrame. In theory, by not doing this, it allows us to inherit from another object thus giving us more flexibility. Well, in theory anyway.

I initialize components as attributes of the class. Since Swing components used to build the UI do not change, this seems like a good place to define them. The constructor is then used to assemble the components you have defined.

Sample Output

BasicGui.java

Download source for: BasicGui.java

Google
  Web abbeyworkshop.com   

Copyright © Abbey Workshop 2006

Music Only Search
The Black MP3 Album
The MP3 Album Lyrics
Wprld Music Plus
Mp3 Songs Blog
Music Search Store
First Music Search
Mega MP3 Blog
E MP3 BLog
My MP3 Diary
Fast MP3 Finder
My Blog MP3
Mp3 Songs Mart
My MP3 Songs Album
Top Music Group
Mp3 Tune Records
Song Album Guide
Music DataDite
MP3 Buying Guide
Top MP3 Downloads
MP3 Tune Festival
FAST MP3 Downloads
MP3 Mart Online
Upper MP3
Premium MP3 Site
Music Data online
Fine MP3 Audio
Cheap Music Albums
Fine mp3 downloads
World MP3 Music Records
Mp3 Music Data Direct
The Fine Mp3
MP3 Files World
Home Music Store
DatMP3
Fat MP3 Audio
MP3 ZigZag
MP3 Songs Direct
MP3 Tune World
E MP3 Log
Boom MP3 Music
Speedy MP3
Top 20 MP3 music
Deep MP3 World
Deep MP3 Download
Best-20 MP3
Top Twenty MP3
Deep MP3
Big MP3 Guide
Deep MP3 Audio
Mp3 R.O.B.
MP3-Pop Online
Greate-20-MP3
MP3 Appear
3T-MP3