问题标签 [actionlistener]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1823 浏览

jsf - jsf动态创建actionListener参数

我有一个自定义的 facelet 组件(自定义标签),但目前有一件事让我很恼火。我正在尝试将动作侦听器作为参数传递给自定义标记,以使其更具动态性并且不起作用。

环境:JSF 1.2,IceFaces 1.8

这是我试图实现这一目标的方式:

  • 命令链接使用传递的参数'paginationController'

    /li>
  • 参数“paginationController”是这样传递的:

    /li>
  • 当我点击链接时,我收到了:

    /li>

所以它似乎成功地将bean名称解析为rowSelectController,但它抱怨找不到方法,并且方法存在!

还有一件事,如果我用正确的控制器名称替换参数,它就可以工作!有任何想法吗?

0 投票
2 回答
4568 浏览

android - Android 触摸监听器?

我需要嵌套几个触摸监听器。例如,我有一个 ViewGroup,它将具有以下侦听器:onItemClick、onLongItemClick 和 onTouch.EV == move。

视图组内的项目也将有一个 onClick。

在我的测试中,两组听众独立工作,但不是相互依赖的。有什么办法可以将听众组联系起来吗?

谢谢,~Aedon

0 投票
7 回答
23497 浏览

java - Thread end listener. Java

Are there any Listeners in Java to handle that some thread have been ended? Something like this:

I know, that it is impossible to deal like this, but I want to be notified when some thread ended.

Usually I used for this Timer class with checking state of each Future. but it is not pretty way. Thanks

0 投票
1 回答
7059 浏览

java - Repainting a graphic paintComponent using an ActionListener

I am struggling a bit with how to repaint a circle graphic to a different color on a button click. Further, I also have to do the same with a JColorChooser. Getting the chooser dialog to show is fairly straightforward but what do I need to add to the action listener to get the color of the circle changed?

I am kind of at a loss, though I know that the method repaint() is involved. Please have a look at my code and tell me where I am going wrong or "painting" myself into a corner. Thanks!

and file MoveCircle.java

0 投票
3 回答
201 浏览

java - Java 字符串比较

以下代码是我程序的一部分

......

当打印 r 时,输出与打印货币 [0] 的情况相同。问题是 k 总是被视为 0.00。我认为这与字符串的比较有关。

谢谢。

0 投票
9 回答
19275 浏览

java - How to avoid firing actionlistener event of JComboBox when an item is get added into it dynamically in java?

I need your suggestions and guidence on following task.

I have a frame which has two JComboBoxes supposed they are named combo1 and combo2, a JTable and other components.

At initial stage when frame is visible with above component. The combo1 combobox is filled with some values but no value is selected at initial stage, the combo2 combobox is disabled and the table is empty.

I have added an actionListener on combo1 as well as combo2. There are two types of values in combo1 suppose those values are type1 and type2.

Condition 1: When we selects value type1 from Combo1 the actionListener method is called of combo1 which invokes a method which combo2 remains disabled and adds some rows to table related to selected value type1 from combo1.

Condition 2: when we selects value type2 from combo1 the actionListener method is called of combo1 which invokes a method who makes combo2 filled with some values related to type2 and gets enabled but no value is selected from combo2 and table also should remain empty until we selects any value from combo2.

table at every addition of value to combo2 the action listener method of combo2 is gets fired. In actionListener method of combo2 which gets combo2 selected value but here there is no selected value of combo2 which leads to a NullPointerException.

So what should I do that the action listner method of combo2 will not be get executed after addition of an values to combo2.

0 投票
2 回答
3155 浏览

java - 在 JButton MouseClicked 中执行的 Java 类

我是 Java 新手。有了这个类,我可以打开一个 pdf 文件:

现在想要使用 Jbutton 鼠标事件来触发此类并打开该 pdf。我在 Netbeans 工作,有人可以帮我吗?

新JFrame.java

提前谢谢...^^

0 投票
2 回答
13757 浏览

jsf - 执行 (Primefaces) 菜单项的 ActionListener 会导致 IllegalStateException

IllegalStateException在 JSF 支持的 bean 中,当调用以编程方式添加的 Primefaces 菜单项的以编程方式添加的动作侦听器时,我得到了一个。我尝试了两者requestsession范围,但两者都导致相同的错误。显然,根据堆栈跟踪,需要在执行动作侦听器时恢复视图,并且我让我的ToolbarBean实现Serializable没有不同的效果。为了让它发挥作用,我应该考虑什么?

用户界面定义

提供菜单的支持 bean

单击菜单按钮之一时出现异常

0 投票
1 回答
379 浏览

java - GUI - actionListener 方法

我正在尝试使用 java 在 jwindow 顶部创建一个带有菜单栏的简单 GUI。我能够显示菜单栏,并且能够实现 actionlistener 类,但是,如何在单击后获取 ok 和 ye 选项卡以打印出信息?换句话说,我如何使用 actionlistener 类来创建一个操作以在用户单击 ok 或 ye 后打印信息?

0 投票
4 回答
17357 浏览

java - 嵌套类与实现 ActionListener

创建实现 ActionListener 的嵌套类有什么好处或缺点:

与在主类本身中实现 ​​ActionListener 相比:

我经常看到这两个例子,只是想知道是否有“最佳实践”。