Search:

Type: Posts; User: Norm

Search: Search took 0.10 seconds.

  1. Re: Working on a phdgets Project for Computer Science Need some Help.

    This statement does that:
    score +=5;

    How will that change what is shown in the JLabel? You have to call a JLabel method to change its contents.
  2. Re: Working on a phdgets Project for Computer Science Need some Help.

    Where do you change the text being shown in the JLabel? The code sets it one time when it creates it:
    scoreBoard=new JLabel("Score: " + score);
  3. Re: Working on a phdgets Project for Computer Science Need some Help.

    Post the code you are having problems with.
  4. Re: Working on a phdgets Project for Computer Science Need some Help.

    You should read the image files once before using them and NOT read them every time you use them.
    Your code appears to read in the image files in two places????

    Add a JLabel and change its text.
  5. Re: Working on a phdgets Project for Computer Science Need some Help.

    What is the value of image1 etc in the listener method when you try to use them?

    You should initialize noDoubles with an invalid value.

    Your use of currRand is confusing. I'd expect it to be...
  6. Re: Working on a phdgets Project for Computer Science Need some Help.

    Ok that sounds reasonable. Save the last one used and check it against the one generated by nextInt() to see if different. If the same, get a new one. If different use it and save for testing next...
  7. Re: Working on a phdgets Project for Computer Science Need some Help.

    Use some logic. What number do you want to save so you do not repeat it? When is that number known for sure? Certainly not when you get a new random number.
    What about after you have determined that...
  8. Re: Working on a phdgets Project for Computer Science Need some Help.

    currRand = rand.nextInt(2);
    noDoubles = currRand;

    if(currRand==noDoubles
    When will the if test every be false? You've just set the two variables =

    What happens when you execute the...
  9. Re: Working on a phdgets Project for Computer Science Need some Help.

    Keep track of the numbers as they are generated and change it if the same as last one.

    You should only load the images one time and use them in the listener.
    Don't load them every call to the...
  10. Re: Working on a phdgets Project for Computer Science Need some Help.

    Get rid of the while() loop. Use only one label and change its icon in the timer listener method.
  11. Re: Working on a phdgets Project for Computer Science Need some Help.

    What parts of the code are you having problems with?
    The timer?
    The changing of the components being shown?
Results 1 to 11 of 11