diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-13 10:07:09 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-13 10:07:09 -0800 |
commit | 1e530365fd3a1ab749091e7c56850405dc98aed1 (patch) | |
tree | e98e6e16c5f6fd003ef4c6581fa8a97f215ccfed /docs/examples/swing/TableSelection.scala | |
parent | d614965f083981817bfa08b84a07c069987d0a78 (diff) | |
parent | 3bfd83971ec48102fd1e711236f5a313c6a1ce3e (diff) | |
download | scala-1e530365fd3a1ab749091e7c56850405dc98aed1.tar.gz scala-1e530365fd3a1ab749091e7c56850405dc98aed1.tar.bz2 scala-1e530365fd3a1ab749091e7c56850405dc98aed1.zip |
Merge pull request #3265 from retronym/merge/2.10.x-to-master
Merge 2.10.x to master
Diffstat (limited to 'docs/examples/swing/TableSelection.scala')
-rw-r--r-- | docs/examples/swing/TableSelection.scala | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/docs/examples/swing/TableSelection.scala b/docs/examples/swing/TableSelection.scala deleted file mode 100644 index 8c8ea4ffcc..0000000000 --- a/docs/examples/swing/TableSelection.scala +++ /dev/null @@ -1,96 +0,0 @@ -package examples.swing - -import java.awt.Dimension -import swing.event._ - -object TableSelection extends SimpleSwingApplication { - val model = Array(List("Mary", "Campione", "Snowboarding", 5, false).toArray, - List("Alison", "Huml", "Rowing", 5, false).toArray, - List("Kathy", "Walrath", "Knitting", 5, false).toArray, - List("Sharon", "Zakhour", "Speed reading", 5, false).toArray, - List("Philip", "Milne", "Pool", 5, false).toArray) - /*val model = Array.tabulate(10000) { i => - List("Mary", "Campione", "Snowboarding", i, false).toArray - }*/ - - lazy val ui = new BoxPanel(Orientation.Vertical) { - val table = new Table(model, Array("First Name", "Last Name", "Sport", "# of Years", "Vegetarian")) { - preferredViewportSize = new Dimension(500, 70) - } - //1.6:table.fillsViewportHeight = true - listenTo(table.selection) - - contents += new ScrollPane(table) - contents += new Label("Selection Mode") - - def radio(mutex: ButtonGroup, text: String): RadioButton = { - val b = new RadioButton(text) - listenTo(b) - mutex.buttons += b - contents += b - b - } - - val intervalMutex = new ButtonGroup - val multiInterval = radio(intervalMutex, "Multiple Interval Selection") - val elementInterval = radio(intervalMutex, "Single Selection") - val singleInterval = radio(intervalMutex, "Single Interval Selection") - intervalMutex.select(multiInterval) - - contents += new Label("Selection Options") - val elemMutex = new ButtonGroup - val rowSelection = radio(elemMutex, "Row Selection") - val columnSelection = radio(elemMutex, "Column Selection") - val cellSelection = radio(elemMutex, "Cell Selection") - elemMutex.select(rowSelection) - - val output = new TextArea(5, 40) { editable = false } - contents += new ScrollPane(output) - - def outputSelection() { - output.append("Lead: " + table.selection.rows.leadIndex + "," + - table.selection.columns.leadIndex + ". ") - output.append("Rows:") - for (c <- table.selection.rows) output.append(" " + c) - output.append(". Columns:") - for (c <- table.selection.columns) output.append(" " + c) - output.append(".\n") - } - - reactions += { - case ButtonClicked(`multiInterval`) => - table.selection.intervalMode = Table.IntervalMode.MultiInterval - if (cellSelection.selected) { - elemMutex.select(rowSelection) - table.selection.elementMode = Table.ElementMode.None - } - cellSelection.enabled = false - case ButtonClicked(`elementInterval`) => - table.selection.intervalMode = Table.IntervalMode.Single - cellSelection.enabled = true - case ButtonClicked(`singleInterval`) => - table.selection.intervalMode = Table.IntervalMode.SingleInterval - cellSelection.enabled = true - case ButtonClicked(`rowSelection`) => - if (rowSelection.selected) - table.selection.elementMode = Table.ElementMode.Row - case ButtonClicked(`columnSelection`) => - if (columnSelection.selected) - table.selection.elementMode = Table.ElementMode.Column - case ButtonClicked(`cellSelection`) => - if (cellSelection.selected) - table.selection.elementMode = Table.ElementMode.Cell - case TableRowsSelected(_, range, false) => - output.append("Rows selected, changes: " + range + "\n") - outputSelection() - case TableColumnsSelected(_, range, false) => - output.append("Columns selected, changes " + range + "\n") - outputSelection() - } - } - - def top = new MainFrame { - title = "Table Selection" - contents = ui - } -} |