Description
From the Griffon User list ->
Hi everyone. I feel like the answer is staring me in the face on this one but I can't figure out what I'm doing wrong.
I have an object that extends JList:
class MyList extends JList { public MyList(){ super() } ... custom methods ... }
and I'm using it in my view as such:
list(new MyList(), id:'listId', items:["item 1","item 2","etc"], valueChanged:controller.listSelectionChangedAction)
Then in my controller I have:
def listSelectionChangedAction = { evt ->
def list = (MyList)evt.source
... do stuff with list ...
}
But I'm getting an error for the type casting:
2012-11-27 19:34:52,434 [pool-2-thread-2] ERROR griffon.util.GriffonExceptionHandler - Uncaught Exception org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'javax.swing.JList[listId,0,0,256x136,alignmentX=0.0,alignmentY=0.0,border=,flags=50331944,maximumSize=,minimumSize=,preferredSize=,fixedCellHeight=-1,fixedCellWidth=-1,horizontalScrollIncrement=-1,selectionBackground=com.apple.laf.AquaImageFactory$SystemColorProxy[r=42,g=91,b=213],selectionForeground=com.apple.laf.AquaImageFactory$SystemColorProxy[r=255,g=255,b=255],visibleRowCount=8,layoutOrientation=0]' with class 'javax.swing.JList' to class 'com.myproject.MyList'
Attempts to access the custom methods of my list class without the type casting also produce an error. Anyone know what's wrong with this? Thanks in advance.