Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 04-20-2004, 07:11 PM   #1 (permalink)
Dreams In Digital
 
SiNai's Avatar
 
Location: Iowa
[Java AWT] problem with my mastermind game

Okay, so here's the deal. I'm making a Mastermind game. Mastermind is where you try to guess the passcode.. yeah. If you don't know what it is, go google it (Milton Bradley game ).

Anyway, I'm making my game so that 2 windows pop up. One window is the options panel, where you string together your guess for the turn using radio buttons and regular buttons. The radio buttons are in a class that extends Panel, and the regular buttons are also in a class that extends Panel. How do I write my ActionListener so that when "Enter" or whatever is pressed on it's panel, it can capture the radio button currently selected? In other words, how can I make these two classes "talk" to one another?

By the way, the class that keeps the key, the guess (either getting the guess after the "Submit" button or concatenating the guess as it goes along, haven't decided yet), checks for win/right/wrong situations, that class is passed in as a param to both the panels, so they can communicate with the game directly.

I've been having these kind of problems all semester with OOP, trying to get my objects to talk to one another, I've ended up with some really bad cheats in order to make things work..

Any ideas?
__________________
I can't seem to remember now
What it was like- to live life, before you.. symbiont
SiNai is offline  
Old 04-20-2004, 11:10 PM   #2 (permalink)
Dreams In Digital
 
SiNai's Avatar
 
Location: Iowa
Nevermind, I came up with a solution- make them private classes within the frame. This seems to work fairly well. Hmm. Okay. Well, I guess if anybody has any better ideas/words of wisdom/etc..
__________________
I can't seem to remember now
What it was like- to live life, before you.. symbiont
SiNai is offline  
Old 04-21-2004, 12:16 PM   #3 (permalink)
Once upon a time...
 
I would watch those cheats. you might want to think about a design paradigm such as separating the Modekl, View and Controller so that the objects are coherent.

http://java.sun.com/blueprints/patterns/MVC.html
__________________
--
Man Alone
=======
Abstainer: a weak person who yields to the temptation of denying himself a pleasure.
Ambrose Bierce, The Devil's Dictionary.
manalone is offline  
 

Tags
awt, game, java, mastermind, problem


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 11:28 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54