Results 1 to 2 of 2
Thread: Repainting From Another Class
- 11-12-2009, 09:33 PM #1Member
- Join Date
- Nov 2009
- Rep Power
Repainting From Another Class
Since I have been having problems with multiple panels in my JFrame, I decided to put all of the paint components for my graphics into one panel.
My current structure is:
Game (sets up, runs timer to run update movements)
MyLevel(Adds panel to frame with the level, keyboard listener to track player movements)
MakeLevel(Puts each level component into one paint function)
Player(Has players functions to update X and Y, jump, etc.)
The problem now is that although it is much easier to organize and draw each part of the game, I have lost the ability to use repaint in the Player class (Player paint function used to reside in Player).
I was considering using a Player function to return the players x and y coordinates to MakeLevel, then repainting the specific location of the player. However, I can't seem to make it work properly. Any ideas? Thanks for any help!
- By pellebye in forum New To JavaReplies: 7Last Post: 05-06-2009, 12:42 PM
- By Kephix in forum Threads and SynchronizationReplies: 2Last Post: 04-19-2009, 06:13 AM
- By cenafu in forum AWT / SwingReplies: 8Last Post: 03-21-2009, 10:34 AM
- By rstepler in forum Java 2DReplies: 8Last Post: 07-07-2008, 02:46 AM
- By vitalstrike82 in forum Web FrameworksReplies: 0Last Post: 05-13-2008, 06:16 AM