Vin vin 45 Junior Poster in Training

I made a JavaFX Discord Server for people who like to talk about JavaFX stuff, or need help with certain projects, I really like to work with java, especially with people who are working with JavaFX (:

Here is the discord link: https://discord.gg/yZ3Y3Fd or https://discord.gg/AzFaNU

rproffitt commented: Nice. Be sure to message here as well as we have cookies. (direct messaging.) +0
Vin vin 45 Junior Poster in Training

I made a mistake in the discussion.
I want each texure on each side of the cube, not 6 textures on each side of the cube.
I am really sorry.

rproffitt commented: "Good news everyone!" It appears there are many priors to explore with 1 texture per side! (Zapp Brannigan!) +15
Vin vin 45 Junior Poster in Training

How can I minify my code in here, I am giving each 23 total imageview a eventhandler.
code works, but I like to make the code shorter. I tried to use for loops to shorten the code.
here is a example what I tried to do:

    for (int i = 0 ; i < imgArrayList.size() ; i++) {
        imgArrayList.get(i).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                selectedTile = i;
            }
        });
    }

but it can't because, the "i" inside the handle method is final. I can't pass the "i" inside the handle method.

my goal is, that a specific imageview, that has for example ".get(3)", that needs to print out 3.
so if the imageview have a .get(i), it needs to print out the exact same number of i.
btw, the imageviews are stored in a arraylist, if you are curious where the ".get" comes from.

    protected static void addImageViewMouseEvents() {
        UI_SelectionMenu.imgArrayList.get(0).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                UI_SelectionMenu.selectedTile = 0;
                System.out.println(UI_SelectionMenu.selectedTile);
            }
        });
        UI_SelectionMenu.imgArrayList.get(1).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                UI_SelectionMenu.selectedTile = 1;
                System.out.println(UI_SelectionMenu.selectedTile);
            }
        });
        UI_SelectionMenu.imgArrayList.get(2).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                UI_SelectionMenu.selectedTile = 2;
                System.out.println(UI_SelectionMenu.selectedTile);
            }
        });
        UI_SelectionMenu.imgArrayList.get(3).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                UI_SelectionMenu.selectedTile = 3;
                System.out.println(UI_SelectionMenu.selectedTile);
            }
        });
        UI_SelectionMenu.imgArrayList.get(4).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                UI_SelectionMenu.selectedTile = 4;
                System.out.println(UI_SelectionMenu.selectedTile);
            }
        });
        UI_SelectionMenu.imgArrayList.get(5).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void handle(MouseEvent event) {
                UI_SelectionMenu.selectedTile = 5;
                System.out.println(UI_SelectionMenu.selectedTile);
            }
        });
        UI_SelectionMenu.imgArrayList.get(6).setOnMouseClicked(new EventHandler<MouseEvent>() {

            @Override
            public void …
Vin vin 45 Junior Poster in Training

example of how to use Math.PI:
/
System.out.println(5
Math.PI);
*/

you don't even need to import the java.lang.Math.* thing.

Vin vin 45 Junior Poster in Training

nvm, my keys already are smooth enough XD
I am dumb, this is a dumb post, I facepalmed myself.

rproffitt commented: Smooth. Don't laugh. Optimizing too much is a thing. I was going to comment about something then I see you already did it so you're fine. Good going. +15
Vin vin 45 Junior Poster in Training
rproffitt commented: After all this, I worry you are not getting it. If you have a blocking call, it appears to freeze, but is NOT frozen. +15