Duplicate :
|
We are seeing unexpected/undesirable behavior when using a Swing InputVerifier. The following demo application has an InputVerifier associated with a JTextField. It also has a JComboBox and a JTable to show the interaction of an InputVerifier with components other than JTextField. The InputVerifier warns the user with a modal message box when they have typed more than 3 letters in the JTextField. If I attempt to run it against 1.4-beta3, I get a stack overflow in attempting to open the JOptionPane from the shouldYieldFocus implementation. java -version java version "1.4.0-rc" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b88) Java HotSpot(TM) Client VM (build 1.4.0-rc-b88, mixed mode) For instance, -- Run InputVerifierTest -- Type five characters in the JTextField. -- Click on the JComboBox. -- You see the following error java.lang.StackOverflowError at java.awt.Component.getToolkitImpl(Component.java:823) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkitImpl(Component.java:827) at java.awt.Component.getToolkit(Component.java:813) at java.awt.Component.addNotify(Component.java:5363) at java.awt.Container.addNotify(Container.java:1855) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at java.awt.Container.addNotify(Container.java:1862) at javax.swing.JComponent.addNotify(JComponent.java:4273) at javax.swing.JRootPane.addNotify(JRootPane.java:661) at java.awt.Container.addNotify(Container.java:1862) at java.awt.Window.addNotify(Window.java:398) at java.awt.Dialog.addNotify(Dialog.java:389) I have attached the complete stack trace in the attachments section.