Search:

Type: Posts; User: Sizzlewump

Search: Search took 0.08 seconds.

  1. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Ok, got it!



    /*Created by John Thrush 06/25/18
    WizMapMaker is a video game supplement
    that works as a drawing tool. The application creates
    an array of buttons which the user can...
  2. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Hi Norm, thanks again for all of your help! It took me some time to process your suggestions but I have been able to get the code down to 203 lines with your help. I'm very happy with the results!
    ...
  3. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Yes, that's where I would like to go with it. I wanted to get you the working version and go from there. When I was testing, I just commented out lines 119-622.
  4. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Yes, ok that's a good possibility. Here is the entire working code. I commented out the possible solution we were collaborating on for now. Thanks again for looking at this. Good help is hard to...
  5. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    No, the for loop never executes. I put any print statement in the loop and nothing outputs.

    What is the concept I'm missing - inheritance? Do you see the problem anywhere? I'm sorry, I'm a little...
  6. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    It looks like all of the oButtonNames[] elements have null values at 104. I put a few System.out.println(oButtonNames[1]); statements outside of the loop, replacing the 1 with other array indexes....
  7. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Thanks, I had to reorganize my resource files. The .java file was in a different folder than the .pngs by mistake. I reran and got a similar error:



    Exception in thread "main"...
  8. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Yes, the way the previewLabel works in the long code (an actionListener coded separately for each of the oButtons) is it's like a little thumbnail preview of the last .png button which was clicked...
  9. Re: Trying to loop actionListeners together for 56 JButton objects to reduce code size

    WizMapMakerEdit.java:110: error: local variables referenced from an inner class must be final or effectively final
    previewLabel.setIcon(new...
  10. Trying to loop actionListeners together for 56 JButton objects to reduce code size

    Hi, can someone help me understand what I need to do to reduce my code size so I won't need 56 separate methods to add all of my actionListeners for a JButton array? I'll just include smaller chunks...
Results 1 to 10 of 10