Exception in FocusTraversalOnArray

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Exception in FocusTraversalOnArray

Postby sommermartin » Tue Nov 27, 2007 3:55 pm

Using 6.5.0 version

simple jpanel with a bunch of buttons, two labels,
and two JtextAreas in Jscrollpanes

the Focus Policy is set to JtextArea 1 and 2



ception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.swtdesigner.FocusTraversalOnArray.cycle(FocusTraversalOnArray.java:59)
at com.swtdesigner.FocusTraversalOnArray.getComponentAfter(FocusTraversalOnArray.java:72)
at java.awt.Component.nextFocusHelper(Component.java:6695)
at java.awt.Container.nextFocusHelper(Container.java:3069)
at java.awt.Component.removeNotify(Component.java:5948)
at java.awt.Container.removeNotify(Container.java:2533)
at javax.swing.JComponent.removeNotify(JComponent.java:4485)
at javax.swing.JButton.removeNotify(JButton.java:202)
at java.awt.Container.removeNotify(Container.java:2527)
at javax.swing.JComponent.removeNotify(JComponent.java:4485)
at java.awt.Container.remove(Container.java:1114)
at javax.swing.JLayeredPane.remove(JLayeredPane.java:219)
at java.awt.Container.remove(Container.java:1172)
at javax.swing.JRootPane.setContentPane(JRootPane.java:559)
at javax.swing.JFrame.setContentPane(JFrame.java:609)
at com.ultramain.ereporting.controllers.Application.setPanel(Application.ja
sommermartin
 
Posts: 8
Joined: Wed Oct 03, 2007 12:23 pm

Re: Exception in FocusTraversalOnArray

Postby Eric Clayberg » Tue Nov 27, 2007 6:35 pm

We could not reproduce this.

Please provide a test case that will trigger this exception.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Exception in FocusTraversalOnArray - further feedback

Postby sommermartin » Wed Nov 28, 2007 7:33 am

Good,

I found the source code so I traced the problem, and I was able to work around it.

The traversal policy is set in the scroll pane (see below) and not to the main panel. Thus when the traversal policy is created some of the components are null.

But when I define the traversal policty in the property editor, I set it in the main panel and not in the scroll pane.

While it is easy to work around it by moving the code, I was wondering if this is something I can expect to be addressed.


thank you,

Martin

Code: Select all
    public JScrollPane getScrollPane() {
        if(scrollPane == null) {
            scrollPane = new JScrollPane();

            extrd = new ERPTTextArea();
            extrd.set_Label("Extra Comments");
            scrollPane.setViewportView(extrd);
            extrd.setName("extrd");
            setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[] { yesRadioButton, noRadioButton,
                    confidentialTextCheckBox, questionForSubjectCheckBox, extrd }));
        }
        return scrollPane;
    }
sommermartin
 
Posts: 8
Joined: Wed Oct 03, 2007 12:23 pm

Re: Exception in FocusTraversalOnArray - further feedback

Postby Eric Clayberg » Wed Nov 28, 2007 10:14 am

We still can't reproduce this. When I tried it, the focus traversal code was always generated in the main panel, and I could not find any combination of code generation settings that would make it appear somewhere else.

What code generation settings do you have in effect and what exact sequence of steps did you follow to get to the code you show.

Was any of that code hand written or was all of it generated by Designer?
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby sommermartin » Wed Nov 28, 2007 1:19 pm

Eric,

thank you for the reply. The code was all generated by the tool. I'll take a couple of days to get the screen shots and the settings, since we have tight delivery but I want to address this because we are telling our customers to buy the tool, so that they can modify the panels.

thank you much,

Martin
sommermartin
 
Posts: 8
Joined: Wed Oct 03, 2007 12:23 pm

Postby Eric Clayberg » Fri Nov 30, 2007 11:12 am

sommermartin wrote:thank you for the reply. The code was all generated by the tool. I'll take a couple of days to get the screen shots and the settings, since we have tight delivery but I want to address this because we are telling our customers to buy the tool, so that they can modify the panels

Did the code gen settings change mid development?

The example you posted appears to mix two different code gen styles (I would have expected extrd to have been generated into its own method).

To reproduce this, we will need to see a complete test case (rather than a single method).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest