Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. import javax.swing.*;
  2. public class frame{
  3. public static void main(String[] args){
  4.  
  5. String username= "marko";
  6. String password ="12345";
  7. JFrame frame= new JFrame("registration");
  8. ImageIcon icon = new ImageIcon("C:/Users/mars/Desktop/reddit.png");
  9. frame.setIconImage(icon.getImage());
  10.  
  11.  
  12. JTextField[] fields= {new JTextField(), new JTextField()};
  13. Object[] surface = {"Username", fields[0], "password", field[1]};
  14.  
  15. int click= JOptionPane.showConfirmDialog(frame,surface, "Reddit
  16. registration",2,2,icon);
  17.  
  18. String eusername= fields[0].getText();
  19. String epassword= fields[1].getText();
  20.  
  21. if ((click == 0) & (username==eusername) & (password==epassword))
  22. {
  23. JOptionPane.showMessageDialog(null,"Thank you very
  24. much","registration",2,icon);
  25. }
  26.  
  27. else
  28. {
  29. JOptionPane.showMessageDialog(null,"Please try again",
  30. "entry","registration",2,icon);
  31. }
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement