Skip to content

Instantly share code, notes, and snippets.

Created May 29, 2012 08:48
Show Gist options
  • Save anonymous/2823353 to your computer and use it in GitHub Desktop.
Save anonymous/2823353 to your computer and use it in GitHub Desktop.
import java.awt.*
import javax.swing.*
class Window(t: String,frash:FrashCard) extends JFrame(t){
val frashCard = frash
val panel:JPanel = new JPanel(new GridLayout(1,1))
val tit = t
makeWindow();
add(panel)
def this() = this("FrashCard",new FrashCard)
def makeWindow(){
setSize(500,500)
setTitle(tit)
setLayout(new GridLayout)
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
addMouseListener(
new MouseListener{
def mouseClicked(event:MouseEvent){
addString (frashCard goNext)
}
def mousePressed(event:MouseEvent){}
def mouseReleased(event:MouseEvent){}
def mouseEntered(event:MouseEvent){}
def mouseExited(event:MouseEvent){}
}
)
println("Window made!")
}
def addString(word:String){
println("called! " + word)
panel.add(new JLabel(word))
repaint()
println("repainted")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment