Results 1 to 1 of 1
- 05-14-2011, 08:44 PM #1Member
- Join Date
- Oct 2010
- Rep Power
I've made a ConnectFour command line game, now I'd like to upgrade to GUIs!
So I have a fully functioning ConnectFour class that uses a two-dimensional character array that either has a '-', 'R', or 'B' as its state (where dash represents unfilled, 'R' red, 'B' black). The class accepts a a number as column selector and fills the bottom-most row in the column as the users entry. You can view the code here (it is well commented, no mysteries, so if anybody needs help writing a connect four game, please take a look!).
Additionally, I have a rudimentary yet inconsistent knowledge of GUIs. I can create GUIs using NetBeans editor, I can create my own JButtons and JFrames by extending them and manipulating them, and I can export them as JARs through Eclipse so my friends can use them. This is all well and good, but I need help with event listeners and displaying my board.
So two my direct questions: (1) How can I best display a 2D array with the possible states of "blank", "red", and "black"? (OR: How can I best design a ConnectFour GUI?) (2) How can I use event listeners to "listen" for which column the user selects? and (3) How does my ConnectFour.java class interact with my GUI class and others (specifically, "listeners")?
All comments much appreciated :-)
- By choconlongxu in forum NetBeansReplies: 1Last Post: 07-19-2010, 08:41 PM
- By dricco in forum New To JavaReplies: 2Last Post: 07-02-2010, 02:20 PM
- By McChill in forum New To JavaReplies: 5Last Post: 02-25-2009, 06:00 PM
- By MarkWilson in forum NetBeansReplies: 3Last Post: 08-04-2008, 03:22 AM
- By LordSM in forum New To JavaReplies: 1Last Post: 08-08-2007, 12:23 AM