texture = TextureIO.newTexture(file);
texture = TextureIO.newTexture(file, true);
  public void display(GLAutoDrawable drawable) {    GL gl = drawable.getGL();    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);    if (flushTexture) {      flushTexture = false;      if (texture != null) {        texture.dispose();        texture = null;      }    }    if (newTexture) {      newTexture = false;      if (texture != null) {        texture.dispose();        texture = null;      }      try {        System.err.println("Loading texture...");        texture = TextureIO.newTexture(file);      } catch (IOException e) {        e.printStackTrace();        ByteArrayOutputStream bos = new ByteArrayOutputStream();        e.printStackTrace(new PrintStream(bos));        JOptionPane.showMessageDialog(null,                                      bos.toString(),                                      "Error loading texture",                                      JOptionPane.ERROR_MESSAGE);        return;      }    }    if (texture != null) {      texture.enable();      gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);      texture.bind();      TextureCoords coords = texture.getImageTexCoords();      gl.glBegin(GL.GL_QUADS);      gl.glTexCoord2f(coords.left(), coords.bottom());      gl.glVertex3f(0, 0, 0);      gl.glTexCoord2f(coords.right(), coords.bottom());      gl.glVertex3f(1, 0, 0);      gl.glTexCoord2f(coords.right(), coords.top());      gl.glVertex3f(1, 1, 0);      gl.glTexCoord2f(coords.left(), coords.top());      gl.glVertex3f(0, 1, 0);      gl.glEnd();      texture.disable();    }  }