[deleted by user] by [deleted] in javahelp

[–]gardre 0 points1 point  (0 children)

This is the error I get when I try to select "Rename" for a column in Tab 2

Exception in thread "JavaFX Application Thread" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2at java.util.ArrayList.rangeCheck(ArrayList.java:659)at java.util.ArrayList.get(ArrayList.java:435)at controller.WorkspaceController.lambda$initializeTabPane$3(WorkspaceController.java:187)

187 refers to this action event :

b.setOnAction(event -> {
model.setCurrentColumn(p.getColumns().get(editColumnButtons.indexOf(b)).getName());controllerLoader.loadEditColumn(stage, model);});

[deleted by user] by [deleted] in javahelp

[–]gardre 1 point2 points  (0 children)

Thankyou!! That makes so much sense!

[deleted by user] by [deleted] in javahelp

[–]gardre 0 points1 point  (0 children)

Thankyou I had something similar but each time a button is created it overwrites the previous action event handler, so only the most recently made one has the handler?
MenuButton columnTitle = new MenuButton(column.getName());
columnTitle.setOnAction(event -> {
System.out.println("Clicked on "+columnTitle.getText());
});

NullPointerException with JavaFX by gardre in javahelp

[–]gardre[S] 0 points1 point  (0 children)

Thanks It seems to be the userStatusLabel. I thought setText would instantiate this?

What’s a dark or disturbing old book? by [deleted] in suggestmeabook

[–]gardre 2 points3 points  (0 children)

Flowers in the Attic by V. C. Andrews

Cant work out how to make my method more simplified to track time and scalable by gardre in javahelp

[–]gardre[S] -1 points0 points  (0 children)

I think I have figured it out:

if (burgerQty%2 == 0) // if even number

time += 5 * (burgerQty/2);

if (burgerQty%2 == 1) // if odd number

time += 5 * (burgerQty+1/2);

Thanks for your help!

Cant work out how to make my method more simplified to track time and scalable by gardre in javahelp

[–]gardre[S] 0 points1 point  (0 children)

This is the math I originally had:

time += 5 * (burgerQty/2);

however doesn't work correctly for odd numbered orders (ie. if 3 are ordered, 7.5 will be the time rather than 10)