-1

So I am making a game, and when you push the button called history, a JDialog pops up where it shows you the moves you have done. I was wondering how I would make a table on the JDialog with an ok button at the bottom it.

Example Table:

|Move|                 What Happened                    |        
| 1  |A beam shot from 6 lands on 29                    |            
| 2  |Guess at (3,5) with a direction of \ was incorrect|       
| 3  |Guess at (4,3) with a direction of / was correct  |
chiwangc
  • 3,566
  • 16
  • 26
  • 32
Lahey11
  • 11
  • 1
  • Could you help me with the code part please. I am new at using JDialogs and I don't understand how to use them that well. – Lahey11 May 20 '15 at 05:51

1 Answers1

0

You can create a custom dialog that extends JDialog, and display it when you click the history button...I always call a static method in the new custom dialog class such as "showDialog()" which then instantiates the dialog, sets it to visible, etc. You can add all the elements to the dialog you want, including your table, and an OK button whose listener will setVisible(false) and dispose() to return control back to the spot where you called the static method to show the dialog.

swingMan
  • 732
  • 1
  • 6
  • 17