摘要:
frame上的button浮动效果就只是动态的设置此按钮的位置。setLocation(int x , int y); button.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { int x = (int)(Math.random() *...
frame上的button浮动效果就只是动态的设置此按钮的位置。setLocation(int x , int y);
button.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { int x = (int)(Math.random() * (frameWidth - getWidth())); int y = (int)(Math.random() * (frameHeight - getHeight() - 30)); setLocation(x, y + 30); } });///此方法就是设置这样的效果 }