Results 1 to 2 of 2
  1. #1
    habester is offline Member
    Join Date
    Nov 2009
    Posts
    5
    Rep Power
    0

    Default 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!
    Attached Files Attached Files

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Hard to say given the information as presented. Consider creating and posting an SSCCE.

Similar Threads

  1. Replies: 7
    Last Post: 05-06-2009, 01:42 PM
  2. [SOLVED] Repainting in a thread
    By Kephix in forum Threads and Synchronization
    Replies: 2
    Last Post: 04-19-2009, 07:13 AM
  3. Replies: 8
    Last Post: 03-21-2009, 10:34 AM
  4. repainting lines separately
    By rstepler in forum Java 2D
    Replies: 8
    Last Post: 07-07-2008, 03:46 AM
  5. Replies: 0
    Last Post: 05-13-2008, 07:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •