title: My pixels won't draw in the places I've put them
body: <p>I'm trying to draw individual pixels to the screen using a BufferStrategy but when I run the program all the pixels are displayed werid, it's supposed to make 1 square in the top left, but it makes multiple squares that have black lines in between them instead.</p>
  
  <p>Display Class    </p>
  
  <pre><code>import java.awt.Canvas;
  import java.awt.Graphics;
  import java.awt.image.BufferStrategy;
  import java.awt.image.BufferedImage;
  import java.awt.image.DataBufferInt;
  
  import javax.swing.JFrame;
  
  import graphics.Render;
  
  public class Display extends Canvas implements Runnable {
  
  public static final int HEIGHT = 600;
  public static final int WIDTH = 800;
  public static final String TITLE = "Minefront Pre-Alpha 0.01";
  
  private Thread thread;
  private Screen screen;
  private BufferedImage img;
  private Render render;
  private int[] pixels;
  public boolean running = false;
  
  public Display()
  {
      screen = new Screen(WIDTH, HEIGHT);
      img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
      pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
  }
  
  public void start() {
      if (running)
          return;
      running = true;
      thread = new Thread(this);
      thread.start();
  
      System.out.println("Working");
  }
  
  public void stop() {
      if (!running)
          return;
      running = false;
      try {
          thread.join();
      } catch (InterruptedException e) {
          e.printStackTrace();
          System.exit(0);
      }
  }
  
  public static void main(String args[]) {
      Display game = new Display();
      JFrame frame = new JFrame();
      frame.add(game);
      frame.pack();
      frame.setSize(WIDTH, HEIGHT);
      frame.setTitle(TITLE);
      frame.setLocationRelativeTo(null);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setResizable(false);
      frame.setVisible(true);
  
      game.start();
  
  }
  
  @Override
  public void run() {
      while(running)
      {
          tick();
          render();
      }
  }
  
  private void render() {
      BufferStrategy bs = this.getBufferStrategy();
      if(bs == null)
      {
          createBufferStrategy(3);
          return;
      }
  
      screen.render();
  
      for (int i = 0; i &lt; WIDTH * HEIGHT; i++) {
          pixels[i] = screen.pixels[i];
      }
  
      Graphics g = bs.getDrawGraphics();
      g.drawImage(img, 0, 0, WIDTH, HEIGHT, null);
      g.dispose();
      bs.show();
  }
  
  private void tick() {
  
  }
  }
  </code></pre>
  
  <p>Render Class</p>
  
  <pre><code>public class Render {
  public final int width;
  public final int height;
  public final int[] pixels;
  
  public Render(int Height, int Width) {
      this.height = Height;
      this.width = Width;
      pixels = new int[Height * Width];
  }
  
  public void draw(Render render, int xOffset, int yOffset) {
      for (int y = 0; y &lt; render.height; y++) {
          int ypix = y + yOffset;
          for (int x = 0; x &lt; render.width; x++) {
              int xpix = x + xOffset;
  
              pixels[xpix + (ypix * width)] = render.pixels[x + (y * render.width)];
          }
      }
  }
  }
  </code></pre>
  
  <p>Screen Class</p>
  
  <pre><code>import graphics.Render;
  
  public class Screen extends Render {
  
  public int Size = 150;
  public int Color = 0;
  public int R = 0;
  public int G = 0;
  public int B = 0;
  
  private Render test;
  
  public Screen(int Height, int Width) {
      super(Height, Width);
      test = new Render(Size, Size);
      for (int i = 0; i &lt; Size * Size; i++) {
          Color = RGBtoInt(R, G, B);
          test.pixels[i] = Color;
          R++;
          if (i % 100 == 0 || i % 100 == 1 || i % 100 == 2 || i % 100 == 99 || i % 100 == 98) {
              test.pixels[i] = 16777215;
          } else if (i % 25 == 0 || i % 25 == 1 || i % 25 == 2 || i % 25 == 24 || i % 25 == 23) {
              test.pixels[i] = 3328255;
          } else if (R &gt; 255) {
              R = 0;
              G++;
              if (G &gt; 255) {
                  G = 0;
                  B++;
                  if (B &gt; 255) {
                      B = 0;
                  }
              }
          }
      }
  }
  
  private int RGBtoInt(int R, int G, int B) {
      R = (R &lt;&lt; 16) &amp; 0x00FF0000;
      G = (G &lt;&lt; 8) &amp; 0x0000FF00;
      B = B &amp; 0x000000FF;
  
      return 0xFF000000 | R | G | B;
  }
  
  public void render() {
      draw(test,0,0);
  }
  
  }
  </code></pre>
  
  <p>If you know what's happening let me know, thanks.</p>