1: //..+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
2: /*
3: * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
4: */
5: package components
6:
7: import swing._
8:
9: // ----------------------------------------
10: object SimpleTableDemo {
11: val version = this.getClass.getName+": #1.0.06"
12: }
13:
14: // ----------------------------------------
15: class SimpleTableDemo extends GridPanel(1,0) {
16:
17: val columnNames = Array(
18: "First Name",
19: "Last Name",
20: "Sport",
21: "# of Years",
22: "Vegetarian")
23:
24: val data = Array(
25: Array("Kathy", "Smith", "Snowboarding", 5, false),
26: Array("John", "Doe", "Rowing", 3, true ),
27: Array("Sue", "Black", "Knitting", 2, false),
28: Array("Jane", "White", "Speed reading", 20, true ),
29: Array("Joe", "Brown", "Pool", 10, false))
30:
31: val table = new Table(data, columnNames) {
32: preferredViewportSize = new Dimension(500, 70)
33: }
34:
35: //Create the scroll pane and add the table to it.
36: val scrollPane = new ScrollPane(table)
37:
38: //Add the scroll pane to this panel.
39: contents += scrollPane
40: }
41:
42: // ========================================