Results 1 to 4 of 4
  1. #1
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default JFrame stops working after method called through acitonListener urgent ;(

    Hello!
    I need to be done with this game in 2 days, I have no time for unexplainable issues like this:
    In my JFrame I got a JPanel panels. Panels is connected to a CardLayout
    so by calling a simple function is switch panel to display.
    I can freely switch between the menu and the Players panel
    But if I switch to Start game it hogs up.

    The damn JFrame refure to repaint nor even respond to exit button clicks!
    Tho it is working, I can see the output, but no repainting is done whatsoever on the jframe!

    Why is this? I call JFrame's repaint() method yet no result! Why?

  2. #2
    demonick is offline Member
    Join Date
    Dec 2010
    Posts
    27
    Rep Power
    0

    Default

    Possibly there is a infinite loop in the Thread that runs the program, that may cause the Frame not to respond, all I can say with no code posted.

  3. #3
    Addez is offline Senior Member
    Join Date
    Aug 2009
    Posts
    294
    Rep Power
    0

    Default

    Well, I didnt want to bother you with 10 classes of code each 400+ lines and attach the 100 images included.
    nEITHER Can I make and example as the fk starts to work then.

    I have no infinity loop going ANYWHERE except in the GameLogic. And that class in only initiated, never run before the button click.

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

    Default

    Without code we can only guess, but I agree with demonick that this smells like a Swing concurrency issue, that you've likely got your own game loop going on in the game logic portion of the code, and you're calling it on the main Swing thread, the EDT (event dispatch thread), effectively freezing the GUI. Are you using a background thread such as a SwingWorker or a Swing Timer?

    For better help, we'll need to see code.

Similar Threads

  1. Replies: 5
    Last Post: 10-22-2010, 01:55 PM
  2. Timer stops working :P
    By Addez in forum New To Java
    Replies: 13
    Last Post: 09-21-2010, 08:36 PM
  3. Why the paint() method is called two times ?
    By supremo in forum New To Java
    Replies: 4
    Last Post: 06-03-2010, 06:21 PM
  4. JFrame Hanging When Called From Another Class
    By al_Marshy_1981 in forum AWT / Swing
    Replies: 5
    Last Post: 03-30-2010, 07:04 PM
  5. what made paintComponent() method to be called twice??
    By Y. Progammer in forum New To Java
    Replies: 5
    Last Post: 02-21-2010, 10:19 PM

Posting Permissions

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