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!

How to use a label in Java?

796315Dec 20 2009 — edited Dec 22 2009
Hi. Does anyone know how to add a label to jframe so I can display some text? I am asking this because I have a program where it displays text when clicking on certain regions but the text appears behind the background image. How can I make the text I want to display appear on top and not behind the bgimage?

This is text I am using to test it and diplay a text :

String message="";
..........
g.drawString(message,50,50);
.................
if(xxxx>=whole_flag.getX() && yyyy>=whole_flag.getY()){message = "You clicked on the flag";}


Thanks in advance.


PS: I am not using an Applet.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 19 2010
Added on Dec 20 2009
15 comments
443 views