Skip to content

Instantly share code, notes, and snippets.

@timmolderez
Last active October 12, 2017 08:47
Show Gist options
  • Save timmolderez/afa4ee8fab30492a9328ab8a7cc06694 to your computer and use it in GitHub Desktop.
Save timmolderez/afa4ee8fab30492a9328ab8a7cc06694 to your computer and use it in GitHub Desktop.
Initial code of the Swing text editor exercise
import scala.swing._
import scala.swing.BorderPanel.Position
class TextEd extends MainFrame {
// Window title
title = "Swing text editor"
// Window size
preferredSize = new Dimension(640, 480)
// Window contents
val button = Button("Press me"){println("Clicked!")}
contents = new BorderPanel {
layout(button) = Position.Center
}
}
object TextEd {
def main(args: Array[String]): Unit = {
val gui = new TextEd
gui.visible = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment