Hey so i have a class that extends a JFrame with an image of mickey mouse and a piece of cheese. I have made it so the user can control Mickey and I want to have it so that when he touches the boundaries of the cheese a YOU WIN string is displayed on top of the JFrame without disrupting any of the background....I can figure out that logic.


HOWEVER my problems is that I cant even get text, or any string to be displayed on my JFrame. any help? I can provide my code, but I think an epxlanation could be done w/o it and it would just complicate things.

cheers,
-James

There is a class JLabel that you can use to add text. You can hide a JLabel containing the text "YOU WIN" (setVisible(false)) and when the bounds of the image intersect to ones of the cheese, then you can make it visible again (setVisible(true)).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.