title: Filling a HUD in Java
body: <p><img src="https://i.stack.imgur.com/jDciY.gif" alt="The HUD In need of fillling"></p>
  
  <p>I've decided on making a HUD with the picture above, but I don't know what command in Java I need to use so as I can fill the top half and the bottom half separately.<br><br>
  I only know how to use the <code>g.fillRect();</code> command, and it will take around twenty of these commands to fill said half. </p>
  
  <pre><code>public class HUD {
  
      private Player player;
      private BufferedImage image;
      private Font font;
      private Font font2;
      private  int Phealth = Player.getHealth();
  
      public HUD(Player p) {
          player = p;
          try {
              image = ImageIO.read(getClass().getResourceAsStream("/HUD/HUD_TEST.gif"));
              font = new Font("Arial", Font.PLAIN, 10);
              font2 = new Font("SANS_SERIF", Font.BOLD, 10);
          }
          catch(Exception e) {
              e.printStackTrace();
          }
      }
  
      public void draw(Graphics2D g) {
  
          g.drawImage(image, 0,  10,  null);
          g.setFont(font2);
          g.setColor(Color.black);
          g.drawString("Health:", 30, 22);
          g.drawString("Mana:", 25, 47);
          g.setFont(font);
          g.drawString(Player.getHealth() + "/" + player.getMaxHealth(), 64, 22);
          g.drawString(player.getCubes() / 100 + "/" + player.getMaxCubes() / 100, 55, 47);
          g.setColor(Color.red);
          g.fillRect(1, 25, Phealth * 25, 4);
          g.setColor(Color.blue);
          g.fillRect(1, 31, player.getCubes() / 33, 4);
      }
  }
  </code></pre>
  
  <p>This is the code for the HUD so far.<br>
  Any help in filling the shape will help. </p>