Results 1 to 2 of 2
Thread: Repainting From Another Class
- 11-12-2009, 08:33 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 5
- Rep Power
- 0
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!
-
Similar Threads
-
[SOLVED] How to pass information from child class to parent class
By pellebye in forum New To JavaReplies: 7Last Post: 05-06-2009, 12:42 PM -
[SOLVED] Repainting in a thread
By Kephix in forum Threads and SynchronizationReplies: 2Last Post: 04-19-2009, 06:13 AM -
problem in accessing array values of one class in to jframe class
By cenafu in forum AWT / SwingReplies: 8Last Post: 03-21-2009, 09:34 AM -
repainting lines separately
By rstepler in forum Java 2DReplies: 8Last Post: 07-07-2008, 02:46 AM -
Able to find class file in WEB-INF/classes but not after add sub folders in class dir
By vitalstrike82 in forum Web FrameworksReplies: 0Last Post: 05-13-2008, 06:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks