@Override
public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Java Project");
Scene scene;
//File chooser
FileChooser fileChooser = new FileChooser();
Button button = new Button("Select Network File");
button.setOnAction(e -> {
String selectedFile = fileChooser.showOpenDialog(primaryStage).toString();
Path file = Paths.get(selectedFile);
System.out.println(file);
});
//Checkboxes
Checkbox intBox = new Checkbox("Add interaction:");
Checkbox degBox = new Checkbox("Get degree of node:");
//Layout
VBox layout = new VBox(10);
layout.getChildren().addAll(button, intBox, degBox);
layout.setAlignment(Pos.CENTER);
primaryStage.setScene(scene);
primaryStage.show();
}
}
on the .addAll()
line, I'm getting error: The method addAll(int, Collection<? extends Node>) in the type List<Node> is not applicable for the arguments (Button, Checkbox, Checkbox
But I'm not extending Node anywhere? the Main class extends Application.
This is the Node
class:
package application;
public class Node {
public String name;
public Node() {
this.name = "";
}
public Node(String n) {
this.name = n;
}
public String printName() {
return name;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Node other = (Node) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
}
Aucun commentaire:
Enregistrer un commentaire