Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPanel over a JLabel with a background (Icon).. Not opaque?

800413Apr 15 2010 — edited Apr 15 2010
Dear forum users.

Im trying to make a game, and at the moment im having a problem with letting a JLabel with a background being disiplayed.

The label itself, with its content works great.
The problem is when i clear the JPanel that is over the JLabel, (g.clearRect), its like it removed the opaque, or fills the JPanel with standard color..
        g.clearRect(0, 0, getSize().width, getSize().height);

        if (parent.getCurrentMap() != null) {
            parent.getCurrentMap().draw(g, viewInvis);
        }

        if (selectedElement != null) {
            selectedElement.draw(g, mousePosition.x, mousePosition.y);
        }
It works fine as long as i dont call repaint on the JPanel..

Anyone know why this happend? Or how i can get past it?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2010
Added on Apr 15 2010
5 comments
137 views