简体   繁体   中英

How to set login button go to next applet?

How to set the button to go to next applet? The code is like:

if (strp.matches(strp) && stru.matches(stru)) {
    register rg=new register();
    rg.setVisible(true);
    this.setVisible(false);
}
else {
    JOptionPane.showMessageDialog(null,"User name or password are not correct.");
    return;
}

After confirming the password and username, it only shows blank. How to set the applet so that after clicking button it will go to next applet?

Please try below...

if (strp.matches(strp) && stru.matches(stru))
{
    Class applet2 = Class.forName("register"); // give complete name of register class including package name
    Applet appletToLoad = (Applet)applet2.newInstance();
    appletToLoad.setStub(this);
    setLayout( new GridLayout(1,0));
    add(appletToLoad);
    appletToLoad.init();
    appletToLoad.start();
}
else
{
     JOptionPane.showMessageDialog(null,"User name or password are not correct.");
     return;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM