Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javafx.application.Application;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.stage.Stage;
- public class FXMLExample extends Application{
- @Override
- public void start(Stage stage) throws Exception {
- Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
- Scene scene = new Scene(root, 300, 275);
- stage.setTitle("FXML Welcome");
- stage.setScene(scene);
- stage.show();
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
- <GridPane xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10">
- <padding>
- <Insets top="25" right="25" bottom="10" left="25" />
- </padding>
- <Text id="welcome-text" text="Welcome" GridPane.columnIndex="0"
- GridPane.rowIndex="0" GridPane.columnSpan="2" />
- <Label text="User Name:" GridPane.columnIndex="0"
- GridPane.rowIndex="1" />
- <TextField GridPane.columnIndex="1" GridPane.rowIndex="1" />
- <Label text="Password:" GridPane.columnIndex="0"
- GridPane.rowIndex="2" />
- <PasswordField GridPane.columnIndex="1"
- GridPane.rowIndex="2" />
- <HBox spacing="10" alignment="bottom_right" GridPane.columnIndex="1"
- GridPane.rowIndex="4">
- <Button text="Sign In"/>
- </HBox>
- <Text fx:id="actiontarget" GridPane.columnIndex="0"
- GridPane.columnSpan="2" GridPane.halignment="RIGHT" GridPane.rowIndex="6" />
- </GridPane>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement