JPanel Problem =/ Question(My Code Provided)

Alright thanks, question about the Button class.

I know this sounds stupid but I don’t quite understand the mouse methods ><, where are we getting the input from? And what is the int button for?

public void paint(Graphics g) {
super.paint(g);

    bg = new ImageIcon("Trees!.png").getImage();
    g.drawImage(bg, 0,0,null);   

Graphics2D g2d = (Graphics2D)g;
g2d.drawImage(spO.getImage(), spO.getX(), spO.getY(), this);

    Toolkit.getDefaultToolkit().sync();
    g.dispose();

}

You were missing a ‘g’ on the object name g2d, as marked. This might be your issue.

@JayTech
Sorry for not seeing your post earlier, the input methods should be called from you mouse listeners. The into button is the button number that causes the event, MouseEvent.BUTTON1-3.

Was on vacation(Actually didn’t bring my computer) just got back onto the forums, thanks for all of the responses . ra4king ah, I gotcha makes sense now thanks =).

Edit: the 2d some how cut off the g when I pasted the code onto here.