piccolo2d / piccolo2d.java

Structured 2D Graphics Framework
http://piccolo2d.org
Other
51 stars 14 forks source link

PFrame throws IllegalComponentException #130

Closed mro closed 9 years ago

mro commented 9 years ago

Originally reported on Google Code with ID 130

What steps will reproduce the problem?
1. Run CameraExample, or any other example that uses PFrame

What is the expected output? What do you see instead?
Expect to see the example appear, instead we obtain an Exception:

Exception in thread "main" java.awt.IllegalComponentStateException:
contentPane cannot be set to null.
    at javax.swing.JRootPane.setContentPane(JRootPane.java:603)
    at javax.swing.JFrame.setContentPane(JFrame.java:676)
    at edu.umd.cs.piccolox.PFrame.<init>(PFrame.java:129)
    at edu.umd.cs.piccolox.PFrame.<init>(PFrame.java:93)
    at edu.umd.cs.piccolo.examples.CameraExample.<init>(CameraExample.java:55)
    at edu.umd.cs.piccolo.examples.CameraExample.<init>(CameraExample.java:51)
    at edu.umd.cs.piccolo.examples.CameraExample.main(CameraExample.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

Reported by reids%colorado.edu@gtempaccount.com on 2009-10-10 02:10:03

mro commented 9 years ago
The problematic snippet of code is:

        if (canvas == null) {
            this.canvas = new PCanvas();
        }
        else {
            this.canvas = canvas;
        }

        setContentPane(canvas);

Note that even if canvas is null, it is still being set as the content pane.

This bug was introduced in r698 "More CheckStyle Stuff"

Reported by reids%colorado.edu@gtempaccount.com on 2009-10-10 02:14:57

mro commented 9 years ago
Resolution committed in r702.

Reported by reids%colorado.edu@gtempaccount.com on 2009-10-10 02:22:10

mro commented 9 years ago
Reassigning to allain.lalonde to verify the and close.  Are there any other
situations where this bug could have been introduced recently as part of CheckStyle
fixes?

Reported by reids%colorado.edu@gtempaccount.com on 2009-10-10 02:23:43

mro commented 9 years ago

Reported by reids%colorado.edu@gtempaccount.com on 2009-10-10 02:24:11

mro commented 9 years ago
Totally my bad. :(

Reported by allain.lalonde on 2009-10-10 04:29:38