SHARE
TWEET

Untitled

a guest Dec 8th, 2019 119 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import javafx.scene.paint.*;
  2. import javafx.application.Application;
  3. import java.applet.Applet;
  4. import javafx.scene.paint.Color;
  5. import java.awt.Graphics;
  6. import javafx.geometry.Pos;
  7. import javafx.geometry.HPos;
  8. import javafx.scene.Scene;
  9. import javafx.scene.text.Text;
  10. import javafx.scene.control.Button;
  11. import javafx.scene.control.Label;
  12. import javafx.scene.control.TextField;
  13. import javafx.scene.layout.GridPane;
  14. import javafx.stage.Stage;
  15. import javafx.scene.canvas.*;
  16. import javafx.scene.web.*;
  17. import java.io.*;
  18. import javafx.scene.Group;
  19. import javafx.scene.layout.*;
  20. import javafx.scene.control.*;
  21. import javafx.scene.image.*;
  22. import javafx.geometry.*;
  23. import javafx.scene.layout.HBox;
  24. import javafx.scene.effect.DropShadow;
  25. import javafx.scene.effect.Shadow;
  26. import javafx.scene.shape.Rectangle;
  27.  
  28. import java.io.FileInputStream;
  29. import java.io.FileNotFoundException;
  30.  
  31. public class Login extends Application{ //implements EventHandler<ActionEvent>{
  32.     private Stage stage;
  33.     private Scene scene;
  34.     String UserIn;
  35.     String PassIn;
  36.    
  37.  
  38.    
  39.     Text username = new Text("Username");
  40.     Text password = new Text("Password");
  41.    
  42.    
  43.     Button Log = new Button("Login");
  44.     Button forgot = new Button("Forgot Password?");
  45.  
  46.     TextField user = new TextField();
  47.     TextField pass = new TextField();
  48.     //Color color = new Color.rgb(199, 234, 70);
  49.     Label success = new Label();
  50.    
  51.     @Override
  52.     public void start(Stage stage) throws FileNotFoundException{
  53.        
  54.        
  55.         ///
  56.         GridPane gridPane = new GridPane();
  57.         Scene scene = new Scene(gridPane, 800, 600);
  58.         Rectangle rectangle = new Rectangle(); 
  59.        
  60.         //Color
  61.         int red = 118;
  62.         int green = 186;
  63.         int blue = 27;
  64.         //End Color
  65.         rectangle.setX(0.0f);
  66.         rectangle.setY(0.0f);
  67.         rectangle.setWidth(400.0f);
  68.         rectangle.setHeight(800.0f);
  69.         rectangle.setFill(Color.rgb(red,green,blue, 0.67));
  70.        
  71.         //gridPane.add(rectangle, 200, 0);
  72.        
  73.        
  74.  
  75.         gridPane.setVgap(2);
  76.         gridPane.setHgap(2);
  77.         gridPane.add(user, 250, 120);
  78.         gridPane.add(pass, 250, 130);
  79.         gridPane.add(username, 250,  115);
  80.         gridPane.add(password, 250, 125);
  81.         gridPane.add(Log, 251, 140);
  82.         gridPane.add(forgot, 250, 140);
  83.         gridPane.add(success, 250, 145);
  84.         //ACTIONS
  85.         Log.setOnAction(e -> login());
  86.         forgot.setOnAction(e->forgotP());
  87.        
  88.         //Image image = new Image(new FileInputStream("/Users/walte/Downloads/BiggerVision.jpg"));
  89.         //ImageView imageView = new ImageView(image);
  90.        
  91.         //gridPane.add(imageView, 0, 0);
  92.         stage.setTitle("Bigger Vision Login");
  93.         stage.setScene(scene);
  94.  
  95.         stage.show();
  96.     }
  97.    
  98.     public void login(){
  99.         String UserIn = user.getText();
  100.         String PassIn = pass.getText();
  101.         if(UserIn.equals("login")){
  102.             if(PassIn.equals("password")){
  103.                 success.setText("You have successfully logged in");
  104.                
  105.                 System.exit(0);
  106.                
  107.             }
  108.             else{
  109.                 success.setText("Your username or password is incorrect");
  110.             }
  111.         }
  112.         else{
  113.             success.setText("Your username or password is incorrect");
  114.         }
  115.     }
  116.     public void forgotP(){
  117.         System.exit(0);
  118.     }
  119.  
  120.    
  121.     public static void main(String args[]){
  122.         launch(args);
  123.     }
  124. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top