编写一个程序,其中包括一个按钮。当鼠标移到按钮上时,隐藏按钮;当鼠标离开按钮时,显示按钮。
解决方案 »
- 日期差问题
- 如何让图像能适应jpanel的大小
- 第一个文本框输完以后,光标自动跳到下一个文本框,怎么做啊??
- 三角函数计算中的问题
- 在jtextarea中如何把光标设置到document的结尾处
- 在一个事务中保存两个表,第二个表要得到第一个表的id值后方能保存,该怎么做?
- 有没有谓词演算,命题演算的算法,或具体函数库?
- 请问如何把Java程序转为Windows本地EXE程序?
- 有谁用java开发过表格的构件,请指教
- Win2000下汉字显示的问题
- 声明为final的变量在实例中不占用内存,那么它在哪里占用内存,它被存放在哪里??
- 用Jbuilder开发程序中要打开一个文本文件,如何做?我不想用绝对路径!!请高手帮忙!!
在鼠标弹起(mouseUp)中用button.setVisible(true);
btnFirst_pre.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent e) {
btnFirst_pre.setVisible(false);
}
public void mouseExited(MouseEvent e) {
btnFirst_pre.setVisible(true);
}
});鼠标监听就是实现这几个方法:
/**
* Invoked when the mouse has been clicked on a component.
*/
public void mouseClicked(MouseEvent e) {} /**
* Invoked when a mouse button has been pressed on a component.
*/
public void mousePressed(MouseEvent e) {} /**
* Invoked when a mouse button has been released on a component.
*/
public void mouseReleased(MouseEvent e) {} /**
* Invoked when the mouse enters a component.
*/
public void mouseEntered(MouseEvent e) {} /**
* Invoked when the mouse exits a component.
*/
public void mouseExited(MouseEvent e) {}
想学还是自己看看代码,小问题也贴出来不利于学习