1

I made a Wrappable JLabel which shows text message within the label with multiple lines. The label and text (i.e. foreground and background) are visible all time.

Now I want to change the JLabel such that it should be visible only after mouse hover and rest of the time it should be translucent. How can I achieve this? please help me .. thanks in advance .

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Abhijeet
  • 407
  • 2
  • 7
  • 11
  • Let me be more specific this time. i had swing Layer component on which there is lable wich has some text. the layer is actually the video, now i want to make lable transperent by default so that user can see the video, but when user move mouse over that lable it show the text, i had not get any specific ans , please help me if any one know how to tackle it – Abhijeet May 23 '12 at 07:26

1 Answers1

1

For mouse hover over the JLabel you have to call repaint() in all methods from MouseXxxListener, reason is the this notifier isn't implemented in the JLabel API, more inc. descriptions in the post by @kleopatra

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • but how should i make it transperent so i can able to see the existing back ground – Abhijeet May 23 '12 at 07:38
  • method setOpaque just make the lable area whitish and we see the white box instead of the image which is in background on which lable is present – Abhijeet May 23 '12 at 08:07
  • Thanks guys for the support. i had found out the way to do it. just like to share it how i done, to make translucent i just make the alpha number of color of background and foreground change on mouse over and i was able to acheived the reqired effect. – Abhijeet May 24 '12 at 04:33