Advertisement
Guest User

Untitled

a guest
Feb 6th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.32 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Label;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.awt.peer.TextFieldPeer;
  6. import java.io.BufferedWriter;
  7. import java.io.FileOutputStream;
  8. import java.io.IOException;
  9. import java.io.OutputStreamWriter;
  10.  
  11. import javax.swing.JButton;
  12. import javax.swing.JFrame;
  13. import javax.swing.JLabel;
  14. import javax.swing.JPanel;
  15. import javax.swing.JTextField;
  16.  
  17. public class Window extends JFrame {
  18.  
  19.  
  20.     String [] textArray = new String [2];
  21.     public void  WindowOne(){
  22.         dataManager manage = new dataManager();
  23.         JFrame window = new JFrame();
  24.         window.setLayout(null);
  25.         window.setSize(400, 400);
  26.         window.setTitle("Window PasswordGenerator");
  27.         window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  28.         window.getContentPane().setBackground(Color.white);
  29.  
  30.         //Lable
  31.         JLabel lableOne = new JLabel();
  32.         lableOne.setText("Platform: ");
  33.         lableOne.setBounds(10, 10,100,30);
  34.         window.add(lableOne);
  35.  
  36.         JLabel lableTwo = new JLabel();
  37.         lableTwo.setText("Username: ");
  38.         lableTwo.setBounds(10, 50,100,30);
  39.         window.add(lableTwo);
  40.  
  41.         JLabel lableTree = new JLabel();
  42.         lableTree.setText("Password: ");
  43.         lableTree.setBounds(10, 90,100,30);
  44.         window.add(lableTree);
  45.  
  46.         //Textfield
  47.         JTextField textfieldOne= new JTextField();
  48.         textfieldOne.setBounds(85,10,150, 30);
  49.         window.add(textfieldOne);
  50.  
  51.         JTextField textfieldTwo= new JTextField();
  52.         textfieldTwo.setBounds(85,50,150, 30);
  53.         window.add(textfieldTwo);
  54.  
  55.         one classOne = new one();
  56.         JTextField textfieldTree = new JTextField();
  57.         textfieldTree.setBounds(85, 90, 150, 30);
  58.         textfieldTree.setText(manage.password(16));
  59.         window.add(textfieldTree);
  60.  
  61.         //Buttom
  62.         JButton buttom = new JButton("Rdy?");
  63.         buttom.setBounds(300, 30, 140, 40);
  64.         window.add(buttom);
  65.  
  66.  
  67.         boolean push = false;
  68.         buttom.addActionListener(new ActionListener() {
  69.             public void actionPerformed(ActionEvent e) {
  70.  
  71.                 boolean push = true;
  72.                 final String textfieldPlattform = textfieldOne.getText().toString();
  73.                 final String textfieldUsername = textfieldTwo.getText().toString();
  74.                 final String textfieldPassword = textfieldTree.getText().toString();
  75.                 try {
  76.                     manage.safe(textfieldPassword, textfieldPlattform, textfieldUsername);
  77.                 }catch(Exception E){
  78.                     System.out.println("Error");
  79.                 }
  80.  
  81.                 //String [] textArray = new String [2];
  82.                 //textArray [0] = textfieldPlattform;
  83.                 //textArray [1] = textfieldUsername;
  84.                 //textArray [2] = textfieldPassword;
  85.                 System.out.println("Rdy");
  86.  
  87.  
  88.  
  89.             }
  90.         });
  91.  
  92.         if(push!=false) {
  93.             final String textfieldPlattform = textfieldOne.getText().toString();
  94.             final String textfieldUsername = textfieldTwo.getText().toString();
  95.             final String textfieldPassword = textfieldTree.getText().toString();
  96.             System.out.println("true");
  97.         }
  98.  
  99.         window.setVisible(true);
  100.  
  101.  
  102.     }
  103.  
  104.  
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement