[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.technology.albireo] Re: CTRL-C stack overflow
|
Hey all,
It's been a while. I am still using my modified version of the original
article code. I was wondering if anyone has experienced problems with
ctrl+x crashing the VM. It seems to be unrelated to the ctrl+c problem I
had before.
Anyone? Anyone?
-James
"James Peltzer" <canadianguy@xxxxxxxxx> wrote in message
news:fej2em$2oi$1@xxxxxxxxxxxxxxxxxxxx
> I have noticed an interesting problem when you are using a Swing editor.
> In a text field in the editor, hit CTRL-C. Open another editor. Watch
the
> stack overflow errors pile up.
>
> Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
> at java.util.Arrays.mergeSort(Arrays.java:1270)
> at java.util.Arrays.sort(Arrays.java:1210)
> at java.util.Collections.sort(Collections.java:159)
> at
>
javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTr
> aversalPolicy.java:119)
> at
>
javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraver
> salPolicy.java:434)
> at
>
javax.swing.LayoutFocusTraversalPolicy.getFirstComponent(LayoutFocusTraversa
> lPolicy.java:148)
> at
>
javax.swing.DefaultFocusManager.getFirstComponent(DefaultFocusManager.java:9
> 9)
> at
>
javax.swing.LegacyGlueFocusTraversalPolicy.getFirstComponent(LegacyGlueFocus
> TraversalPolicy.java:115)
> at
>
javax.swing.LegacyGlueFocusTraversalPolicy.getDefaultComponent(LegacyGlueFoc
> usTraversalPolicy.java:133)
> at
>
javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraver
> salPolicy.java:447)
> ...
>
> I was able to fix this by moving the focus policy from the frame down to
the
> JApplet. I notice your article code says to 'consider' this in its
> comments, is there any reason why you didn't do it?
>
> -James
>
> Modified code (inside addRootPaneContainer):
> ...
> JApplet applet = new JApplet();
>
> // In JRE 1.4, the JApplet makes itself a focus cycle root. This
> // interferes with the focus handling installed on the parent
frame,
> so
> // change it back to a non-root here.
> // TODO: consider moving the focus policy from the Frame down to
the
> JApplet
>
> EmbeddedChildFocusTraversalPolicy policy = new
> EmbeddedChildFocusTraversalPolicy(awtHandler);
> applet.setFocusTraversalPolicy(policy);
> frame.add(applet);
>
> return applet;
>
>