简体   繁体   English

在Java中单击按钮时可以更改组合框值吗?

[英]Can I change combobox value when a button is clicked in java?

By using doClick() method, the action of a button can be triggered. 通过使用doClick()方法,可以触发按钮的动作。 Is there such a way to change combobox value when a button is clicked in java? 在Java中单击按钮时,有没有办法更改组合框的值? Thank You. 谢谢。

As you didn't state the graphical framework I assume you use Swing, as it contains a doClick function . 您未声明图形框架,所以我假设您使用Swing,因为它包含doClick函数

The doClick() function is only used to emulate a button click programmatically, for example in testing. doClick()函数仅用于以编程方式模拟按钮单击,例如在测试中。 This will fire all actions that are normally associated with that button, however you need to register those yourself, using a listener . 这将触发通常与该按钮关联的所有操作,但是您需要使用自己的监听器进行注册。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM