-
-
Save takano32/2823401 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
なるほど。ありがとうございます!じつはどうも描画がおかしい、と他の方から相談があったソースコードなので、FrashCardについてはその方に聞いてみます。
ありがとうございます!