use super.paintComponent(g) or getGraphics() in java
i' m little bit confused about few things: Example code,that shows my problem,this isn't compilable // image private BufferedImage image; private Graphics2D graphic; private changeImage; . . . //thread loop while (running) { . . . render(); Graphics showGraphic = getGraphics(); showGraphic.drawImage(image, 0, 0, null); showGraphic.dispose(); } public void render(){ if(changeImage == 1) graphic.drawImage(ImageLoader.TREE, 0, 0, null); else if(changeImage == 2){ graphic.drawImage(ImageLoader.HOUSE, 0, 0, null); . . . graphic.fillRect(50,60,30,40); } } I create an global object Graphic2D and i