Reputation: 159
how could i open a dialog box in fxml controller as it requires stage
Dialogs.create()
.owner(---what should i write here---)
.title("Information Dialog")
.masthead("Look, an Information Dialog")
.message("I have a great message for you!")
.showInformation();
I have added following jar
controlsfx-8.0.6_20.jar
controlsfx-samples-8.0.6_20.jar
fxsampler-1.0.6_20.jar
Please help me.
Upvotes: 1
Views: 1030
Reputation: 6939
The owner is the stage that the Dialog windows will use.:
import org.controlsfx.dialog.Dialogs;
import javafx.application.Application;
import javafx.stage.Stage;
public class Diag extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
Dialogs.create()
.owner(primaryStage)
.title("Information Dialog")
.masthead("Look, an Information Dialog")
.message("I have a great message for you!")
.showInformation();
}
public static void main(String[] args) {
launch(args);
}
}
And as you may want to call it as a Dialog, you may as well call it as:
Dialogs.create()
.owner(new Stage())
.title("Information Dialog")
.masthead("Look, an Information Dialog")
.message("I have a great message for you!")
.showInformation();
Upvotes: 1