I'm making a tic-tac-toe game in Java and so far it's going well, but as of now, I've written my program to print to console. Is there a command to get what would currently be displayed on my console output to show up on a separate window? Something like a JOptionPane?
My console right now looks like a ticTacToe grid, and I want to maybe get a while loop to display the currentBoard to a pop-up-dialog after every set of turns. So the player can see the updated Board after every turn set.
Is this possible?
You can redirect System.out
messages to a JTextArea
or JTextPane
.
Check out the Message Console class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.