i was wondering if it is possible to make up the name of the label by some mean concatenating the value of "i"to the word cover and then turning into the object so i can pass it to the general method and remove the need for the switch statement
Or it would be much nicer and more object-oriented if the thing calling that switch-case code had an actual reference to the JLabel to be worked on, rather than just an int value representing that JLabel. That's what I would urge you to try, really.
File note: you don''t need to use double slashes when coding filepaths as strings in universal form. Forward ("real") slashes are OK with just 1 slash between levels, although URLs have a different and unrelated convention.
The reason you have to double up on backslashes is because in Java and in the Unix/Linux OS world, backslash has an alternative meaning that has to be escaped.
I second the idea of having an array for the label controls and image paths. But if you're actually changing the same point on the screen, what you probably should be doing isn't swapping in JLabels, but rather simply updating the JLabel that's already there.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
global solutions you can do at home or in your backyard