Déb*_*ora 20 swing netbeans desktop-application
当a JButton添加到内容窗格时,我们可以通过双击按钮或右键单击 - >事件 - >操作 - > actionPerformed来设置操作.让我们设置一些事情发生.然后我们需要删除该函数.通过删除我们在buttton的actionPerformed中编写的代码,可以轻松完成.但问题是,该按钮的actionPerformed方法仍然存在,即使它不再使用而且不需要.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//no function here.. but this code is still remaining. need to remove this code part as well
}
Run Code Online (Sandbox Code Playgroud)
它怎么能被删除?我得到了JButton的一个例子.其他组件的动作方法是这样的.
Cos*_*lis 56
转到JButton属性,选择"Events",actionPerformed并从相邻的组合框中选择"none".您的源代码已清除!

最新版本的Netbeans(如7.3)不提供"none"作为选项,但允许您通过删除方法名称或按1,2和3按钮来删除actionPerformed方法:
