public void drawArrow(Graphics myBuffer, int time, Arrow arrow) { int x; int y = (int) ((arrow.startTime - time) * scaling); if (arrow instanceof LeftArrow) { x = 0; myBuffer.drawImage(leftArrowImg, x, y, null); } else if (arrow instanceof RightArrow) { x = 150; myBuffer.drawImage(rightArrowImg, x, y, null); } else if (arrow instanceof UpArrow) { x = 300; myBuffer.drawImage(upArrowImg, x, y, null); } else { x = 450; myBuffer.drawImage(downArrowImg, x, y, null); } // myBuffer.setColor(Color.black); // myBuffer.drawLine(0,0,x,y); // Image img = Toolkit.getDefaultToolkit().getImage("arrowB down.png"); myBuffer.finalize(); }
public void paintComponent(Graphics g) { g.drawImage(myImage, 0, 0, getWidth(), getHeight(), null); }