YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -1,26 +1,25 @@
import scala.swing.Swing.pair2Dimension
import scala.swing.{ Color, Graphics2D, MainFrame, Panel, SimpleSwingApplication }
import scala.swing.{Color, Graphics2D, MainFrame, Panel, SimpleSwingApplication}
object XorPattern extends SimpleSwingApplication {
val ui = new Panel {
override def paintComponent(g: Graphics2D) = {
super.paintComponent(g)
for {
y <- 0 until size.getHeight().toInt
x <- 0 until size.getWidth().toInt
} {
g.setColor(new Color(0, (x ^ y) % 256, 0))
g.drawLine(x, y, x, y)
}
}
}
def top = new MainFrame {
preferredSize = (300, 300)
title = "Rosetta Code >>> Task: Munching squares | Language: Scala"
contents = ui
contents = new Panel {
protected override def paintComponent(g: Graphics2D) = {
super.paintComponent(g)
for {
y <- 0 until size.getHeight.toInt
x <- 0 until size.getWidth.toInt
} {
g.setColor(new Color(0, (x ^ y) % 256, 0))
g.drawLine(x, y, x, y)
}
}
}
centerOnScreen()
}
}