Nowadays, most programs aren't designed to be text only, they have a Graphical User Interface (GUI). While most people take this for granted, creating a GUI is not such a simple task. The design of the program is much more difficult because you no longer control the order in which things occur, the User does.
We are going to walk you through creating a simple program using Netbean's GUI designer. So, start Netbeans, create a new project called Alarm, mount a new directory called Alarm, and then create a new file of type Java GUI Forms -> JFrame Form. Give this file the name Alarm and then click finish. The GUI designer should now be displayed on the screen with a blank form visible (Note: you may have to resize some panels in order to see it, ask your lab instructor for help).
The basic idea of the GUI Editor is that you start with a blank form, add components to it, and then add code to the components. The components toolbar is located at the top of the Form Editor window and has tabs like Swing, Swing (Other), AWT, etc. Right below the components toolbar is a collection of icons you can use to add specific Java elements to your application.
On the right side of the window is an explorer which lists all the components you have added in a tree format.
Beneath this is a properties screen which always shows the properties for the currently selected component.
Follow these steps to create a simple alarm program
this.hide(); try { Thread.sleep(new Integer(jTextField1.getText()).intValue() * 1000); } catch (java.lang.InterruptedException e) { System.out.println("Countdown Interrupted"); } this.show(); jTextArea1.grabFocus();
That's all! Now you have a simple application which you can run on almost any computer in the world. Notice how little code it takes to create applications this way.
Show your lab instructor your new program.