Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public Hashtable<String, String> login(JFrame frame) {
  2. Hashtable<String, String> logininformation = new Hashtable<String, String>();
  3.  
  4. JPanel panel = new JPanel(new BorderLayout(5, 5));
  5.  
  6. JPanel label = new JPanel(new GridLayout(0, 1, 2, 2));
  7. label.add(new JLabel("E-Mail", SwingConstants.RIGHT));
  8. label.add(new JLabel("Password", SwingConstants.RIGHT));
  9. panel.add(label, BorderLayout.WEST);
  10.  
  11. JPanel controls = new JPanel(new GridLayout(0, 1, 2, 2));
  12. JTextField username = new JTextField();
  13. controls.add(username);
  14. JPasswordField password = new JPasswordField();
  15. controls.add(password);
  16. panel.add(controls, BorderLayout.CENTER);
  17.  
  18. JOptionPane.showMessageDialog(frame, panel, "login", JOptionPane.QUESTION_MESSAGE);
  19.  
  20. logininformation.put("user", username.getText());
  21. logininformation.put("pass", new String(password.getPassword()));
  22. return logininformation;
  23. }
  24.  
  25. JOptionPane.showConfirmDialog(
  26. frame, panel, "login", JOptionPane.OK_CANCEL_OPTION);
  27.  
  28. jButton1.addActionListener(new ActionListener() {
  29. public void actionPerformed(ActionEvent e){
  30. frameName.dispose();
  31. }
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement