Buongiorno a tutti! Ho un problema con il metodo root.getChildren().addAll(...).
Mi da il seguente errore:codice:import java.awt.TextField; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class Prova2 extends Application { @Override public void start(Stage stage) throws Exception { Label name = new Label("name:"); TextField tf = new TextField(); Button ok = new Button("OK"); Button cancel = new Button ("Cancel"); HBox root = new HBox(10); root.getChildren().addAll(name,tf,ok,cancel); root.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;" + "-fx-border-width: 2;" + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" + "-fx-border-color: blue"); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Using HBox"); stage.show(); } public static void main(String[] args){ launch(args); } }
The method addAll(int, Collection<? extends Node>) in the type List<Node> is not applicable for the arguments (Label, TextField, Button, Button)
Non riesco a capire, la classe Node contiene sia Label, sia Button, siaTextField. Mi sono dimenticata qualche libreria in particolare?