
-----------------------------------
SsJBebiGoku
Wed Feb 02, 2005 3:12 pm

GUI Problem
-----------------------------------
Hi,
I can't seem to get my buttons to be visible...the program creates them fine, because you can click them, but for some reason only one appears until you click the others.
Attached are the required files.

Thanks a lot

-----------------------------------
rizzix
Fri Feb 04, 2005 7:41 pm


-----------------------------------
we dont want to look through all that code.. please pinpoint you problem.

-----------------------------------
SsJBebiGoku
Sat Feb 05, 2005 11:16 am


-----------------------------------
it should be in the BoardDraw class, probably something to do with drawPlayArea(). the rest of the code is jsut there so that i can run so you can see what the problem is

-----------------------------------
rizzix
Sat Feb 05, 2005 11:28 am


-----------------------------------
what layout manager are u using?

-----------------------------------
SsJBebiGoku
Sat Feb 05, 2005 1:28 pm


-----------------------------------
it's using a GridLayout() format

-----------------------------------
rizzix
Sat Feb 05, 2005 2:25 pm


-----------------------------------
hmm i looked at ur code.. 

#1: you are not using an MVC architecture/framework. SWING relies on this MVC concept. not using it will result in your programs not working as expected. (swing is the only and most buggiest package in java, not following the MVC framework usually leads to trouble)

#2: your code design is funny... i suggest to rewrite the entire project using a MVC framework.. not only will it make maintainance a lot easier it will also make it eaiser to extend the project. 

don be afraid of rewriting it.  you have the concept, all you need to do is code it the right way.


basically, the MVC framework requires that the View (ur game board, buttons etc), the Controller ( event handlers etc) and the Model (the game board model: which buttons are mines and which are not etc) to be separated as far as possible. then later on you write a integration code (usually in your App class) to get these 3 things working together.

-----------------------------------
SsJBebiGoku
Sun Feb 06, 2005 1:37 pm


-----------------------------------
thank you so much. you're a life saver

-----------------------------------
rizzix
Sun Feb 06, 2005 3:08 pm


-----------------------------------
sarcasm will get u no where. no one here is going to debug a SWING app of such terrible design.

either way here a working model of a similar generic view:
import java.awt.*;
import javax.swing.*;

public class Test {
    public static void main(String


looking through ur code i've noticed u use the co-ordinates to reveal locations of the other squares.. why not just use the row,col info instead? switching from row-col to co-ordinates simply adds in unnecessary complexity in your code.
