summaryrefslogblamecommitdiff
path: root/docs/examples/swing/SimpleApplet.scala
blob: 502de537a3c333db24b8776a71b6be981bdf7747 (plain) (tree)
1
2
3
4
5
6
7
8
9
                      





                                     
                                            
                                                                                    

                      
                                                                 

                 
                                                                                     

     
 
package examples.swing

import event._

class SimpleApplet extends Applet {
  object ui extends UI with Reactor {
    def init() = {
      val button = new Button("Press here!")
      val text = new TextArea("Java Version: " + util.Properties.javaVersion + "\n")
      listenTo(button)
      reactions += {
        case ButtonClicked(_) => text.text += "Button Pressed!\n"
        case _ =>
      }
      contents = new BoxPanel(Orientation.Vertical) { contents.append(button, text) }
    }
  }
}