import
javafx.application.Application;
import
javafx.scene.Scene;
import
javafx.scene.control.*;
import
javafx.scene.layout.*;
import
javafx.stage.Stage;
import
javafx.scene.layout.*;
import
javafx.scene.paint.*;
import
javafx.scene.text.*;
import
javafx.geometry.*;
import
javafx.scene.layout.*;
import
javafx.scene.shape.*;
import
javafx.collections.*;
import
javafx.event.ActionEvent;
import
javafx.event.EventHandler;
public
class
Alignment_1
extends
Application {
public
void
start(Stage stage)
{
try
{
stage.setTitle(
"Alignment"
);
TextFlow text_flow =
new
TextFlow();
Text text_1 =
new
Text(
"GeeksforGeeks\n"
);
text_1.setFill(Color.GREEN);
text_1.setFont(Font.font(
"Verdana"
,
25
));
Text text_2 =
new
Text(
"How many times were you frustrated "
+
"while looking out for a good "
+
"collection of programming/algorithm/ "
+
"interview questions? What did you "
+
"expect and what did you get? "
+
"This portal has been created to "
+
"provide well written, well "
+
"thought and well explained solutions "
+
"for selected questions."
);
text_2.setFill(Color.BLUE);
text_2.setFont(Font.font(
"Helvetica"
,
FontPosture.ITALIC,
15
));
text_flow.getChildren().add(text_1);
text_flow.getChildren().add(text_2);
String weight[] = {
"CENTER"
,
"JUSTIFY"
,
"LEFT"
,
"RIGHT"
};
ComboBox combo_box =
new
ComboBox(FXCollections.observableArrayList(weight));
EventHandler<ActionEvent> event =
new
EventHandler<ActionEvent>()
{
public
void
handle(ActionEvent e)
{
text_flow.setTextAlignment(TextAlignment.valueOf(
(String)combo_box.getValue()));
}
};
combo_box.setOnAction(event);
text_flow.setTextAlignment(TextAlignment.CENTER);
text_flow.setLineSpacing(
20
.0f);
VBox vbox =
new
VBox(combo_box, text_flow);
vbox.setAlignment(Pos.CENTER);
Scene scene =
new
Scene(vbox,
400
,
300
);
stage.setScene(scene);
stage.show();
}
catch
(Exception e) {
System.out.println(e.getMessage());
}
}
public
static
void
main(String args[])
{
launch(args);
}
}