Packages

  • package root
    Definition Classes
    root
  • package scala
    Definition Classes
    root
  • package swing

    Scala-swing is a graphical user interface library that will wrap most of Java Swing for Scala in a straightforward manner.

    Scala-swing is a graphical user interface library that will wrap most of Java Swing for Scala in a straightforward manner.

    Overview

    The widget class hierarchy loosely resembles that of Java Swing. The main differences are:

    • In Java Swing all components are containers per default. This does not make much sense for a number of components, like scala.swing.TextField, scala.swing.CheckBox, scala.swing.RadioButton, and so on. Our guess is that this architecture was chosen because Java lacks multiple inheritance. In scala-swing, components that can have child components extend the scala.swing.Container trait.
    • Layout managers and panels are coupled. There is no way to exchange the layout manager of a panel. As a result, the layout constraints for widgets can be typed. (Note that you gain more type-safety and do not loose much flexibility here. Besides being not a common operation, exchanging the layout manager of a panel in Java Swing almost always leads to exchanging the layout constraints for every of the panel's child component. In the end, it is not more work to move all children to a newly created panel.)
    • Widget hierarchies are built by adding children to their parent container's contents collection. The typical usage style is to create anonymous subclasses of the widgets to customize their properties, and nest children and event reactions.
    • The scala-swing event system follows a different approach than the underlying Java system. Instead of adding event listeners with a particular interface (such as java.awt.ActionListener), a scala.swing.Reactor instance announces the interest in receiving events by calling listenTo for a scala.swing.Publisher. Publishers are also reactors and listen to themselves per default as a convenience. A reactor contains an object reactions which serves as a convenient place to register observers by adding partial functions that pattern match for any event that the observer is interested in. This is shown in the examples section below.
    • For more details see SIP-8.

    Scala-swing comprises two main packages:

    • scala.swing: All widget classes and traits.
    • scala.swing.event: The event hierarchy.

    This package object contains useful type aliases that do not have wrappers.

    Examples

    The following example shows how to plug components and containers together and react to a mouse click on a button:

    import scala.swing._
    
    new Frame {
      title = "Hello world"
    
      contents = new FlowPanel {
        contents += new Label("Launch rainbows:")
        contents += new Button("Click me") {
          reactions += {
            case event.ButtonClicked(_) =>
              println("All the colours!")
          }
        }
      }
    
      pack()
      centerOnScreen()
      open()
    }
p

scala

package scala

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. scala
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package swing

    Scala-swing is a graphical user interface library that will wrap most of Java Swing for Scala in a straightforward manner.

    Scala-swing is a graphical user interface library that will wrap most of Java Swing for Scala in a straightforward manner.

    Overview

    The widget class hierarchy loosely resembles that of Java Swing. The main differences are:

    • In Java Swing all components are containers per default. This does not make much sense for a number of components, like scala.swing.TextField, scala.swing.CheckBox, scala.swing.RadioButton, and so on. Our guess is that this architecture was chosen because Java lacks multiple inheritance. In scala-swing, components that can have child components extend the scala.swing.Container trait.
    • Layout managers and panels are coupled. There is no way to exchange the layout manager of a panel. As a result, the layout constraints for widgets can be typed. (Note that you gain more type-safety and do not loose much flexibility here. Besides being not a common operation, exchanging the layout manager of a panel in Java Swing almost always leads to exchanging the layout constraints for every of the panel's child component. In the end, it is not more work to move all children to a newly created panel.)
    • Widget hierarchies are built by adding children to their parent container's contents collection. The typical usage style is to create anonymous subclasses of the widgets to customize their properties, and nest children and event reactions.
    • The scala-swing event system follows a different approach than the underlying Java system. Instead of adding event listeners with a particular interface (such as java.awt.ActionListener), a scala.swing.Reactor instance announces the interest in receiving events by calling listenTo for a scala.swing.Publisher. Publishers are also reactors and listen to themselves per default as a convenience. A reactor contains an object reactions which serves as a convenient place to register observers by adding partial functions that pattern match for any event that the observer is interested in. This is shown in the examples section below.
    • For more details see SIP-8.

    Scala-swing comprises two main packages:

    • scala.swing: All widget classes and traits.
    • scala.swing.event: The event hierarchy.

    This package object contains useful type aliases that do not have wrappers.

    Examples

    The following example shows how to plug components and containers together and react to a mouse click on a button:

    import scala.swing._
    
    new Frame {
      title = "Hello world"
    
      contents = new FlowPanel {
        contents += new Label("Launch rainbows:")
        contents += new Button("Click me") {
          reactions += {
            case event.ButtonClicked(_) =>
              println("All the colours!")
          }
        }
      }
    
      pack()
      centerOnScreen()
      open()
    }

Type Members

  1. type ::[+A] = scala.collection.immutable.::[A]
  2. type AbstractMethodError = java.lang.AbstractMethodError
  3. type AnyRef = AnyRef
  4. type ArrayIndexOutOfBoundsException = java.lang.ArrayIndexOutOfBoundsException
  5. type BigDecimal = scala.math.BigDecimal
  6. type BigInt = scala.math.BigInt
  7. type ClassCastException = java.lang.ClassCastException
  8. type Cloneable = java.lang.Cloneable
  9. type Either[+A, +B] = scala.util.Either[A, B]
  10. type Equiv[T] = scala.math.Equiv[T]
  11. type Error = java.lang.Error
  12. type Exception = java.lang.Exception
  13. type Fractional[T] = scala.math.Fractional[T]
  14. type IllegalArgumentException = java.lang.IllegalArgumentException
  15. type IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException
  16. type IndexedSeq[+A] = scala.collection.immutable.IndexedSeq[A]
    Annotations
    @migration
    Migration

    (Changed in version 2.13.0) scala.IndexedSeq is now scala.collection.immutable.IndexedSeq instead of scala.collection.IndexedSeq

  17. type Integral[T] = scala.math.Integral[T]
  18. type InterruptedException = java.lang.InterruptedException
  19. type Iterable[+A] = scala.collection.Iterable[A]
  20. type IterableOnce[+A] = scala.collection.IterableOnce[A]
  21. type Iterator[+A] = scala.collection.Iterator[A]
  22. type LazyList[+A] = scala.collection.immutable.LazyList[A]
  23. type Left[+A, +B] = scala.util.Left[A, B]
  24. type List[+A] = scala.collection.immutable.List[A]
  25. type NoSuchElementException = java.util.NoSuchElementException
  26. type NullPointerException = java.lang.NullPointerException
  27. type NumberFormatException = java.lang.NumberFormatException
  28. type Numeric[T] = scala.math.Numeric[T]
  29. type Ordered[T] = scala.math.Ordered[T]
  30. type Ordering[T] = scala.math.Ordering[T]
  31. type PartialOrdering[T] = scala.math.PartialOrdering[T]
  32. type PartiallyOrdered[T] = scala.math.PartiallyOrdered[T]
  33. type Range = scala.collection.immutable.Range
  34. type Right[+A, +B] = scala.util.Right[A, B]
  35. type RuntimeException = java.lang.RuntimeException
  36. type Seq[+A] = scala.collection.immutable.Seq[A]
    Annotations
    @migration
    Migration

    (Changed in version 2.13.0) scala.Seq is now scala.collection.immutable.Seq instead of scala.collection.Seq

  37. type Serializable = java.io.Serializable
  38. type StringBuilder = scala.collection.mutable.StringBuilder
  39. type StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException
  40. type Throwable = java.lang.Throwable
  41. type UnsupportedOperationException = java.lang.UnsupportedOperationException
  42. type Vector[+A] = scala.collection.immutable.Vector[A]

Deprecated Type Members

  1. type BufferedIterator[+A] = scala.collection.BufferedIterator[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use scala.collection.BufferedIterator instead of scala.BufferedIterator

  2. type Stream[+A] = scala.collection.immutable.Stream[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use LazyList instead of Stream

  3. type Traversable[+A] = scala.collection.Iterable[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use Iterable instead of Traversable

  4. type TraversableOnce[+A] = scala.collection.IterableOnce[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use IterableOnce instead of TraversableOnce

Value Members

  1. val +:: scala.collection.+:.type
  2. val :+: scala.collection.:+.type
  3. val ::: scala.collection.immutable.::.type
  4. val AnyRef: Specializable
  5. val BigDecimal: scala.math.BigDecimal.type
  6. val BigInt: scala.math.BigInt.type
  7. val Either: scala.util.Either.type
  8. val Equiv: scala.math.Equiv.type
  9. val Fractional: scala.math.Fractional.type
  10. val IndexedSeq: scala.collection.immutable.IndexedSeq.type
  11. val Integral: scala.math.Integral.type
  12. val Iterable: scala.collection.Iterable.type
  13. val Iterator: scala.collection.Iterator.type
  14. val LazyList: scala.collection.immutable.LazyList.type
  15. val Left: scala.util.Left.type
  16. val List: scala.collection.immutable.List.type
  17. val Nil: scala.collection.immutable.Nil.type
  18. val Numeric: scala.math.Numeric.type
  19. val Ordered: scala.math.Ordered.type
  20. val Ordering: scala.math.Ordering.type
  21. val Range: scala.collection.immutable.Range.type
  22. val Right: scala.util.Right.type
  23. val Seq: scala.collection.immutable.Seq.type
  24. val StringBuilder: scala.collection.mutable.StringBuilder.type
  25. val Vector: scala.collection.immutable.Vector.type

Deprecated Value Members

  1. val Stream: scala.collection.immutable.Stream.type
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use LazyList instead of Stream

  2. val Traversable: scala.collection.Iterable.type
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use Iterable instead of Traversable

Inherited from AnyRef

Inherited from Any

Ungrouped