Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class login {
- private String username;
- private String password;
- public String getUsername() {
- return username;
- }
- public void setUsername(String username) {
- this.username = this.usernameTextField.getText();
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(String password) {
- this.password = this.passwordTextField.getText();
- }
- }
- private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
- String msg= tx.getText();
- new NewJFrame2(msg).setVisible(true);
- }
- public NewJFrame2(String abc ){
- initComponents();
- lx.setText(abc);
- }
- The 100% working sollution
- -----------------------------
- for login.java
- ----------------
- suppose u r calling welcome.java:
- Account ac= new Account(new JFrame(), true);
- after this line call a method of welcome.java which u have to create like:
- wc.setUser(username);
- for account.java
- ------------------
- create a method:void setUser(String username) {
- user1 = user;
- cname.setText(user1);
- }
- user1 is global variable and available for all which u have to define lke:
- String user1;
- after it is assigning the username value to user1
- here cname is a label which name is cname;
- so, we are seeting the text of cname to the user.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement