Permalink
Browse files

[nomaster] Revert "Added a Swing ColorChooser wrapper"

This reverts commit 08ab007.

This is necessary to maintain binary compatibility with 2.10.0.
  • Loading branch information...
1 parent b4f277a commit dad8796bd08e6264870eeeb85d79149e77421121 @adriaanm adriaanm committed Feb 13, 2013
@@ -1,61 +0,0 @@
-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
- }
-}
@@ -1,45 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2012, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-
-import javax.swing.JColorChooser
-import event._
-
-/**
- * Wrapper for JColorChooser. Publishes `ColorChanged` events, when the color selection changes.
- *
- * @author andy@hicks.net
- * @author Ingo Maier
- * @see javax.swing.JColorChooser
- */
-object ColorChooser {
- def showDialog(parent: Component, title: String, color: Color): scala.Option[Color] = {
- toOption[Color](javax.swing.JColorChooser.showDialog(parent.peer, title, color))
- }
-}
-
-class ColorChooser(color0: Color) extends Component {
- def this() = this(java.awt.Color.white)
-
- override lazy val peer: JColorChooser = new JColorChooser(color0) with SuperMixin
-
- peer.getSelectionModel.addChangeListener(new javax.swing.event.ChangeListener {
- def stateChanged(e: javax.swing.event.ChangeEvent) {
- publish(ColorChanged(ColorChooser.this, peer.getColor))
- }
- })
-
- def color: Color = peer.getColor
- def color_=(c: Color) = peer.setColor(c)
-
- def dragEnabled: Boolean = peer.getDragEnabled
- def dragEnabled_=(b: Boolean) = peer.setDragEnabled(b)
-}
@@ -1,14 +0,0 @@
-/* __ *\
-** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2007-2011, LAMP/EPFL **
-** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
-** /____/\___/_/ |_/____/_/ | | **
-** |/ **
-\* */
-
-
-
-package scala.swing
-package event
-
-case class ColorChanged(source: Component, c: Color) extends ComponentEvent with SelectionEvent

0 comments on commit dad8796

Please sign in to comment.