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
  • abstract class Applet extends JApplet

    Clients should implement the ui field.

    Clients should implement the ui field. See the SimpleApplet demo for an example.

    Note: Applet extends javax.swing.JApplet to satisfy Java's applet loading mechanism. The usual component wrapping scheme doesn't work here.

    Definition Classes
    swing
    See also

    javax.swing.JApplet

  • AccessibleAWTComponent
  • AccessibleAWTContainer
  • AccessibleAWTPanel
  • AccessibleApplet
  • AccessibleJApplet
  • BltBufferStrategy
  • FlipBufferStrategy
  • UI

abstract class UI extends RootPanel

Linear Supertypes
RootPanel, Container, UIElement, LazyPublisher, Publisher, Reactor, Proxy, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. UI
  2. RootPanel
  3. Container
  4. UIElement
  5. LazyPublisher
  6. Publisher
  7. Reactor
  8. Proxy
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new UI()

Abstract Value Members

  1. abstract def init(): Unit

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 clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  9. def componentOrientation: ComponentOrientation
    Definition Classes
    UIElement
  10. def componentOrientation_=(x: ComponentOrientation): Unit
    Definition Classes
    UIElement
  11. def contents: collection.immutable.Seq[Component]

    At most one component.

    At most one component.

    Definition Classes
    RootPanelContainer
  12. def contents_=(c: Component): Unit
    Definition Classes
    UIRootPanel
  13. def cursor: Cursor
    Definition Classes
    UIElement
  14. def cursor_=(c: Cursor): Unit
    Definition Classes
    UIElement
  15. 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
  16. def displayable: Boolean
    Definition Classes
    UIElement
  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(that: Any): Boolean
    Definition Classes
    Proxy → Any
  19. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def font: Font
    Definition Classes
    UIElement
  21. def font_=(f: Font): Unit
    Definition Classes
    UIElement
  22. def foreground: Color
    Definition Classes
    UIElement
  23. def foreground_=(c: Color): Unit
    Definition Classes
    UIElement
  24. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def hashCode(): Int
    Definition Classes
    Proxy → Any
  26. def ignoreRepaint: Boolean
    Definition Classes
    UIElement
  27. def ignoreRepaint_=(b: Boolean): Unit
    Definition Classes
    UIElement
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. 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
  30. val listeners: RefSet[Reaction]
    Attributes
    protected
    Definition Classes
    Publisher
  31. def locale: Locale
    Definition Classes
    UIElement
  32. def location: Point
    Definition Classes
    UIElement
  33. def locationOnScreen: Point
    Definition Classes
    UIElement
  34. def maximumSize: Dimension
    Definition Classes
    UIElement
  35. def maximumSize_=(x: Dimension): Unit
    Definition Classes
    UIElement
  36. def minimumSize: Dimension
    Definition Classes
    UIElement
  37. def minimumSize_=(x: Dimension): Unit
    Definition Classes
    UIElement
  38. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  39. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  40. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  41. def onFirstSubscribe(): Unit
    Attributes
    protected
    Definition Classes
    UIElement → LazyPublisher
  42. def onLastUnsubscribe(): Unit
    Attributes
    protected
    Definition Classes
    UIElement → LazyPublisher
  43. def peer: Applet

    The underlying Swing peer.

    The underlying Swing peer.

    Definition Classes
    UIRootPanelUIElement
  44. def preferredSize: Dimension
    Definition Classes
    UIElement
  45. def preferredSize_=(x: Dimension): Unit
    Definition Classes
    UIElement
  46. def publish(e: Event): Unit

    Notify all registered reactions.

    Notify all registered reactions.

    Definition Classes
    Publisher
  47. val reactions: Reactions

    All reactions of this reactor.

    All reactions of this reactor.

    Definition Classes
    Reactor
  48. def repaint(rect: Rectangle): Unit
    Definition Classes
    UIElement
  49. def repaint(): Unit
    Definition Classes
    UIElement
  50. def self: Any
    Definition Classes
    UIElement → Proxy
  51. def showing: Boolean
    Definition Classes
    UIElement
  52. def size: Dimension
    Definition Classes
    UIElement
  53. def start(): Unit
  54. def stop(): Unit
  55. def subscribe(listener: Reaction): Unit
    Definition Classes
    LazyPublisher → Publisher
  56. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  57. def toString(): String
    Definition Classes
    Proxy → Any
  58. def toolkit: Toolkit
    Definition Classes
    UIElement
  59. def unsubscribe(listener: Reaction): Unit
    Definition Classes
    LazyPublisher → Publisher
  60. def validate(): Unit
    Definition Classes
    UIElement
  61. def visible: Boolean
    Definition Classes
    UIElement
  62. def visible_=(b: Boolean): Unit
    Definition Classes
    UIElement
  63. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

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