CredentialsForm .java
public CredentialsForm()
{
btnGetSessionKey.addActionListener(new ButSesKeyListener());
btnGoToMessaging.addActionListener(new ButGoToMesListener());
btnGoToMessaging.setFont(new Font("Arial", Font.PLAIN, 12));
btnGetSessionKey.setFont(new Font("Arial", Font.PLAIN, 12));
lblAutomationId.setFont(new Font("Arial", Font.PLAIN, 12));
lblYouSessionKey.setFont(new Font("Arial", Font.PLAIN, 12));
lblEncryptionKey.setFont(new Font("Arial", Font.PLAIN, 12));
lblSingleSignOn.setFont(new Font("Arial", Font.PLAIN, 12));
lblUserName.setFont(new Font("Arial", Font.PLAIN, 12));
lblEmail.setFont(new Font("Arial", Font.PLAIN, 12));
tfGoToMessaging.setColumns(10);
tfGetSessionKey.setColumns(10);
tfEncryptionKey.setColumns(10);
tfSingleSignOn.setColumns(10);
tfUserName.setColumns(10);
tfEmail.setColumns(10);
tfAutomationId.setColumns(10);
initGUI();
}
答案 0 :(得分:1)
我无法访问setVisible()方法
在ActionListener中,您可以编写通用代码来访问当前窗口:
Component button = (Component)event.getSource();
Window window = SwingUtilities.windowForComponent(button);
window.setVisible(false);
答案 1 :(得分:0)
试试这个
public class FirstFrame extends JFrame {
// your all coding..
}
public class SecondFrame extends JFrame {
public static FirstFrame first;
public static void main(String[] a){
// show the first...
// anywhere you hide first using first.setVisible(false);
}
}