Last active
October 12, 2017 08:47
-
-
Save timmolderez/afa4ee8fab30492a9328ab8a7cc06694 to your computer and use it in GitHub Desktop.
Initial code of the Swing text editor exercise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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