-
-
Save mojtab23/2d4de6118d101db786496565b3427b4c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javafx.application.Application; | |
import javafx.fxml.FXMLLoader; | |
import javafx.scene.Parent; | |
import javafx.scene.Scene; | |
import javafx.stage.Stage; | |
public class Main extends Application { | |
@Override | |
public void start(Stage primaryStage) throws Exception{ | |
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); | |
primaryStage.setTitle("Hello World"); | |
primaryStage.setScene(new Scene(root)); | |
primaryStage.show(); | |
} | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<?import javafx.geometry.Insets?> | |
<?import javafx.scene.control.Label?> | |
<?import javafx.scene.layout.AnchorPane?> | |
<?import javafx.scene.layout.HBox?> | |
<?import javafx.scene.layout.StackPane?> | |
<StackPane maxWidth="1000.0" minHeight="-Infinity" minWidth="100.0" prefWidth="1000.0" style="-fx-border-color: black; -fx-border-width: 2px;" xmlns="http://javafx.com/javafx/8.0.102-ea" xmlns:fx="http://javafx.com/fxml/1"> | |
<children> | |
<Label text="This is StackPane" StackPane.alignment="TOP_LEFT"> | |
<StackPane.margin> | |
<Insets /> | |
</StackPane.margin> | |
</Label> | |
<HBox maxHeight="-Infinity" maxWidth="600.0" minHeight="-Infinity" minWidth="-Infinity" prefWidth="600.0" spacing="500.0" style="-fx-border-width: 2px; -fx-border-color: red;" StackPane.alignment="CENTER"> | |
<children> | |
<Label text="This is HBox (parent=StackPane) with maxWidth = 600" /> | |
</children> | |
</HBox> | |
<AnchorPane maxWidth="600.0" minHeight="50.0" minWidth="100.0" prefHeight="200.0" prefWidth="600.0" style="-fx-border-color: green; -fx-border-width: 2px;"> | |
<children> | |
<Label text="This is AnchorPane (parent=StackPane) with maxWidth = 600" /> | |
<Label layoutX="491.0" layoutY="54.0" text="This label has left anchor = 700" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="700.0" /> | |
</children> | |
<StackPane.margin> | |
<Insets bottom="40.0" top="40.0" /> | |
</StackPane.margin> | |
</AnchorPane> | |
</children> | |
</StackPane> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment