Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Resizing issues? FXML, Scene Builder, etc

KonradZuseJan 5 2013 — edited Jan 31 2013
So I'm trying to use create an area for objects that move, but when they hit the sides it should collision detect and bounce off. Now I noticed I cannot resize components or containers in Scene Builder, as well as I cannot find how to even SET re-sizing on anything. I know there is isResizable(); and such. I also found the api stating that Class Group has a method called autoResize something that you can set; however I am using
         Parent root = FXMLLoader.load(getClass().getResource("Zonk.fxml")); 
which is autoset in Netbeans IDE. if I change Parent to it's subclass Group It works; however when I run it I get a funky error.
Exception in Application start method
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at com.javafx.main.Main.launchApp(Main.java:642)
	at com.javafx.main.Main.main(Main.java:805)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:403)
	at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
	at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
	at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassCastException: javafx.scene.layout.AnchorPane cannot be cast to javafx.scene.Group
	at Zonk.start(Zonk.java:25)
	at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
	at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
	at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
	at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
	... 1 more
Java Result: 1
Basically it seems like above is saying that I cannot use an AnchorPane in Group; however when looking at the API http://docs.oracle.com/javafx/2/api/javafx/scene/Parent.html you can see the subClass "Base Control" is what deals with the containers, but seems like the "fancier" ones it seems since Parent can apparently work with AnchorPanes... I don't know why Group wouldn't work then... Doesn't make much sense but okay... Is there anything in Scene builder that WOULD work with Group so I could set this off, or again is there any other way to fix the re-sizing issue that i might not have to change to Group?

Thanks all!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 28 2013
Added on Jan 5 2013
11 comments
5,532 views