This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How to get these two classes to interact? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to get these two classes to interact? " Watch "How to get these two classes to interact? " New topic
Author

How to get these two classes to interact?

David Triple
Greenhorn

Joined: Jul 05, 2011
Posts: 20
I cant get his to work
David Triple
Greenhorn

Joined: Jul 05, 2011
Posts: 20
I forgot to add the explanation. I need the JOptions to show up in the JText fields, the JOptions are only there to show what i need to show up on the Jtext, but i cant get the two classes to ineract with each other. What should i do?
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

If read your question multiple times but I'm still not sure what you want. Could you explain it a bit more?


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
David Triple
Greenhorn

Joined: Jul 05, 2011
Posts: 20

Basically i need the Jtext field to show everything the Joptionpane is showing. So when the player clicks shuffle i need the jtext field MsgT to say "Shuffling" and then when deal is hit it needs to say "dealt". After the cards are the Jtextfield should show both player and house cards, then udpate the number of hands won by both sides. when i try to compile it it says variable player is not found. It cant get the card game to interact with my container.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700



Remember that the Java naming convention for variables is that they should begin with a lowercase letter.
srikanth kumar aruru
Greenhorn

Joined: Jul 21, 2011
Posts: 4

Hi David Triple,
I have few suggestions
1) Both Deal and Shuffle button's are sharing same actionListener . Make them to have separate listeners
2) Keep one stop button to stop the game.

You require Inner class here. And inner class will use outer class variable (JText). To change the text message value.

JHiLo2 is your outer class and Deal and Shuffle are inner class. Inner class can share outerClass variables.


André Bensoussan once explained the difference between a programmer and a designer:

"If you make a general statement, a programmer says, 'Yes, but...'
while a designer says, 'Yes, and...'"
David Triple
Greenhorn

Joined: Jul 05, 2011
Posts: 20
and this is is inserted in the container or where the actual deal and shuffle calculations are placed? This is my first program combining classes and its a more difficult than i thought.
David Triple
Greenhorn

Joined: Jul 05, 2011
Posts: 20
Ok so here is what im got now, but all my card variables are not working?
I have no idea whats going on

 
GeeCON Prague 2014
 
subject: How to get these two classes to interact?