diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/LICENSE | 2 | ||||
-rw-r--r-- | docs/examples/actors/pingpong.scala | 2 | ||||
-rw-r--r-- | docs/examples/jolib/Ref.scala | 2 | ||||
-rw-r--r-- | docs/examples/jolib/parallelOr.scala | 4 | ||||
-rw-r--r-- | docs/examples/parsing/ArithmeticParser.scala | 2 | ||||
-rw-r--r-- | docs/examples/swing/ColorChooserDemo.scala | 61 | ||||
-rw-r--r-- | docs/examples/swing/PopupDemo.scala | 33 |
7 files changed, 100 insertions, 6 deletions
diff --git a/docs/LICENSE b/docs/LICENSE index de950bdf57..a9c254ed49 100644 --- a/docs/LICENSE +++ b/docs/LICENSE @@ -1,6 +1,6 @@ SCALA LICENSE -Copyright (c) 2002-2012 EPFL, Lausanne, unless otherwise specified. +Copyright (c) 2002-2013 EPFL, Lausanne, unless otherwise specified. All rights reserved. This software was developed by the Programming Methods Laboratory of the diff --git a/docs/examples/actors/pingpong.scala b/docs/examples/actors/pingpong.scala index 4ed225c662..c355bee244 100644 --- a/docs/examples/actors/pingpong.scala +++ b/docs/examples/actors/pingpong.scala @@ -13,7 +13,7 @@ case object Stop * @author Philipp Haller * @version 1.1 */ -object pingpong extends Application { +object pingpong extends App { val pong = new Pong val ping = new Ping(100000, pong) ping.start diff --git a/docs/examples/jolib/Ref.scala b/docs/examples/jolib/Ref.scala index 5f655f16b1..32952b4351 100644 --- a/docs/examples/jolib/Ref.scala +++ b/docs/examples/jolib/Ref.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/docs/examples/jolib/parallelOr.scala b/docs/examples/jolib/parallelOr.scala index 72d282bee3..fb8288c5b2 100644 --- a/docs/examples/jolib/parallelOr.scala +++ b/docs/examples/jolib/parallelOr.scala @@ -1,10 +1,10 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** -\* */ +\* */ package examples.jolib; /* diff --git a/docs/examples/parsing/ArithmeticParser.scala b/docs/examples/parsing/ArithmeticParser.scala index 99cf7a5578..c272fa0ba0 100644 --- a/docs/examples/parsing/ArithmeticParser.scala +++ b/docs/examples/parsing/ArithmeticParser.scala @@ -1,6 +1,6 @@ /* __ *\ ** ________ ___ / / ___ Scala API ** -** / __/ __// _ | / / / _ | (c) 2006-2011, LAMP/EPFL ** +** / __/ __// _ | / / / _ | (c) 2006-2013, LAMP/EPFL ** ** __\ \/ /__/ __ |/ /__/ __ | ** ** /____/\___/_/ |_/____/_/ | | ** ** |/ ** diff --git a/docs/examples/swing/ColorChooserDemo.scala b/docs/examples/swing/ColorChooserDemo.scala new file mode 100644 index 0000000000..1cb2bdefa2 --- /dev/null +++ b/docs/examples/swing/ColorChooserDemo.scala @@ -0,0 +1,61 @@ +package examples.swing + +import java.awt.{Color, Font, Dimension} +import swing._ +import event._ +import Swing._ +import BorderPanel._ + +/** + * Demo for ColorChooser. + * Based on http://download.oracle.com/javase/tutorial/uiswing/components/colorchooser.html + * + * @author andy@hicks.net + */ +object ColorChooserDemo extends SimpleSwingApplication { + def top = new MainFrame { + title = "ColorChooser Demo" + size = new Dimension(400, 400) + + contents = ui + } + + def ui = new BorderPanel { + val colorChooser = new ColorChooser { + reactions += { + case ColorChanged(_, c) => + banner.foreground = c + } + } + + colorChooser.border = TitledBorder(EtchedBorder, "Choose Text Color") + + val banner = new Label("Welcome to Scala Swing") { + horizontalAlignment = Alignment.Center + foreground = Color.yellow + background = Color.blue + opaque = true + font = new Font("SansSerif", Font.BOLD, 24) + } + + val bannerArea = new BorderPanel { + layout(banner) = Position.Center + border = TitledBorder(EtchedBorder, "Banner") + } + + // Display a color selection dialog when button pressed + val selectColor = new Button("Choose Background Color") { + reactions += { + case ButtonClicked(_) => + ColorChooser.showDialog(this, "Test", Color.red) match { + case Some(c) => banner.background = c + case None => + } + } + } + + layout(bannerArea) = Position.North + layout(colorChooser) = Position.Center + layout(selectColor) = Position.South + } +}
\ No newline at end of file diff --git a/docs/examples/swing/PopupDemo.scala b/docs/examples/swing/PopupDemo.scala new file mode 100644 index 0000000000..6a9eeb125b --- /dev/null +++ b/docs/examples/swing/PopupDemo.scala @@ -0,0 +1,33 @@ +package examples.swing + +import swing._ +import event._ +import Swing._ + +/** + * @author John Sullivan + * @author Ingo Maier + */ +object PopupDemo extends SimpleSwingApplication { + def top = new MainFrame { + val popupMenu = new PopupMenu { + contents += new Menu("menu 1") { + contents += new RadioMenuItem("radio 1.1") + contents += new RadioMenuItem("radio 1.2") + } + contents += new Menu("menu 2") { + contents += new RadioMenuItem("radio 2.1") + contents += new RadioMenuItem("radio 2.2") + } + } + val button = new Button("Show Popup Menu") + reactions += { + case ButtonClicked(b) => popupMenu.show(b, 0, b.bounds.height) + case PopupMenuCanceled(m) => println("Menu " + m + " canceled.") + } + listenTo(popupMenu) + listenTo(button) + + contents = new FlowPanel(button) + } +}
\ No newline at end of file |