Anonymous user
Munching squares: Difference between revisions
Scala contribution maintained.
(added Factor) |
(Scala contribution maintained.) |
||
Line 1,163:
=={{header|Scala}}==
{{libheader|
<lang Scala>import scala.swing.Swing.pair2Dimension
import scala.swing.{
object XorPattern extends SimpleSwingApplication {
preferredSize = (300, 300)▼
title = "Rosetta Code >>> Task: Munching squares | Language: Scala"▼
new Panel {
protected override def paintComponent(g: Graphics2D) = {
super.paintComponent(g)
for {
y <- 0 until size.getHeight
x <- 0 until size.getWidth
} {
g.setColor(new Color(0, (x ^ y) % 256, 0))
g.drawLine(x, y, x, y)
}
}
}
▲ preferredSize = (300, 300)
▲ title = "Rosetta Code >>> Task: Munching squares | Language: Scala"
centerOnScreen()
}
|