title: Non-static variable this cannot be referenced from a static context JFrame
body: <p>I have this code:</p>
  
  <pre><code>private static void inputGUI() {
      inputFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      inputFrame.setTitle("The INPUT");
      panel.add(printButton);
      printButton.setBounds(135,560,120,30);
      inputFrame.setLayout(null);
      inputFrame.add(panel);
      panel.setBounds(1000,100,366,768-100);
  
      //ActionListeners!!!    
      printButton.addActionListener(this);
      inputFrame.setSize(1366,768);
      inputFrame.setVisible(true);
  }
  </code></pre>
  
  <p>I wanted to add an action listener to my JButton named </p>
  
  <pre><code>printButton
  </code></pre>
  
  <p>I also have a JFrame </p>
  
  <pre><code>inputFrame
  </code></pre>
  
  <p>and this in my Main</p>
  
  <pre><code>public static void main (String[] args) {
      inputGUI();
  }
  </code></pre>
  
  <p>But I keep getting this error:</p>
  
  <pre><code>error: non-static variable this cannot be referenced from a static context
  </code></pre>
  
  <p>How can I do this? It would be great if you guys can help me without using an anonymous inner class.(My teacher hasn't taught us that lesson yet). Thank you!</p>