Hi sravi,
Take a look at this. Hope you are not trying to play any pranks on anyone
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class MoveButtonFrame extends JFrame
{
public MoveButtonFrame()
{
getContentPane().setLayout(null);
setSize(200,200);
MoveButtonPanel mbp = new MoveButtonPanel();
mbp.setBounds(new Rectangle(0,0,200,200));
getContentPane().add(mbp,null);
}
public static void main(String[] args)
{
MoveButtonFrame mbf = new MoveButtonFrame();
mbf.show();
}
}
class MoveButtonPanel extends JPanel implements MouseListener
{
private JButton b1;
private boolean flag;
public MoveButtonPanel()
{
setLayout(null);
setSize(200,200);
b1 = new JButton("Move over me!?!"

;
b1.setBounds(new Rectangle(0,0,150,20));
b1.addMouseListener(this);
add(b1, null);
flag = true;
}
public void mouseClicked(MouseEvent e)
{
}
public void mousePressed(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
public void mouseEntered(MouseEvent e)
{
if (flag == true)
{
b1.setBounds(new Rectangle(0,100,150,20));
flag = false;
}
else
{
b1.setBounds(new Rectangle(0,0,150,20));
flag = true;
}
}
public void mouseExited(MouseEvent e)
{
}
}
Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best
