【发布时间】:2011-06-28 14:02:32
【问题描述】:
我刚刚开始克服 Jython 中的摇摆与直接在 Java 中摇摆的难题。我想知道是否有人可以帮助我在 Jython 中向 JTable 添加动作侦听器。
我知道用一个按钮,你就可以做到:
button = Jbutton( " Press me! ", actionPerformed = my.function )
and I know that there are different events associated with a JTable.. such as when something is selected, when the focus is changed within the table, when the table itself becomes the focus...
我的问题是我不知道如何将这些实现到创建表的语法中。 我使用以下内容创建表:
data = DefaultTableModel( items, columnNames )
mytable = JTable( data )
我的基本假设是我需要...
mytable = JTable ( data, isFocused = my.other.function )
但我不知道确切的语法,而且 JTable 的 javadocs 已经足够复杂(与它实现的数百万个其他接口/类),更不用说在 jython 上下文中尝试破译它们了。
奖励积分:
除了这个特定的示例之外.. 那里有任何非常棒的 Jython 中的 Swing 语法资源吗?我找到了一些东西,但绝大多数似乎只是人烟稀少,然后被遗弃了。 (在文档方面)
【问题讨论】:
标签: python event-handling jtable jython actionlistener