-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMain30.java
More file actions
45 lines (34 loc) · 1.23 KB
/
Main30.java
File metadata and controls
45 lines (34 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package JavaFXDemo;
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class Main30 extends Application {
Stage window;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
window = primaryStage;
window.setTitle("thenewboston");
//Input and labels
TextField userInput = new TextField();
userInput.setMaxWidth(200);
Label firstLabel = new Label("Welcome to the site ");
Label secondLabel = new Label();
HBox bottomText = new HBox(firstLabel, secondLabel);
bottomText.setAlignment(Pos.CENTER);
VBox vBox = new VBox(10, userInput, bottomText);
vBox.setAlignment(Pos.CENTER);
secondLabel.textProperty().bind(userInput.textProperty()); //binds what ever the user type in to the second
//label which is the welcome label.
Scene scene = new Scene(vBox, 300, 200);
window.setScene(scene);
window.show();
}
}