Description
This script...
import groovy.swing.SwingBuilder import javax.swing.* import javax.swing.table.* class MyRenderer extends DefaultTableCellRenderer { public JComponent getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { println "value: $value, selected: $isSelected, focus: $hasFocus, row: $row, column: $column" return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column) } } def data = [ [nick:'MrG', full:'Guillaume Laforge'], [nick:'jez', full:'Jeremy Rayner' ], [nick:'fraz', full:'Franck Rasolo' ], [nick:'sormuras', full:'Christian Stein' ], [nick:'blackdrag', full:'Jochen Theodorou' ], [nick:'Mittie', full:'Dierk Koenig' ] ] def swing = new SwingBuilder() def frame = swing.frame(title:'Table Demo') { scrollPane { table(id:'table') { tableModel(list:data) { propertyColumn(header:'Nickname', propertyName:'nick') propertyColumn(header:'Full Name', propertyName:'full') } } } } swing.table.setDefaultRenderer(Object, new MyRenderer()) swing.table.setDefaultRenderer(String, new MyRenderer()) frame.pack() frame.show()
creates this error
java.lang.VerifyError: (class: MyRenderer, method: getTableCellRendererComponent signature: (Ljavax/swing/JTable;Ljava/lang/Object;Lboolean;Lboolean;Lint;Lint;)Ljava/awt/Component;) Register 3 contains wrong type
at Script0.class$(Script0)
at Script0.run(Script0:33)
Shouldn't the signature be class: MyRenderer, method: getTableCellRendererComponent signature: (Ljavax/swing/JTable;Ljava/lang/Object;ZZII)Ljava/awt/Component ? Are we encoding primitives wrong in some cases?