Skip to content

Instantly share code, notes, and snippets.

Created May 29, 2012 08:48
Show Gist options
  • Select an option

  • Save anonymous/2823353 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/2823353 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist May 29, 2012.
    42 changes: 42 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    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")
    }

    }