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 tindertutor;
- import javafx.application.Application;
- import javafx.geometry.Insets;
- import javafx.geometry.Pos;
- import javafx.scene.Scene;
- import javafx.scene.control.Alert;
- 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.HBox;
- import javafx.scene.layout.VBox;
- import javafx.scene.paint.Color;
- import javafx.stage.Stage;
- /**
- *
- * @author adamoc
- */
- // This is the starting page on which it launches from
- public class TinderTutorMain extends Application {
- public static void main(String[] args) {
- launch(args);
- }
- Stage window;
- Scene scene2;
- Scene scene1;
- @Override
- public void start(Stage primaryStage) {
- //Setting up the primaryStage to be switchable
- window = primaryStage;
- //Restricting the posibility of making screen bigger
- window.setResizable(false);
- //Declaring all our objects that need to go on scene
- ImageView image = new ImageView(new Image(getClass().getResourceAsStream("Assets/TinderTutorLogo.png"),220,220,true,true));
- Button btnLogin = new Button("Login");
- Button btnSignUp = new Button("Sign Up");
- Button btnLinkedIN = new Button("Linked In");
- Button btnFacebook = new Button("Facebook");
- Button btnGooglePlus = new Button("Google +");
- //Adding all Button functionality in lambda expressions
- btnLogin.setOnAction(e -> {
- TinderTutorLogin tinderTutorLogin = new TinderTutorLogin();
- Label lblSignIn = new Label("Sign in to your account");
- lblSignIn.setTextFill(Color.RED);
- TextField txtUsername = new TextField();
- PasswordField txtPassword = new PasswordField();
- txtUsername.setMaxWidth(340);
- txtPassword.setMaxWidth(340);
- Label forgotPass = new Label("Forgot Your password ?");
- Button btnLoginReal = new Button("Login");
- btnLoginReal.setStyle("-fx-background-radius: 20px; -fx-padding: 4 65; -fx-background-color: #ef5350; -fx-text-fill: white; -fx-font-weight: bold");
- tinderTutorLogin.LoginView(image, lblSignIn, txtUsername, txtPassword, forgotPass, btnLoginReal).setMargin(lblSignIn , new Insets(-40 ,0 ,0,0));
- scene2 = new Scene(tinderTutorLogin.LoginView(image, lblSignIn, txtUsername, txtPassword, forgotPass, btnLoginReal) , 600 ,700);
- window.setScene(scene2);
- btnLoginReal.setOnAction(event -> {
- if(txtUsername.getText().equals("Adam")&& txtPassword.getText().equals("1234")){
- TinderTutorMainSwipe tinderTutorSwipe = new TinderTutorMainSwipe();
- Button btnSettings = new Button("Settings");
- ImageView logoView = new ImageView(new Image(getClass().getResourceAsStream("Assets/TinderTutorLogo.png"),220,220,true,true));
- Button btnChat= new Button("Chat");
- ImageView mainPicView = new ImageView();
- Label lblUsers_Name= new Label("Username : ");
- Label lblUsers_Qualification= new Label("Qualification: ");
- Label lblUsers_Subject= new Label("Subject: ");
- Label lblUsers_Location= new Label("Location: ");
- Label lblUsers_Price= new Label("Price: ");
- Button btnCheckYes= new Button("Yes");
- Button btnCheckNo = new Button("X");
- scene1 = new Scene(tinderTutorSwipe.SwipeView(btnSettings, logoView, btnChat, mainPicView, lblUsers_Name, lblUsers_Qualification, lblUsers_Subject, lblUsers_Location, lblUsers_Price, btnCheckYes, btnCheckNo) , 600 , 700);
- window.setScene(scene1);
- } else {
- Alert helpAlert = new Alert(Alert.AlertType.WARNING, "Please enter correct login details");
- helpAlert.setTitle("Error");
- helpAlert.showAndWait();
- }
- });
- });
- // Setting the images position
- HBox imagePos = new HBox(image);
- imagePos.setAlignment(Pos.CENTER);
- imagePos.setMargin(image , new Insets(-50 ,0,0,0));
- //Setting the Buttons positions
- HBox buttonsPos = new HBox(btnLogin , btnSignUp);
- buttonsPos.setAlignment(Pos.CENTER);
- buttonsPos.setSpacing(20);
- buttonsPos.setMargin(btnLogin, new Insets(-30,0,30,0));
- buttonsPos.setMargin(btnSignUp, new Insets(-30,0,30,0));
- //Setting the social buttons positions
- VBox socialButtons = new VBox(20, btnLinkedIN , btnFacebook , btnGooglePlus);
- socialButtons.setAlignment(Pos.CENTER);
- //Setting up the VBox to take everything put it on itself and then add to the scene which is added to the stage
- VBox root = new VBox(imagePos , buttonsPos , socialButtons);
- root.setAlignment(Pos.CENTER);
- //Setting up the scene
- Scene scene = new Scene(root , 600 , 700);
- //Setting up the stage
- primaryStage.setTitle("Tutor Tinder");
- primaryStage.setScene(scene);
- primaryStage.show();
- }
- }
- // This is the Login view
- /*
- * 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 tindertutor;
- import javafx.event.ActionEvent;
- import javafx.event.EventHandler;
- import javafx.geometry.Pos;
- import javafx.scene.Scene;
- import javafx.scene.control.Alert;
- import javafx.scene.control.Alert.AlertType;
- 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.VBox;
- import javafx.stage.Stage;
- import javax.swing.JOptionPane;
- /**
- *
- * @author adamoc
- */
- public class TinderTutorLogin {
- public VBox LoginView(ImageView imageview ,Label lblSignIn , TextField txtUsername , PasswordField txtPassword , Label forgotPass , Button btnLoginReal){
- VBox layout = new VBox(20);
- layout.setAlignment(Pos.CENTER);
- layout.getChildren().addAll(imageview ,lblSignIn , txtUsername , txtPassword , forgotPass ,btnLoginReal);
- return layout;
- }
- }
- //This is the Main App page
- /*
- * 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 tindertutor;
- import javafx.geometry.Pos;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.image.ImageView;
- import javafx.scene.layout.HBox;
- import javafx.scene.layout.VBox;
- /**
- *
- * @author adamoc
- */
- public class TinderTutorMainSwipe{
- public VBox SwipeView(Button btnSettings , ImageView logoView , Button btnChat , ImageView mainPicView , Label lblUsers_Name , Label lblUsers_Qualification , Label lblUsers_Subject , Label lblUsers_Location , Label lblUsers_Price , Button btnCheckYes , Button btnCheckNo ){
- // HBox topSwipeView = new HBox(btnSettings , logoView , btnChat);
- // VBox middleSwipeView = new VBox(mainPicView ,lblUsers_Name, lblUsers_Qualification , lblUsers_Subject , lblUsers_Location , lblUsers_Price );
- // HBox bottomSwipeView = new HBox(btnCheckYes , btnCheckYes);
- VBox overallLayout = new VBox(20);
- overallLayout.setAlignment(Pos.CENTER);
- overallLayout.getChildren().addAll(btnSettings , logoView , btnChat,mainPicView ,lblUsers_Name, lblUsers_Qualification , lblUsers_Subject , lblUsers_Location , lblUsers_Price ,btnCheckYes , btnCheckYes);
- return overallLayout;
- }
- /**
- * @param args the command line arguments
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement