hello guys, this is a very simple code, but i am confused can you help me out? in this code, i wanted to changed the color of the button when mouse entered over the button.but problem with the below code is that when i move mouse over one button both the button color get changes. so, please see this. thank you. import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class but extends Applet implements MouseListener { Button b1,b2; public void init() { b1=new Button("click1"); b2=new Button("click2");
b1.addMouseListener(this); b2.addMouseListener(this); add(b1); add(b2); } public void mousePressed(MouseEvent e) {} public void mouseReleased(MouseEvent e) {} public void mouseClicked(MouseEvent e) {} public void mouseEntered(MouseEvent e) { /* how to change the particular button color which has the mouse over it. at present whenever the mouse come over either of the button, both the color changes. */