title: Java: cannot access static variable from a different class in the same package
body: <p>This is quite odd, because I have a Character class that can access Frame.dimension.getWidth(); and its partner getHeight(), however when I wanted to use this in the Map class eclipse underlines it and cannot give me feedback. Running the program anyways ends up in java errors stating they can't find the X value of a Map object.</p>
  
  <p>Here's the Frame class:</p>
  
  <pre><code>package Core;
  
  import java.awt.Dimension;
  import java.awt.Rectangle;
  import javax.swing.JFrame;
  
  
  public class Frame
  {
  static int width = 800, height = 600;
  static Dimension dimension;
  
  public static void main(String[]args){
      JFrame frame= new JFrame("RETRO");
      frame.add(new Screen());
  
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setSize(width,height);
      frame.setVisible(true);
      frame.setResizable(false);
      dimension = frame.getContentPane().getSize();
  }
  }
  </code></pre>
  
  <p>And the Map class:</p>
  
  <pre><code>package Core;
  
  import java.awt.Frame;
  import java.awt.Image;
  import java.awt.Rectangle;
  import javax.swing.ImageIcon;
  import java.awt.Dimension;
  
  public class Map
  {
      double x, y;
  
  Image map;
  ImageIcon background = new ImageIcon("images/Maps/maze.jpg");
  
  public Map(){
      map = background.getImage();
  }
  
  public void move(double moveX, double moveY){
          x += moveX;
          y += moveY;
  }
  
  //////////Gets
  public Image getMap(){
      return map;
  }
  public double getX(){
      if(x&lt;0)
          x=0;
      else if(x&gt;Frame.dimension.getWidth())
          x=Frame.dimension.getWidth();
  
      return x;
  }
  
  public double getY(){
      if(y&lt;0)
          y=0;
      else if(y&gt;Frame.dimension.getHeight())
          y=Frame.dimension.getHeight();
  
      return y;
  }
  
  public int getHeight(){
      return map.getHeight(null);
  }
  
  public int getWidth(){
      return map.getWidth(null);
  }
  }
  </code></pre>
  
  <p>I could provide the Character class but it is very long and messy at the moment.. however the word Frame was only used in the calling of Frame.dimension.getWidth()/getHeight();</p>