简体   繁体   English

JTable Row-Editor

[英]JTable Row-Editor

I'm searching for an editor like in this example; 我正在寻找像这个例子中的编辑器; I mean the "Pick a Color"-Frame, but for the whole row. 我的意思是“挑选颜色”框架,但整个行。 Is it my issue to fully implement this, or can I expand some exsiting editors? 完全实现这个是我的问题,还是可以扩展一些现有的编辑器?

The default renderers and editors for common column data types are shown here . 此处显示了常见列数据类型的默认渲染器和编辑器。 An editor is chosen for any cell in any row for which isCellEditable() returns true . 为任何行中的任何单元格选择编辑器,其中isCellEditable()返回true You can also specify a custom renderer and editor, such as the color chooser you cited. 您还可以指定自定义渲染器和编辑器,例如您引用的颜色选择器。 Two recent examples are seen here , but the details depend on your use-case. 这里有两个最近的例子,但细节取决于你的用例。

Addendum: something like an child window 附录: 像儿童窗户的东西

You can pass a reference to the table's TableModel and the desired row number to your RowEditor . 您可以将对表的TableModel的引用和所需的行号传递给RowEditor You'll have full access to the table model's methods, including getValueAt() , setValueAt() and getColumnClass() methods. 您可以完全访问表模型的方法,包括getValueAt()setValueAt()getColumnClass()方法。

If you want the entire row, with columns A, B, C edited in a new child window as 如果您想要整个行,则在新的子窗口中编辑A,B,C列

A  ____
B  ____
C  ____

Then maybe you could make the row of some bean class Record, and use a java.beans.PropertyEditor to start with. 那么也许你可以创建一些bean类的行Record,并使用java.beans.PropertyEditor开始。

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

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