RosettaCodeData/Task/Hello-world-Line-printer/Scala/hello-world-line-printer-1.scala

16 lines
395 B
Scala
Raw Permalink Normal View History

2013-10-27 22:24:23 +00:00
import java.awt.print.PrinterException
2015-02-20 00:35:01 -05:00
import scala.swing.TextArea
2013-10-27 22:24:23 +00:00
2015-02-20 00:35:01 -05:00
object LinePrinter extends App {
val (show, context) = (false, "Hello, World!")
2013-10-27 22:24:23 +00:00
try // Default Helvetica, 12p
2015-02-20 00:35:01 -05:00
new TextArea(context) {
append(" in printing.")
peer.print(null, null, show, null, null, show)
}
2013-10-27 22:24:23 +00:00
catch {
case ex: PrinterException => ex.getMessage()
}
2015-02-20 00:35:01 -05:00
println("Document printed.")
2013-10-27 22:24:23 +00:00
}