Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 JOptionPane的奇怪出错
cxp108





发贴: 363
积分: 12
于 2003-10-14 10:58 user profilesend a private message to usersend email to cxp108search all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Applet中编写以下代码
public class ClusterParaDialog extends JDialog{
.
.
.
.
private class cycleSaNoTFInputVerifier extends InputVerifier{
.
.
.
JOptionPane.showMessageDialog(ClusterParaDialog.this,"content","dialog",JOptionPane.INFORMATION_MESSAGE);
.
.
.
.


.
.
}
编译通过了
运行环境:JRE 1.3.1 就不会出现问题,显示正常
但是运行环境1.4.0~2版本的JRE会出现以下问题:

----------------------------------------------------------------------------------------
Exception occurred during event dispatching:

java.lang.StackOverflowError

  at sun.java2d.Disposer.add(Disposer.java:91)

  at sun.java2d.Disposer.addRecord(Disposer.java:68)

  at sun.awt.windows.Win32SurfaceData.initOps(Native Method)

  at sun.awt.windows.Win32SurfaceData.<init>(Win32SurfaceData.java:432)

  at sun.awt.windows.Win32SurfaceData.createData(Win32SurfaceData.java:311)

  at sun.awt.windows.WComponentPeer.replaceSurfaceData(WComponentPeer.java:321)

  at sun.awt.windows.WComponentPeer.setBounds(WComponentPeer.java:133)

  at sun.awt.windows.WComponentPeer.initialize(WComponentPeer.java:523)

  at sun.awt.windows.WCanvasPeer.initialize(WCanvasPeer.java:63)

  at sun.awt.windows.WPanelPeer.initialize(WPanelPeer.java:57)

  at sun.awt.windows.WWindowPeer.initialize(WWindowPeer.java:81)

  at sun.awt.windows.WDialogPeer.initialize(WDialogPeer.java:48)

  at sun.awt.windows.WComponentPeer.<init>(WComponentPeer.java:497)

  at sun.awt.windows.WCanvasPeer.<init>(WCanvasPeer.java:29)

  at sun.awt.windows.WPanelPeer.<init>(WPanelPeer.java:53)

  at sun.awt.windows.WWindowPeer.<init>(WWindowPeer.java:77)

  at sun.awt.windows.WDialogPeer.<init>(WDialogPeer.java:26)

  at sun.awt.windows.WToolkit.createDialog(WToolkit.java:368)

  at java.awt.Dialog.addNotify(Dialog.java:387)

  at java.awt.Window.pack(Window.java:428)

  at javax.swing.JOptionPane.createDialog(JOptionPane.java:899)

  at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:819)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:624)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:595)

  at com.cet.ui.ctcui.ClusterParaDialog$cycleSaNoTFInputVerifier.verify(ClusterParaDialog.java:1833)

  at javax.swing.InputVerifier.shouldYieldFocus(InputVerifier.java:114)

  at javax.swing.JComponent.runInputVerifier(JComponent.java:1104)

  at javax.swing.JComponent.requestFocus(JComponent.java:1109)

  at javax.swing.plaf.basic.BasicOptionPaneUI.selectInitialValue(BasicOptionPaneUI.java:849)

  at javax.swing.JOptionPane.selectInitialValue(JOptionPane.java:2126)

  at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:821)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:624)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:595)

  at com.cet.ui.ctcui.ClusterParaDialog$cycleSaNoTFInputVerifier.verify(ClusterParaDialog.java:1833)

  at javax.swing.InputVerifier.shouldYieldFocus(InputVerifier.java:114)

  at javax.swing.JComponent.runInputVerifier(JComponent.java:1104)

  at javax.swing.JComponent.requestFocus(JComponent.java:1109)

  at javax.swing.plaf.basic.BasicOptionPaneUI.selectInitialValue(BasicOptionPaneUI.java:849)

  at javax.swing.JOptionPane.selectInitialValue(JOptionPane.java:2126)

  at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:821)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:624)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:595)

  at com.cet.ui.ctcui.ClusterParaDialog$cycleSaNoTFInputVerifier.verify(ClusterParaDialog.java:1833)

  at javax.swing.InputVerifier.shouldYieldFocus(InputVerifier.java:114)

  at javax.swing.JComponent.runInputVerifier(JComponent.java:1104)

  at javax.swing.JComponent.requestFocus(JComponent.java:1109)

  at javax.swing.plaf.basic.BasicOptionPaneUI.selectInitialValue(BasicOptionPaneUI.java:849)

  at javax.swing.JOptionPane.selectInitialValue(JOptionPane.java:2126)

  at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:821)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:624)

  at javax.swing.JOptionPane.showMessageDialog(JOptionPane.java:595)

  at com.cet.ui.ctcui.ClusterParaDialog$cycleSaNoTFInputVerifier.verify(ClusterParaDialog.java:1833)
........
------------------------------

这个问题困扰了小弟很久,希望众大虾们帮着做个试验,看看到底是不
是JRE的问题,还是小弟代码写得不当所至。



作者 Re:JOptionPane的奇怪出错 [Re:cxp108]
jameszhang



CJSDN高级会员


发贴: 1594
积分: 111
于 2003-10-15 19:30 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
是你的内部类调的,JOptionPane 已经不属于了ClusterParaDialog ,是不是因为这个呢?


"First they ignore u, then they laugh at u, then they fight u, then u will win

Mahatma Gandhi"

作者 Re:JOptionPane的奇怪出错 [Re:cxp108]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2003-10-15 22:06 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
I suspect that it's an infinite loop, like a cat chasing his own tail. Saw something similar before. You call swing classes and swing classes call your classes.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923