This post is for the beginning java developers out there. At the least those that are familiar with the basic concepts of java and have written a few text based programs.

I’m more then once asked how it is possible to create a GUI with java code. Well there are a few ways, the most commonly used (I think at least, it’s the one I always use) is Swing. This is the primary Java GUI toolkit, it contains an API which contains a graphical user interface (needless to say).

It was developed to provide a more sophisticated set of GUI components than the, older, Abstract Window Toolkit (AWT). Swing will provide a native look and feel that will work on several platforms. If you OS runs java, it can run Swing. In addition to the standard buttons, check boxes and labels it provides several other components as well like a tabbed panel, scroll bars/panes, trees, tables and list boxes.

Is it hard to use? I’m going to be honest with you.. Working with Swing will grind your gears at first. It’s rather simple but it can get very complex very fast. You really have to keep your head to your work when writing code like this. It is wise to put some documentation lines in your code just to remember why you did certain things.
But like most things, once you get used to it, you will love it.

What can you do with it? I would dare to say.. Anything.. If you can create it in java code you can put a GUI over it. You can even write games with java code and swing. (I’ve seen code to create tetris, pac-man, etc).

I found one website which provides some very nice tutorial code. From very easy to very hard (it even has the “create a game” tutorial code).

You can check it out here: http://zetcode.com/tutorials/javaswingtutorial/.

If you want to learn java coding with swing, there is only one way to do it. Try it, work with it, write code until your fingers bleed.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: