File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Adding Label on another Label Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding Label on another Label" Watch "Adding Label on another Label" New topic
Author

Adding Label on another Label

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Hi,
Is it possible to aa label over another label ?

Regards,
Satya
Balasubramanian Chandrasekaran
Ranch Hand

Joined: Nov 28, 2007
Posts: 215

Originally posted by satya sahu:
Hi,
Is it possible to aa label over another label ?

Regards,
Satya


Here what you mean adding Label over another label.Did you mean to change label Text or else Hide your 'aa' label and make some other label visible there.
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Actually i am setting the image on the first label and then i want to put another lable with a small image, on the top of the first lable. I will set the Opaque property so that background image will be the first label image and on top of that the second image i.e in the 2nd label.
Although i have different solutions to this problem, but i have to find out whether i can do it using label or not.

Please let me know if i am not explained the problem properly.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38334
    
  23
Don't know. It sounds likely however. JLabel has an add() method, so I would suggest you try it and tell us all what happens.
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Campbell Ritchie:
Don't know. It sounds likely however. JLabel has an add() method, so I would suggest you try it and tell us all what happens.


I guess there's no harm in trying it, but JLabel's add() methods shouldn't be used. They are only there because Swing components happen to extend from java.awt.Container.

Originally posted by satya sahu:
Actually i am setting the image on the first label and then i want to put another lable with a small image, on the top of the first lable.


It is possible to position one JLabel on top of another, but it seems to me there are much better/easier ways to achieve the effect you're looking for.

Here's the approach I would take:


bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding Label on another Label