我在使用 netbeans 将 JApplet 部署到工作的 Web 服务器中时遇到问题。发生的情况是,它似乎加载了小程序,但加载后我只是留下一个空白屏幕,没有按钮。我认为这可能是因为我正在使用卡片布局设计,或者因为所需的库未包含在 .jar 中。我正在使用 Atmos 包装函数和许多外部 .jar 文件。
任何帮助都会很棒!如果您需要更多信息,请询问!
public void init() {
// initialise any variable we have created
cloud = new CloudClass();
user = new User();
sourceFiles = null;
dest = null;
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and feel. For details see
* http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ArFileJApplet.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/*
* Create and display the applet
*/
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
// initialise any previously uninitialised variables
initComponents();
invalidLogin_label.setVisible(false);
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
编辑:我做了一些调整,现在小程序页面只是在网页上出现一个错误,显示“错误,单击查看详细信息”
单击此内容显示 com/emc/esu/api/EsuException 并单击“详细信息”按钮会为我提供一些调试选项,这可能对所有知识渊博的类型有所帮助。
c:清除控制台窗口 f:终结终结队列中的对象 g:垃圾收集 h:显示此帮助消息 l:转储类加载器列表 m:打印内存使用情况 o:触发日志记录 q:隐藏控制台 r:重新加载策略配置 s:转储系统和部署属性 t:转储线程列表 v:转储线程堆栈 x:清除类加载器缓存 0-5:将跟踪级别设置为
最佳答案
最有可能出现两个可能的问题:
- 在类路径上找不到所需的 jar,因此它会因某种错误而爆炸。在这种情况下,您需要了解如何查看 ClassNotFoundException 并从那里解决它。
- 加载后您的用户界面未刷新/布局正确。请参阅:Applet works, but swing components won't appear!
关于Java Applet Web部署问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10645518/