• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

How to get these two classes to interact?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cant get his to work
 
David Triple
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Remember that the Java naming convention for variables is that they should begin with a lowercase letter.
 
Greenhorn
Posts: 4
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Just the other day, I was thinking ... about this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic