Results 1 to 3 of 3
  1. #1
    nuni is offline Member
    Join Date
    Jan 2016
    Rep Power

    Default Waiting Until a Method is Finished

    Me and a partner are working on a project for a programming course. We're building a text based RPG with a main game mode GUI and Combat GUI. Every time we make an attempt to run the combat GUI the screen just appears blank and it is 100% unresponsive (it won't even close without stopping the program). Below is the called method. I'm not sure if there's anything that's directly in front of us that we can't see.
    Java Code:
    private void battleMode(){
            CombatLayout battle = new CombatLayout();
            CCT.combat = true;
            while(CCT.combat == true){
                if(CCT.combat == false){

  2. #2
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: Waiting Until a Method is Finished

    Not much to go on but you are in a tight loop expecting some value to change and then catch it and exit the loop. You could be
    stuck in the event dispatch thread so your while loop will never see the change. But it is hard to tell. How much programming have you
    done using threads, events, timers, painting, frames, and networking? That (and probably more) is what you need to know to write the
    game you describe.

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    MA, USA
    Rep Power

    Default Re: Waiting Until a Method is Finished

    my first attempt would be to get rid of the infinite while loop and hook up an event to the change of that boolean variable.

Similar Threads

  1. Waiting for a method to call before continuing?
    By Xyexs in forum New To Java
    Replies: 8
    Last Post: 11-09-2013, 06:18 PM
  2. wait until method is finished
    By 3.14.TR in forum Threads and Synchronization
    Replies: 4
    Last Post: 12-04-2012, 10:28 PM
  3. Just finished Ch. 2 (need help)
    By Kurtis in forum New To Java
    Replies: 1
    Last Post: 10-08-2012, 03:37 AM
  4. Using Thread waiting() method
    By nicoeschpiko in forum New To Java
    Replies: 7
    Last Post: 12-11-2010, 09:24 PM
  5. Using Thread waiting() method
    By nicoeschpiko in forum Advanced Java
    Replies: 1
    Last Post: 12-11-2010, 04:50 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