Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public class login {
  2. private String username;
  3. private String password;
  4.  
  5. public String getUsername() {
  6. return username;
  7. }
  8. public void setUsername(String username) {
  9. this.username = this.usernameTextField.getText();
  10. }
  11. public String getPassword() {
  12. return password;
  13. }
  14. public void setPassword(String password) {
  15. this.password = this.passwordTextField.getText();
  16. }
  17. }
  18.  
  19. private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
  20. String msg= tx.getText();
  21. new NewJFrame2(msg).setVisible(true);
  22. }
  23.  
  24. public NewJFrame2(String abc ){
  25. initComponents();
  26. lx.setText(abc);
  27. }
  28.  
  29. The 100% working sollution
  30. -----------------------------
  31.  
  32. for login.java
  33. ----------------
  34. suppose u r calling welcome.java:
  35. Account ac= new Account(new JFrame(), true);
  36. after this line call a method of welcome.java which u have to create like:
  37. wc.setUser(username);
  38.  
  39. for account.java
  40. ------------------
  41.  
  42. create a method:void setUser(String username) {
  43. user1 = user;
  44. cname.setText(user1);
  45. }
  46.  
  47. user1 is global variable and available for all which u have to define lke:
  48. String user1;
  49. after it is assigning the username value to user1
  50. here cname is a label which name is cname;
  51. so, we are seeting the text of cname to the user.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement