title: GUI box handler java game
body: <p>SO, I am making a game in java and I have the basics done, now I am working on the GUI. What I was thinking of doing was making a GUI class that holds all of the arraylists. Then I want to create a new class for all of the different types of GUIs, GUIbox, GUIstats, stuff like that. I am really having troubles with putting this into code,all I have so far is the code below:</p>
  
  <p>GUI class:</p>
  
  <pre><code>public class GUI {
  ArrayList&lt;GUIbox&gt; guiBoxes = new ArrayList&lt;GUIbox&gt;();
  
  public GUI() { }
  
  public GUIbox getBoxByID(int id) {
      for(int i=0; i&lt;guiBoxes.size(); i++) {
          if(guiBoxes.get(i).getId() == id) {
          return guiBoxes.get(i);
          }
          }
      return null;
  
     }
  }
  </code></pre>
  
  <p>And the GUI box class (32 by 32 sized box that needs an x and y, an id, and the id of the item inside the box):</p>
  
  <pre><code>public class GUIbox {
  
  protected float x, y;
  protected int itemID;
  private int id;
  
  
  
      public GUIbox(int id, float x, float y, int itemID) {
      this.id = id;
      this.x = x;
      this.y = y;
      this.itemID = itemID;
      }
  
      public float getX() {
          return x;
      }
  
      public float getY() {
          return y;
      }
  
      public int getId() {
          return id;
      }
  
  }
  </code></pre>
  
  <p>So, what would be the most productive way to do this? In the end all I want to have to do is initiate the box GUIbox box1 = new GUIbox(boxId, x, y, itemID). And I want to be able to change what is in the box with something like changeContents(boxID, itemID). Maybe even a method to see what itemID is in what box.</p>
  
  <p>Any help is appreciated, thank you. :)</p>