Professional Documents
Culture Documents
Proj
Proj
Proj
Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
b1.setOnAction(new EventHandler<ActionEvent>() {
public void handle(ActionEvent event) {
String title = "";
String title2 = "";
if (opt1.isSelected()) {
title = "Mr.";
title2 = "His";
} else if (opt2.isSelected()) {
title = "Ms.";
title2 = "Her";
}
String title3 = "";
if (c1.isSelected()) {
title3 += c1.getText() + ",";
}
if (c2.isSelected()) {
title3 += c2.getText() + "";
}
if (c3.isSelected()) {
title3 += c3.getText() + "";
}
String title4 = "";
if (r1.isSelected()) {
title4 = "Single";
}
if (r2.isSelected()) {
title4 = "Married";
}
if (r3.isSelected()) {
title4 = "Widow";
}
if (r4.isSelected()) {
title4 = "Divorced";
}
String Summary;
Summary = (title + " " + t1.getText() + " " + "is earning Rs." +
t3.getText()
+ " in a month! and " + title2 + " Marital status is " +
title4 + ".." + title2
+ " Hobbies are " + title3);
t4.setText(Summary);
}
});
t1.setOnKeyTyped(new EventHandler<KeyEvent>() {
root.getChildren().addAll(l1, t1, l2, opt1, opt2, l3, t3, l6, r1, r2, r3,
r4, l4, c1, c2, c3, l5, t4, b1);
primaryStage.setTitle("Project 1");
primaryStage.setScene(scene);
primaryStage.show();
}