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()
    }
    Definition Classes
    scala
  • object RichWindow
    Definition Classes
    swing
  • Undecorated

trait Undecorated extends Window with RichWindow

Mixin this trait if you want an undecorated window.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Undecorated
  2. RichWindow
  3. Window
  4. PeerContainer
  5. RootPanel
  6. Container
  7. UIElement
  8. LazyPublisher
  9. Publisher
  10. Reactor
  11. Proxy
  12. AnyRef
  13. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. trait InterfaceMixin2 extends InterfaceMixin
    Definition Classes
    RichWindow
  2. trait InterfaceMixin extends RootPaneContainer
    Attributes
    protected
    Definition Classes
    Window
  3. trait SuperMixin extends java.awt.Window
    Attributes
    protected
    Definition Classes
    Window

Abstract Value Members

  1. abstract def peer: java.awt.Window with InterfaceMixin2

    The underlying Swing peer.

    The underlying Swing peer.

    Definition Classes
    RichWindowWindowPeerContainerRootPanelUIElement

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def background: Color
    Definition Classes
    UIElement
  6. def background_=(c: Color): Unit
    Definition Classes
    UIElement
  7. def bounds: Rectangle
    Definition Classes
    UIElement
  8. def bounds_=(rect: Rectangle): Unit
    Definition Classes
    Window
  9. def centerOnScreen(): Unit
    Definition Classes
    Window
  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. def close(): Unit
    Definition Classes
    Window
  12. def closeOperation(): Unit

    This method is called when the window is closing, after all other window event listeners have been processed.

    This method is called when the window is closing, after all other window event listeners have been processed.

    Definition Classes
    Window
  13. def componentOrientation: ComponentOrientation
    Definition Classes
    UIElement
  14. def componentOrientation_=(x: ComponentOrientation): Unit
    Definition Classes
    UIElement
  15. def contents: collection.immutable.Seq[Component]

    At most one component.

    At most one component.

    Definition Classes
    RootPanelContainer
  16. def contents_=(c: Component): Unit
    Definition Classes
    WindowRootPanel
  17. def cursor: Cursor
    Definition Classes
    UIElement
  18. def cursor_=(c: Cursor): Unit
    Definition Classes
    UIElement
  19. def deafTo(ps: Publisher*): Unit

    Installed reaction won't receive events from the given publisher anylonger.

    Installed reaction won't receive events from the given publisher anylonger.

    Definition Classes
    Reactor
  20. def defaultButton: Option[Button]
    Definition Classes
    Window
  21. def defaultButton_=(b: Option[Button]): Unit
    Definition Classes
    Window
  22. def defaultButton_=(b: Button): Unit
    Definition Classes
    Window
  23. def displayable: Boolean
    Definition Classes
    UIElement
  24. def dispose(): Unit
    Definition Classes
    Window
  25. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. def equals(that: Any): Boolean
    Definition Classes
    Proxy → Any
  27. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  28. def font: Font
    Definition Classes
    UIElement
  29. def font_=(f: Font): Unit
    Definition Classes
    UIElement
  30. def foreground: Color
    Definition Classes
    UIElement
  31. def foreground_=(c: Color): Unit
    Definition Classes
    UIElement
  32. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  33. def hashCode(): Int
    Definition Classes
    Proxy → Any
  34. def ignoreRepaint: Boolean
    Definition Classes
    UIElement
  35. def ignoreRepaint_=(b: Boolean): Unit
    Definition Classes
    UIElement
  36. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  37. def listenTo(ps: Publisher*): Unit

    Listen to the given publisher as long as deafTo isn't called for them.

    Listen to the given publisher as long as deafTo isn't called for them.

    Definition Classes
    Reactor
  38. val listeners: RefSet[Reaction]
    Attributes
    protected
    Definition Classes
    Publisher
  39. def locale: Locale
    Definition Classes
    UIElement
  40. def location: Point
    Definition Classes
    UIElement
  41. def locationOnScreen: Point
    Definition Classes
    UIElement
  42. def location_=(p: Point): Unit
    Definition Classes
    Window
  43. def maximumSize: Dimension
    Definition Classes
    UIElement
  44. def maximumSize_=(x: Dimension): Unit
    Definition Classes
    UIElement
  45. def menuBar: MenuBar

    The menu bar of this frame or NoMenuBar if no menu bar is set.

    The menu bar of this frame or NoMenuBar if no menu bar is set.

    Definition Classes
    RichWindow
  46. def menuBar_=(m: MenuBar): Unit

    Set the current menu bar of this frame.

    Set the current menu bar of this frame. Pass NoMenuBar if this frame should not show a menu bar.

    Definition Classes
    RichWindow
  47. def minimumSize: Dimension
    Definition Classes
    UIElement
  48. def minimumSize_=(x: Dimension): Unit
    Definition Classes
    UIElement
  49. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  50. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  51. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  52. def onFirstSubscribe(): Unit
    Attributes
    protected
    Definition Classes
    UIElement → LazyPublisher
  53. def onLastUnsubscribe(): Unit
    Attributes
    protected
    Definition Classes
    UIElement → LazyPublisher
  54. def open(): Unit
    Definition Classes
    Window
  55. def owner: Window
    Definition Classes
    Window
  56. def pack(): Undecorated.this.type
    Definition Classes
    Window
  57. def preferredSize: Dimension
    Definition Classes
    UIElement
  58. def preferredSize_=(x: Dimension): Unit
    Definition Classes
    UIElement
  59. def publish(e: Event): Unit

    Notify all registered reactions.

    Notify all registered reactions.

    Definition Classes
    Publisher
  60. val reactions: Reactions

    All reactions of this reactor.

    All reactions of this reactor.

    Definition Classes
    Reactor
  61. def repaint(rect: Rectangle): Unit
    Definition Classes
    UIElement
  62. def repaint(): Unit
    Definition Classes
    UIElement
  63. def resizable: Boolean
    Definition Classes
    RichWindow
  64. def resizable_=(b: Boolean): Unit
    Definition Classes
    RichWindow
  65. def self: Any
    Definition Classes
    UIElement → Proxy
  66. def setLocationRelativeTo(c: UIElement): Unit
    Definition Classes
    Window
  67. def showing: Boolean
    Definition Classes
    UIElement
  68. def size: Dimension
    Definition Classes
    UIElement
  69. def size_=(size: Dimension): Unit
    Definition Classes
    Window
  70. def subscribe(listener: Reaction): Unit
    Definition Classes
    LazyPublisher → Publisher
  71. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  72. def title: String
    Definition Classes
    RichWindow
  73. def title_=(s: String): Unit
    Definition Classes
    RichWindow
  74. def toString(): String
    Definition Classes
    Proxy → Any
  75. def toolkit: Toolkit
    Definition Classes
    UIElement
  76. def unsubscribe(listener: Reaction): Unit
    Definition Classes
    LazyPublisher → Publisher
  77. def validate(): Unit
    Definition Classes
    UIElement
  78. def visible: Boolean
    Definition Classes
    UIElement
  79. def visible_=(b: Boolean): Unit
    Definition Classes
    UIElement
  80. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  81. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  82. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from RichWindow

Inherited from Window

Inherited from PeerContainer

Inherited from RootPanel

Inherited from Container

Inherited from UIElement

Inherited from LazyPublisher

Inherited from Publisher

Inherited from Reactor

Inherited from Proxy

Inherited from AnyRef

Inherited from Any

Ungrouped