GeezerVison is showing github.com — FXML · SF5/Source-Code-from-Tutorials@eb5678b
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +package sample; |
| 2 | + |
| 3 | +import javafx.fxml.Initializable; |
| 4 | +import java.net.URL; |
| 5 | +import java.util.ResourceBundle; |
| 6 | + |
| 7 | +public class Controller implements Initializable { |
| 8 | + |
| 9 | + @Override |
| 10 | + public void initialize(URL location, ResourceBundle resources) { |
| 11 | + System.out.println("View is now loaded!"); |
| 12 | + } |
| 13 | + |
| 14 | +} |
Collapse file
Copy file name to clipboard +24Lines changed: 24 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +package sample; |
| 2 | + |
| 3 | +import javafx.application.Application; |
| 4 | +import javafx.fxml.FXMLLoader; |
| 5 | +import javafx.scene.Parent; |
| 6 | +import javafx.scene.Scene; |
| 7 | +import javafx.stage.Stage; |
| 8 | + |
| 9 | +public class Main extends Application { |
| 10 | + |
| 11 | + public static void main(String[] args) { |
| 12 | + launch(args); |
| 13 | + } |
| 14 | + |
| 15 | + @Override |
| 16 | + public void start(Stage primaryStage) throws Exception{ |
| 17 | + Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); |
| 18 | + primaryStage.setTitle("Hello World"); |
| 19 | + primaryStage.setScene(new Scene(root, 300, 275)); |
| 20 | + primaryStage.show(); |
| 21 | + } |
| 22 | + |
| 23 | + |
| 24 | +} |
Collapse file
Copy file name to clipboard +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<?import javafx.scene.control.*?> |
| 3 | +<?import javafx.scene.layout.*?> |
| 4 | + |
| 5 | +<VBox prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml" |
| 6 | + fx:controller="sample.Controller"> |
| 7 | + |
| 8 | + <Label text="I love bacon"/> |
| 9 | + <Button text="Submit"/> |
| 10 | + |
| 11 | +</VBox> |