Skip to main content

Painting of a JPanel (help I'm dumb and cannot do it!)

1 reply [Last post]
Joined: 2006-02-17

I have overridden the following method with:

<br />
protected void paintComponent(Graphics g)<br />
{<br />
        super.paintComponent(g);<br />
        Graphics2D g2 = (Graphics2D)g;<br />
        JigsawPiece tmp;</p>
<p>        while (hasNext())<br />
        {<br />
            tmp = nextJigsawPiece();<br />
            g2.drawImage(tmp.getPartialImage(), tmp.getRelativeXCoord(), tmp.getRelativeYCoord(), this);<br />
        }<br />
}<br />

When I load my program, nothing appears. I go to resize the window and the image appears, I move or resize the window again and it dissappears.

Pleeease help me,

Message was edited by: shan-man (Added [ code ] tags).

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-02-17

Hi gray_vegan,

Since you've posted the same message twice, I'm going to lock this one. That way all follow-ups can remain in one place.