| Author |
Transparent color for the panel !
|
Naren Chivukula
Ranch Hand
Joined: Feb 03, 2004
Posts: 542
|
|
Hi, I have my panel as a rectangle with some data on it. When I point my mouse over that, I should get the color of that panel changed (say a light green color). But, still I need the data present on it visible. How could I achieve this ? Thanks in advance, Narendranath
|
Cheers,
Naren (SCJP, SCDJWS and SCWCD)
|
 |
Craig Wood
Ranch Hand
Joined: Jan 14, 2004
Posts: 1535
|
|
|
Depends on what you're doing. If the data is simple text you can put it on a JLabel and add the JLabel to the JPanel. Add a MouseListener to the JLabel and change the background color of the JPanel in the mouseEntered and mouseExited methods.
|
 |
sasi kala
Ranch Hand
Joined: Dec 17, 2004
Posts: 68
|
|
yes, Craig saying the right thing. you can use mouseEntered and [I]mouseExited[/I} methods. in mouseEntered method write -- myPanel.setBackground(Color.green); // requried color in mouseExited method write -- myPanel.setBackground(UIManager.getColor("Panel.background"));
|
 |
Naren Chivukula
Ranch Hand
Joined: Feb 03, 2004
Posts: 542
|
|
Thank u guys. Regards, Narendranath
|
 |
 |
|
|
subject: Transparent color for the panel !
|
|
|