javax.swing.grouplayout 在 jdk 1.5 中不存在
我用netbeans开发了一个java应用程序。它使用jdk 1.6。
效果很好。
但现在的要求是我需要从另一台没有 netbeans 且使用 jdk 1.5 的计算机中的 .java 文件构建应用程序的 jar。我无法将该机器升级到jdk 1.6。
有什么办法可以让我的java文件在jdk 1.5机器上编译和工作,并对我的源代码进行尽可能小的更改。
错误是javax.swing.grouplayout在jdk 1.5中不可
用请帮忙...
I developed a java application with netbeans. It used jdk 1.6.
It works fine.
But now the requirement is I need to build the jar for the application from the .java files in another machine without netbeans and where jdk 1.5 is used. I cannot upgrade that machine to jdk 1.6.
Is there any way I could make my java files compile and work in jdk 1.5 machine with a possible minimal change to my source code..
The error is javax.swing.grouplayout not available in jdk 1.5
Please help...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 netbeans 首选项并选择 org.jdesktop...,通过在表单中右键单击手动更新生成的代码(检查器窗口 -> 选择 swing 布局扩展而不是标准 java6 代码)。
Use the netbeans preferences and select org.jdesktop...., update manually the generated code by right-click in the form (Inspector Window -> select swing layout extensions instead of standard java6 code).
对于 NetBeans,请参阅 John Doe 的回答。对于带有 MyEclipse 的 Eclipse,您可以使用 Matisse,在 Outline View 中选择 Form。现在,在“属性”视图中查看“布局生成样式”并选择“Swing 布局扩展库”而不是“标准 Java 6 代码”。
For NetBeans, see the answer by John Doe. For Eclipse with MyEclipse so you can use Matisse, in the Outline View, select the Form. Now in the Properties View look at "Layout Generation Style" and select "Swing Layout Extensions Library" rather than "Standard Java 6 Code."
同时,“Matisse”库不再可用,但 JDK 1.6 源代码,例如 code.yawk.at。存在类
javax.swing.Grouplayout
,它依赖于java.awt.Component
,它在JDK 1.6中由java.awt.Component.BaselineResizeBehavior扩展和一些方法。
解决方案是从这些类构建一个带有嵌套
BaselineResizeBehavior
的javax5.swing.Grouplayout
类。选择该包不会干扰保留的包javax.swing
。来自Component
的其他依赖项具有简单的实现,并且可以在javax5.swing.Grouplayout
中替换。Meanwhile the "Matisse" library is no more available, but JDK 1.6 sources, e.g. code.yawk.at. There exists class
javax.swing.Grouplayout
, it has dependencies fromjava.awt.Component
, which was extended in JDK 1.6 byjava.awt.Component.BaselineResizeBehavior
and some methods.Solution is to build from these a class
javax5.swing.Grouplayout
with nestedBaselineResizeBehavior
. The package is chosen to not interfere with reserved packagejavax.swing
. Other dependencies fromComponent
have trivial implementation, there and can be substituted injavax5.swing.Grouplayout
.