Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to repaint a window (stage) in JAVA FX 2.2

I need to repaint a window on selection of a combobox element. How to repaint a window (stage) in JAVA FX 2.2?

Below is my code

functionComboBox.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, 0, 0, 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);
    }
});
like image 760
user1660156 Avatar asked Oct 25 '12 08:10

user1660156


1 Answers

Since your code adds new components to the pane on runtime, maybe you need:

pane.requestLayout();
like image 114
amru Avatar answered Oct 04 '22 04:10

amru