Why import javax.swing.* instead of java.swing.*(为什么导入 javax.swing.* 而不是 java.swing.*)
问题描述
我不明白为什么少数导入包的java"后面会附加x".是什么原因?不能像其他java.io.*一样只是java.swing.*吗?
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 最初是对 Java 的扩展 - 一个可单独下载的库.它成为 Java 1.2 中主要"JRE 的一部分.一个单独的库声称一个 java.* 包是很奇怪的,因此是目前的情况.还有很多其他扩展都有类似的故事.
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.
维基百科关于 Swing 的文章 提供了有关其历史的更多信息.
The Wikipedia article on Swing has a bit more information on its history.
这篇关于为什么导入 javax.swing.* 而不是 java.swing.*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么导入 javax.swing.* 而不是 java.swing.*
基础教程推荐
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
