This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Need help improving my game

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone, This is my first time posting on Java Ranch Forum.

Here is my problem that I would request for help with. I have created a card matching game using a JPanel as the display are for the game. The game seems to work fine. I still need to solve an issue with the processor, the processor is running at 70% for my simple program. the RAM memory is 25MB. that is quite big compare to Windows solitaire 5MB. I am wondering if my code can be optimize further (reduce size and processor usage.). anyone have any suggestion?

Here are the codes and screenshot attachment of the of my game. My apology if the post is too long.

1. Viewport - to be extended by the main game display

2. BaseFrame - JFrame that will hold the Viewport.

3. MatchDisplay - the actual Display

4. Deck

5.Desk - Place where I put the card

6. Card - finally the last class the card it self.
[Thumbnail for Screenshot.jpg]
Ranch Hand
Posts: 312
MS IE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following are my suggestions.

1. You may not implement all *Listeners in the ViewPort class
2. You may create separate *Listener classes and instantiate them to use within the MatchDisplay class
3. You may merge Deck and Desk classes
4. You may eliminate BaseFrame class and do the needful within the MatchDisplay class
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic