0

使用 Jruby 并希望将 2d ruby​​ 数组传递给 javax.swing.table.DefaultTableModel

#create a empty table view on UI and will fill out it later
columns = ['1','2']
data = [[]]
columns.length.times{ data.first << ""}
# below raise exception
mode = javax.swing.table.DefaultTableModel.new(data,columns)

似乎是方法签名匹配导致的异常,如何解决?

NameError: no constructorfor arguments (org.jruby.java.proxies.ArrayJavaProxy
,or g.jruby.RubyArray) on Java::JavaxSwingTable::DefaultTableModel
available overloads:
(java.util.Vector,java.util.Vector)
(java.lang.Object[],int)
(java.util.Vector,int)
(int,int)
(java.lang.Object[][],java.lang.Object[])
4

1 回答 1

0

从 Ruby 值填充 Java 向量...

 matrix = java.util.Vector.new
 datos.each do |valor|   
      matrix.add_element(valor)
 end #datos.each do |valor|   

我在应用程序上使用 Swing...

http://sourceforge.net/projects/rmldonkey/

Regads

于 2013-09-24T21:48:33.573 回答