This is what I have in the main class:

public static void main(String[] args) {

        final login login = new login();                            

        login.btnEnter.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e) {


            new crosswordWindow().setVisible(true);


*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?

What you are doing wrong, is not understanding the basics first.
login login = new login();

Right there is your problem. Naming conventions, which tell you it should have been:

Login login = new Login();

(which also would have solved your issue) aside: the JVM thinks you are calling it by the classname. Never give your instance the same name as your class. At the very least make sure the first character is lowercase in the variable name, and uppercase in the actual classname.

This article has been dead for over six months. Start a new discussion instead.