How to redraw the window (stage) in Java FX 2.2
•
Java
I need to redraw a window when selecting combo box elements
Here is my code
functionCombo@R_683_2419@.valueproperty().addListener(new changelistener<String>() { @Override public void changed(ObservableValue ov,String t,String t1) { showFunctionParamters(t1); } private void showFunctionParamters(String methodName) { gridPaneParameters = new GridPane(); gridPaneParameters.setPadding(new Insets(20,50)); gridPaneParameters.setHgap(10); gridPaneParameters.setVgap(4); int i = 2; parameterList = methodAttrMap.get(methodName); Iterator<String> itrParameterList = parameterList.iterator(); while(itrParameterList.hasNext()) { //TODO allow the user to enter the values for the parameters Label parameterName = new Label(itrParameterList.next()); TextField parameterTextField = new TextField(); gridPaneParameters.add(parameterName,1,i); gridPaneParameters.add(parameterTextField,2,i); i++; } pane.getChildren().add(gridPaneParameters); } });
Solution
Because your code adds new components to the pane at run time, you may need to:
pane.requestLayout();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码