javafx - How to resize WorldWind Panel? -
i want put worldwindowgljpanel
pane, , want make resizable, can't, when call resize
or setsize
method.
here's what i'm doing :
wwd = new worldwindowgljpanel(); wwd.setpreferredsize(new java.awt.dimension(300, 300)); wwd.setmodel(new basicmodel()); swingnode = new swingnode(); swingnode.setcontent(wwd); wwdpane = new pane(); wwdpane.getchildren().add(swingnode);
then use wwdpane
display world wind.
i want world wind panel
have size of pane contains it, , want make world wind panel
resizable.
i thought give size world wind panel
of pane
setsize(panedimenson)
, bind size of worldwindpanel pane , setsize
function doesn't work.
edit : found alternative solution not using pane, directly swingnode, resize automatic. if want use pane there's still problem, , you're force use group.
the setsize working, try code:
scene.widthproperty().addlistener(new changelistener<number>() { @override public void changed( observablevalue<? extends number> o, number b, number ) { platform.runlater(new runnable() { public void run() { wwd.setsize((int)(a.intvalue()*0.5), wwd.getheight()); } });
or java8
scene.widthproperty().addlistener((o,b,a)->platform.runlater(()-> wwd.setsize((int)(a.intvalue()*0.5), wwd.getheight())));
but couldn't make resize work in sample code, because swingnode somehow mess resizing, think should try solution advised here.
Comments
Post a Comment