B
Brian
Hi all
I'm trying to get a JButton to change the image when the mouse is over
it, but I can't get it to work.
The code:
ImageIcon icon = new ImageIcon("images/MRButton.png"");
JButton MRButton = new JButton(icon);
button.addMouseListener(new MouseListener(){
public void mouseEntered(MouseEvent arg0) {
//I have tried this - but i don't work
icon = new ImageIcon("lommeregner/images/MRButton_over.png");
}
public void mouseExited(MouseEvent arg0) {
//some code here ...
}
}
Can someone give me a hint to solve this little problem ?
/Brian
I'm trying to get a JButton to change the image when the mouse is over
it, but I can't get it to work.
The code:
ImageIcon icon = new ImageIcon("images/MRButton.png"");
JButton MRButton = new JButton(icon);
button.addMouseListener(new MouseListener(){
public void mouseEntered(MouseEvent arg0) {
//I have tried this - but i don't work
icon = new ImageIcon("lommeregner/images/MRButton_over.png");
}
public void mouseExited(MouseEvent arg0) {
//some code here ...
}
}
Can someone give me a hint to solve this little problem ?
/Brian