Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fi.utu.tech.gui.javafx.teht3;
- import fi.utu.tech.gui.javafx.ResourceLoader;
- import javafx.geometry.Pos;
- import javafx.scene.control.Label;
- import javafx.scene.control.TextField;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.BorderPane;
- import javafx.scene.layout.HBox;
- import javafx.scene.layout.VBox;
- import javafx.scene.paint.Color;
- import javafx.scene.shape.Circle;
- public class OtherWindow extends BorderPane {
- public OtherWindow() {
- Circle c = new Circle(200, Color.NAVY);
- //setCenter(c);
- setLeft(new ImageView(ResourceLoader.image("hmm.png")));
- Label terve = new Label("Terve");
- Label maailma = new Label("Maailma");
- setTop(terve);
- setAlignment(terve, Pos.TOP_CENTER);
- double tFieldW = c.getRadius()*2/3;
- TextField tf1 = new TextField();
- tf1.setPrefWidth(tFieldW);
- TextField tf2 = new TextField();
- tf2.setPrefWidth(tFieldW);
- TextField tf3 = new TextField();
- tf3.setPrefWidth(tFieldW);
- tf1.textProperty().addListener((observable, oldVal, newVal) -> {tf2.setText(newVal); tf3.setText(newVal);});
- tf2.textProperty().addListener((observable, oldVal, newVal) -> {tf1.setText(newVal); tf3.setText(newVal);});
- tf3.textProperty().addListener((observable, oldVal, newVal) -> {tf2.setText(newVal); tf1.setText(newVal);});
- HBox hb = new HBox(0, tf1, tf2, tf3);
- VBox vb = new VBox(5, maailma, c, hb);
- vb.setAlignment(Pos.BASELINE_CENTER);
- setAlignment(vb, Pos.CENTER);
- setCenter(vb);
- System.out.println("OtherWindow created.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement