This is what I have in the main class:
public static void main(String[] args) {
final login login = new login();
login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
login.setVisible(true);
login.setResizable(false);
login.btnEnter.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
login.inputText.getText();
new crosswordWindow().setVisible(true);
login.dispose();
}
});
}
*there is a third class called login, where the jTextField is.
The login.inputText.getText(); should set the value in this JLabel (in the class called crosswordWindow):
public class crosswordWindow extends JFrame {
...
public crosswordWindow() {
...
userName = new JLabel(userName.setText(login.inputText.getText()));
}
}
But I get this error "non-static variable inputText cannot be referenced from a static context, void type not allowed here"
What am I doing wrong?