I did not understand why there is "x" appended to "java" for few of the import packages. What is the reason? Can't it be just java.swing.*
like others java.io.*
?
swing. Provides interfaces that enable the development of input methods that can be used with any Java runtime environment. Provides a set of "lightweight" (all-Java language) components that, to the maximum degree possible, work the same on all platforms.
Java Swing is a lightweight Java graphical user interface (GUI) widget toolkit that includes a rich set of widgets. It is part of the Java Foundation Classes (JFC) and includes several packages for developing rich desktop applications in Java.
JavaFX was intended to replace Swing as the standard GUI library for Java SE, but it has been dropped from new Standard Editions while Swing and AWT remain included, supposedly because JavaFX's marketshare has been "eroded by the rise of 'mobile first' and 'web first applications." With the release of JDK 11 in 2018, ...
Absolutely yes. Legacy swing applications are still supported and enhanced.
Swing was originally an extension to Java - a separately downloadable library. It became part of the "main" JRE in Java 1.2. It would have been odd for a separate library to have claimed a java.* package, hence the current situation. There are plenty of other extensions which have a similar story.
The Wikipedia article on Swing has a bit more information on its history.
From Core Java 2:
alt text http://bks5.books.google.fr/books?id=W6bomXWB-TYC&printsec=frontcover&img=1&zoom=5&edge=curl&sig=ACfU3U3IeRSfENUVokGf-d9GUZZBU-tYMQ
The name javax
indicates a Java extension package, not a core package. The Swing classes are indeed an extension to Java 1.1. Because the Swing classes were not part of the core hierarchy, it is possible to load the Swing classes into a Java 1.1-compatible browser.(the security manager of the browser does not allow adding any packages that start with "java.
".) On the Java 2 platform, the Swing package is no longer an extension, but is instead part of the core hierarchy. Any Java implementation that is compatible with Java 2 must supply the Swing classes. Nevertheless, the javax name remains, for compatibility with Java 1.1 code. (Actually, the Swing package started out as com.sun.java.swing
, then briefly got moved to java.awt.swing
during early Java 2 beta versions, then went back to com.sun.java.swing
in late Java 2 beta versions, and after howls of protest by Java programmers, found its final resting place in javax.swing
.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With