Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package tindertutor;
  7.  
  8. import javafx.application.Application;
  9. import javafx.geometry.Insets;
  10. import javafx.geometry.Pos;
  11. import javafx.scene.Scene;
  12. import javafx.scene.control.Alert;
  13. import javafx.scene.control.Button;
  14. import javafx.scene.control.Label;
  15. import javafx.scene.control.PasswordField;
  16. import javafx.scene.control.TextField;
  17. import javafx.scene.image.Image;
  18. import javafx.scene.image.ImageView;
  19. import javafx.scene.layout.HBox;
  20. import javafx.scene.layout.VBox;
  21. import javafx.scene.paint.Color;
  22. import javafx.stage.Stage;
  23.  
  24. /**
  25. *
  26. * @author adamoc
  27. */
  28.  
  29.  
  30. // This is the starting page on which it launches from
  31.  
  32.  
  33. public class TinderTutorMain extends Application {
  34. public static void main(String[] args) {
  35. launch(args);
  36. }
  37.  
  38. Stage window;
  39. Scene scene2;
  40. Scene scene1;
  41.  
  42. @Override
  43. public void start(Stage primaryStage) {
  44.  
  45. //Setting up the primaryStage to be switchable
  46. window = primaryStage;
  47.  
  48. //Restricting the posibility of making screen bigger
  49. window.setResizable(false);
  50.  
  51. //Declaring all our objects that need to go on scene
  52. ImageView image = new ImageView(new Image(getClass().getResourceAsStream("Assets/TinderTutorLogo.png"),220,220,true,true));
  53. Button btnLogin = new Button("Login");
  54. Button btnSignUp = new Button("Sign Up");
  55. Button btnLinkedIN = new Button("Linked In");
  56. Button btnFacebook = new Button("Facebook");
  57. Button btnGooglePlus = new Button("Google +");
  58.  
  59. //Adding all Button functionality in lambda expressions
  60. btnLogin.setOnAction(e -> {
  61. TinderTutorLogin tinderTutorLogin = new TinderTutorLogin();
  62. Label lblSignIn = new Label("Sign in to your account");
  63. lblSignIn.setTextFill(Color.RED);
  64. TextField txtUsername = new TextField();
  65. PasswordField txtPassword = new PasswordField();
  66. txtUsername.setMaxWidth(340);
  67. txtPassword.setMaxWidth(340);
  68. Label forgotPass = new Label("Forgot Your password ?");
  69. Button btnLoginReal = new Button("Login");
  70. btnLoginReal.setStyle("-fx-background-radius: 20px; -fx-padding: 4 65; -fx-background-color: #ef5350; -fx-text-fill: white; -fx-font-weight: bold");
  71. tinderTutorLogin.LoginView(image, lblSignIn, txtUsername, txtPassword, forgotPass, btnLoginReal).setMargin(lblSignIn , new Insets(-40 ,0 ,0,0));
  72. scene2 = new Scene(tinderTutorLogin.LoginView(image, lblSignIn, txtUsername, txtPassword, forgotPass, btnLoginReal) , 600 ,700);
  73. window.setScene(scene2);
  74.  
  75. btnLoginReal.setOnAction(event -> {
  76. if(txtUsername.getText().equals("Adam")&& txtPassword.getText().equals("1234")){
  77.  
  78. TinderTutorMainSwipe tinderTutorSwipe = new TinderTutorMainSwipe();
  79. Button btnSettings = new Button("Settings");
  80. ImageView logoView = new ImageView(new Image(getClass().getResourceAsStream("Assets/TinderTutorLogo.png"),220,220,true,true));
  81. Button btnChat= new Button("Chat");
  82. ImageView mainPicView = new ImageView();
  83. Label lblUsers_Name= new Label("Username : ");
  84. Label lblUsers_Qualification= new Label("Qualification: ");
  85. Label lblUsers_Subject= new Label("Subject: ");
  86. Label lblUsers_Location= new Label("Location: ");
  87. Label lblUsers_Price= new Label("Price: ");
  88. Button btnCheckYes= new Button("Yes");
  89. Button btnCheckNo = new Button("X");
  90. scene1 = new Scene(tinderTutorSwipe.SwipeView(btnSettings, logoView, btnChat, mainPicView, lblUsers_Name, lblUsers_Qualification, lblUsers_Subject, lblUsers_Location, lblUsers_Price, btnCheckYes, btnCheckNo) , 600 , 700);
  91. window.setScene(scene1);
  92.  
  93. } else {
  94. Alert helpAlert = new Alert(Alert.AlertType.WARNING, "Please enter correct login details");
  95. helpAlert.setTitle("Error");
  96. helpAlert.showAndWait();
  97. }
  98. });
  99. });
  100. // Setting the images position
  101. HBox imagePos = new HBox(image);
  102. imagePos.setAlignment(Pos.CENTER);
  103. imagePos.setMargin(image , new Insets(-50 ,0,0,0));
  104.  
  105. //Setting the Buttons positions
  106. HBox buttonsPos = new HBox(btnLogin , btnSignUp);
  107. buttonsPos.setAlignment(Pos.CENTER);
  108. buttonsPos.setSpacing(20);
  109. buttonsPos.setMargin(btnLogin, new Insets(-30,0,30,0));
  110. buttonsPos.setMargin(btnSignUp, new Insets(-30,0,30,0));
  111.  
  112. //Setting the social buttons positions
  113. VBox socialButtons = new VBox(20, btnLinkedIN , btnFacebook , btnGooglePlus);
  114. socialButtons.setAlignment(Pos.CENTER);
  115.  
  116. //Setting up the VBox to take everything put it on itself and then add to the scene which is added to the stage
  117. VBox root = new VBox(imagePos , buttonsPos , socialButtons);
  118. root.setAlignment(Pos.CENTER);
  119.  
  120. //Setting up the scene
  121. Scene scene = new Scene(root , 600 , 700);
  122.  
  123. //Setting up the stage
  124. primaryStage.setTitle("Tutor Tinder");
  125. primaryStage.setScene(scene);
  126. primaryStage.show();
  127.  
  128.  
  129.  
  130. }
  131.  
  132.  
  133. }
  134.  
  135.  
  136. // This is the Login view
  137.  
  138. /*
  139. * To change this license header, choose License Headers in Project Properties.
  140. * To change this template file, choose Tools | Templates
  141. * and open the template in the editor.
  142. */
  143. package tindertutor;
  144.  
  145.  
  146.  
  147. import javafx.event.ActionEvent;
  148. import javafx.event.EventHandler;
  149. import javafx.geometry.Pos;
  150. import javafx.scene.Scene;
  151. import javafx.scene.control.Alert;
  152. import javafx.scene.control.Alert.AlertType;
  153. import javafx.scene.control.Button;
  154. import javafx.scene.control.Label;
  155. import javafx.scene.control.PasswordField;
  156. import javafx.scene.control.TextField;
  157. import javafx.scene.image.Image;
  158. import javafx.scene.image.ImageView;
  159. import javafx.scene.layout.VBox;
  160. import javafx.stage.Stage;
  161. import javax.swing.JOptionPane;
  162.  
  163. /**
  164. *
  165. * @author adamoc
  166. */
  167. public class TinderTutorLogin {
  168.  
  169. public VBox LoginView(ImageView imageview ,Label lblSignIn , TextField txtUsername , PasswordField txtPassword , Label forgotPass , Button btnLoginReal){
  170.  
  171. VBox layout = new VBox(20);
  172. layout.setAlignment(Pos.CENTER);
  173. layout.getChildren().addAll(imageview ,lblSignIn , txtUsername , txtPassword , forgotPass ,btnLoginReal);
  174.  
  175.  
  176.  
  177. return layout;
  178.  
  179. }
  180.  
  181.  
  182.  
  183. }
  184.  
  185.  
  186. //This is the Main App page
  187.  
  188. /*
  189. * To change this license header, choose License Headers in Project Properties.
  190. * To change this template file, choose Tools | Templates
  191. * and open the template in the editor.
  192. */
  193. package tindertutor;
  194.  
  195. import javafx.geometry.Pos;
  196. import javafx.scene.control.Button;
  197. import javafx.scene.control.Label;
  198. import javafx.scene.image.ImageView;
  199. import javafx.scene.layout.HBox;
  200. import javafx.scene.layout.VBox;
  201.  
  202. /**
  203. *
  204. * @author adamoc
  205. */
  206. public class TinderTutorMainSwipe{
  207. 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 ){
  208. // HBox topSwipeView = new HBox(btnSettings , logoView , btnChat);
  209. // VBox middleSwipeView = new VBox(mainPicView ,lblUsers_Name, lblUsers_Qualification , lblUsers_Subject , lblUsers_Location , lblUsers_Price );
  210. // HBox bottomSwipeView = new HBox(btnCheckYes , btnCheckYes);
  211.  
  212. VBox overallLayout = new VBox(20);
  213. overallLayout.setAlignment(Pos.CENTER);
  214. overallLayout.getChildren().addAll(btnSettings , logoView , btnChat,mainPicView ,lblUsers_Name, lblUsers_Qualification , lblUsers_Subject , lblUsers_Location , lblUsers_Price ,btnCheckYes , btnCheckYes);
  215.  
  216. return overallLayout;
  217.  
  218. }
  219.  
  220.  
  221. /**
  222. * @param args the command line arguments
  223. */
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement