title: Using setLocation to move the JFrame around Windows, Java
body: <p>I am trying to move a <code>JFrame</code> around in Windows using 5 buttons (North, East, South, West, and Centre) At the moment all the current code is in place and it works when using;</p>
  
  <pre><code>public void actionPerformed(ActionEvent e)
  {
      if(e.getSource()==northButton)
      {
         setLocation(500,500);
      }
  
  } //works
  
  public void actionPerformed(ActionEvent e)
  {
      if(e.getSource()== northButton)
      {
         setLocation(north);
      }
  
  } //doesn't work
  </code></pre>
  
  <p>However as part of the task I need to use the Java Toolkit to <code>getScreenSize</code> width and height and using calculations to work out the boundaries of the screen and send 'north' to <code>setLocation()</code> (like above). However, using this method  it throws an error <code>"No suitable method found"</code> I'm unsure of how to fix this. The calculation code is below just for north at the moment.</p>
  
  <pre><code>int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width;
  int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height;
  
  int width = this.getWidth();
  int height = this.getHeight();
  
  int north = ((screenWidth - width)/2);
  </code></pre>
  
  <p>Any help will be greatly appreciated.
  Thanks!</p>