What开发者_StackOverflow中文版 is the 'J' in JFrame in Java?
The J
identifies all Swing components.
Swing used to be marketed as Java Foundation Classes, before it became an integral part of the JDK.
Joachim Sauer's answer is correct. Read on only if you need more in depth overview of the various Java GUI approaches and evolution.
First Java GUI was (is) called AWT (Abstract Window Toolkit). AWT is a very simple tool kit with limited GUI components, layout managers, and events. An example of an AWT class is java.awt.Frame
.
Then a more complex solution was developed by Sun -> JFC Swing (Java Foundation Classes, a.k.a. Swing). In Swing, Sun created a very well-engineered, flexible, powerful GUI tool kit. Unfortunately, this means Swing takes time to learn, and it is sometimes too complex for common situations. Swing is built on parts of AWT. All Swing parts are also AWT parts. Swing uses the AWT event model and support classes, such as Colors, Images, and Graphics. An example of a Swing class is javax.swing.JFrame
. Here you see your "J" which prefixes all Swing GUI components.
SWT is a low-level GUI tool kit comparable in concept to AWT. JFace is a set of enhanced components and utility services to make building GUIs with SWT easier. The builders of SWT learned from the AWT and Swing implementations and tried to build a system that had the advantages of both without their disadvantages. In many ways, they succeeded.
Note that both, AWT and Swing, are part of the J2SE package. While SWT is a separate third-party library which grew up with the Eclipse IDE (org.eclipse.swt
).
This overview was taken from http://www.ibm.com/developerworks/grid/library/os-swingswt. See that link for more detail.
It is a naming convention for all Swing GUI components: JPanel, JLabel, JTextField, JCheckBox...
All of the swing things are named that way. JFrame, JLabel, JButton, JTextField, etc.
精彩评论