Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get these two classes to interact?

 
David Triple
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant get his to work
 
David Triple
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If read your question multiple times but I'm still not sure what you want. Could you explain it a bit more?
 
David Triple
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Remember that the Java naming convention for variables is that they should begin with a lowercase letter.
 
srikanth kumar aruru
Greenhorn
Posts: 4
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Triple
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so here is what im got now, but all my card variables are not working?
I have no idea whats going on

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic