Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package starting;
- import java.awt.Color;
- import javafx.application.Application;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.geometry.Pos;
- import javafx.scene.Scene;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.PasswordField;
- import javafx.scene.control.TextField;
- import javafx.scene.image.Image;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.BackgroundImage;
- import javafx.scene.layout.GridPane;
- import javafx.scene.layout.HBox;
- import javafx.scene.layout.StackPane;
- import javafx.scene.layout.VBox;
- import javafx.stage.Stage;
- /**
- *
- * @author Susmi
- */
- public class Starting extends Application {
- @Override
- public void start(Stage primaryStage) {
- Button btn = new Button();
- Button exit = new Button();
- btn.setText("Game");
- exit.setText("Exit");
- exit.setOnAction(e->{
- System.exit(0);
- });
- Label label1 =new Label("WELCOME");
- //for the first scene
- VBox root = new VBox();
- //StackPane root=new StackPane();
- Image image=new Image("newstart.jpg");
- ImageView i=new ImageView(image);
- root.getChildren().add(i);
- //VBox root=new VBox();
- root.setAlignment(Pos.CENTER);
- root.getChildren().addAll(label1,btn, exit);
- //root.getChildren().add(btn);
- //StackPane root1=new StackPane();
- //Scene scene1 = new Scene(root, 500, 281);
- Scene scene1 = new Scene(root, 1200, 700);
- //2nd page button
- Button btn1 = new Button();
- btn1.setText("Back");
- btn1.setOnAction(e-> {
- primaryStage.setScene(scene1);
- });
- //2nd scene layout
- StackPane root1=new StackPane();
- //Button btn1=new Button("Login");
- //GridPane root1=new GridPane();
- Image image1=new Image("newstart.jpg");
- ImageView i1=new ImageView(image1);
- root1.getChildren().add(i1);
- root1.setAlignment(Pos.CENTER);
- /*root1.setVgap(10);
- root1.setHgap(10);
- Label username=new Label("Username");
- Label password=new Label("Password");
- root1.add(username,0,0);
- root1.add(password,0,1);
- TextField user=new TextField();
- PasswordField pass=new PasswordField();
- root1.add(user, 1, 0);
- root1.add(pass, 1, 1);
- HBox hbox=new HBox();
- hbox.getChildren().add(btn1);
- hbox.setAlignment(Pos.CENTER_RIGHT);
- //root1.add(hbox, 1, 2);*/
- root1.getChildren().add(btn1);
- Scene scene2 = new Scene(root1, 1200, 700);
- btn.setOnAction(e-> {
- primaryStage.setScene(scene2);
- });
- primaryStage.setTitle("Hello World!");
- primaryStage.setScene(scene1);
- primaryStage.show();
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement