Understanding Applications and Applets
Swing versus AWT Programming
- Naming convention: All Swing component names begin with a capital J and follow the format JXxx. E.g., JFrame, JPanel, JApplet, JDialog, JButton. Many are just AWT names with a J.
- Lightweight components: Most Swing components are lightweight: formed by drawing in the underlying window.
- Use of paintComponent for drawing: Custom drawing code is in paintComponent, not paint. Double buffering turned on by default.
- New Look and Feel as default: With Swing, you have to explicitly set the native look.
- Don't mix Swing and AWT in same window
The following module discusses Applet and Servlet Interaction
Applet and Servlet Interaction
Graphical applications
Graphical applications are useful when you want to create a program with a graphical user interface that does not reside on the Web. For example, you might want to write a graphical application to inventory your personal CD collection.
In this case, it would not necessarily need to have any connection to a Web page. You will probably create command-line Java applications to serve as simple utilities.
These simple utilities perform tasks such as processing files or getting system information, because their overhead is so minimal.
Additionally, command-line Java applications can be very useful for testing code that you do not want to place in an applet. Suppose you have developed a sorting subroutine that sorts alphabetic names and you want to test it.
This is not the kind of subroutine that would benefit from being placed in a graphical application when all you care about seeing are the names displayed in order.