The easiest way to put data in a table is to use its constructor:
new Table (rowData: Array[Array[Any]], columnNames: Seq[_])
A bit complicated thing is that arrays are not covariant (see Why the example does not compile, how does it work (co-, contra- and in)? ), Which means that Array[String] is not a subtype of Array[Any] . Therefore, you need to somehow turn one into the other: a map does the job.
In addition, to display the column names, you need to put the table in a ScrollPane.
import swing._ import collection.mutable.ArrayBuffer object Demo extends SimpleSwingApplication { val data = ArrayBuffer( Array("Name","Birthday","ID"), Array("Bob", "07/19/1986", "2354"), Array("Sue", "05/07/1980", "2355") ) def top = new MainFrame { contents = new ScrollPane { contents = new Table( data.tail.toArray map (_.toArray[Any]), data.head ) } } }
Gives you a table:

Edit: you can also use cast: data.tail.toArray.asInstanceOf[Array[Array[Any]]] , which is more efficient than displaying.
source share