reset password
Author Message
cortiz62
Posts: 3
Posted 16:09 Oct 06, 2018 |

How do I get the button to show in the GUI

Attachments:
bcarter
Posts: 5
Posted 16:18 Oct 06, 2018 |

Your code is set up different to mine but try in the startGame() method to add setCenter(grid) after calling the setUpLabels() and your addButton() method (which btw I don't see called anywhere in your code.) I called my equivalent method in the setUpGame() method before g = new Game() 

cortiz62
Posts: 3
Posted 16:27 Oct 06, 2018 |

how do I get the addbutton() method to be called?

bcarter
Posts: 5
Posted 16:35 Oct 06, 2018 |

Id move your Button objects out of the method so they live outside the scope of the method, and just call it like setuplabels() is called  In the start game method. 

jhurley
Posts: 207
Posted 07:39 Oct 07, 2018 |

Bcarter's response looks right.
Don't post code more than a couple of lines of code on the forum. Someone will copy it.