I currently have a variable that I would like to access in a different class but i'm not sure on how I would go about doing so. I have tried doing stuff like int nums = SizeSelect.amount; but that has not worked. Here is the code from the class I'm trying to access the amount varaible.
public class SizeSelect extends BorderPane {
public SizeSelect(){
size8.setOnMouseClicked(e ->{
MainScene.mainStage.setScene(new EnterNamesScene());
int amount = 9;
});
size32.setOnMouseClicked(e ->{
MainScene.mainStage.setScene(new EnterNamesScene());
int amount = 33;
});
size16.setOnMouseClicked(e ->{
MainScene.mainStage.setScene(new EnterNamesScene());
int amount = 17;
});
and here is the code that I'm trying to access that amount varible
public class EnterNames extends BorderPane {
public EnterNames(){
int nums = SizeSelect.amount;
for (int j = 0; j < nums; j++) {
int teamNum = j + 1;
TextField test = new TextField();
test.setPromptText("Enter Team " + teamNum);
box.getChildren().add(test);
test.setMaxWidth(500);
}