GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaFX CSS · SF5/Source-Code-from-Tutorials@cd49f28

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • JavaFX/027_css
    • Main.java
    • Viper.css
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎JavaFX/027_css/Main.java‎

Copy file name to clipboard
+66Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import javafx.application.Application;
2+
import javafx.geometry.Insets;
3+
import javafx.scene.Scene;
4+
import javafx.scene.control.Button;
5+
import javafx.scene.control.Label;
6+
import javafx.scene.control.TextField;
7+
import javafx.scene.layout.GridPane;
8+
import javafx.stage.Stage;
9+
10+
public class Main extends Application {
11+
12+
Stage window;
13+
14+
public static void main(String[] args) {
15+
launch(args);
16+
}
17+
18+
@Override
19+
public void start(Stage primaryStage) throws Exception {
20+
window = primaryStage;
21+
window.setTitle("thenewboston - JavaFX");
22+
23+
//GridPane with 10px padding around edge
24+
GridPane grid = new GridPane();
25+
grid.setPadding(new Insets(10, 10, 10, 10));
26+
grid.setVgap(8);
27+
grid.setHgap(10);
28+
29+
//Name Label - constrains use (child, column, row)
30+
Label nameLabel = new Label("Username:");
31+
nameLabel.setId("bold-label");
32+
GridPane.setConstraints(nameLabel, 0, 0);
33+
34+
//Name Input
35+
TextField nameInput = new TextField("Bucky");
36+
GridPane.setConstraints(nameInput, 1, 0);
37+
38+
//Password Label
39+
Label passLabel = new Label("Password:");
40+
GridPane.setConstraints(passLabel, 0, 1);
41+
42+
//Password Input
43+
TextField passInput = new TextField();
44+
passInput.setPromptText("password");
45+
GridPane.setConstraints(passInput, 1, 1);
46+
47+
//Login
48+
Button loginButton = new Button("Log In");
49+
GridPane.setConstraints(loginButton, 1, 2);
50+
51+
//Sign up
52+
Button signUpButton = new Button("Sign Up");
53+
signUpButton.getStyleClass().add("button-blue");
54+
GridPane.setConstraints(signUpButton, 1, 3);
55+
56+
//Add everything to grid
57+
grid.getChildren().addAll(nameLabel, nameInput, passLabel, passInput, loginButton, signUpButton);
58+
59+
Scene scene = new Scene(grid, 300, 200);
60+
scene.getStylesheets().add("Viper.css");
61+
window.setScene(scene);
62+
window.show();
63+
}
64+
65+
66+
}
Collapse file

‎JavaFX/027_css/Viper.css‎

Copy file name to clipboard
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.root{
2+
-fx-background-color: #383838;
3+
}
4+
.label{
5+
-fx-text-fill: #e8e8e8;
6+
}
7+
.button{
8+
-fx-background-color: #AB4642;
9+
-fx-text-fill: #FFFFFF;
10+
-fx-background-radius: 4;
11+
}
12+
.button-blue{
13+
-fx-background-color: #7cafc2;
14+
-fx-text-fill: #FFFFFF;
15+
-fx-background-radius: 4;
16+
}
17+
#bold-label{
18+
-fx-font-weight: bold;
19+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.