It is easy to create JoptionPane equivalent in Javafx2.0.
Here is a custom Component:
Here is a custom Component:
import javafx.stage.*;
import javafx.scene.*;
import javafx.scene.paint.Color;
import javafx.scene.control.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
public class ModalDialog {
Button Button b1,b2;
public ModalDialog(final Stage stg) {
final Stage dialog = new Stage();
dialog.setTitle("Confirm Before Exit");
dialog.setResizable(false);
// dialog.initOwner(Demoslide.getPrimaryStage());
dialog.initModality(Modality.APPLICATION_MODAL);
FlowPane buttons = new FlowPane(10,10);
buttons.setAlignment(Pos.CENTER);
Button yes = new Button("Yes");
Button no = new Button("No");
buttons.getChildren().addAll(yes, no);
VBox box = new VBox();
box.setAlignment(Pos.CENTER);
box.setSpacing(10);
box.getChildren().addAll(new Label("Successfully login "), buttons);
Scene s = new Scene(box);
dialog.setScene(s);
dialog.show();
}
}
Why create b1 and b2 if you aren't going to use them
ReplyDelete