I've been trying to work on an assignment but I've hit a roadblock. So I'm suppose to create a gui using JavaFX without the help of Scenebuilder. Let me explain what I'm trying to do.
I've set up two stages, primaryStage and secondaryStage. primaryStage has a button while secondaryStage has the textArea. So I've set the button's action to switch from primaryStage to secondaryStage using:
btnINV.setOnAction(e ->
{
secondaryStage.show();
primaryStage.close();
});
But, what I'd also like to do at the same time is when the button is clicked, it would run a method that would also print some things onto the textArea. Here's the method I'm trying to use:
public static void printStock()
{
System.out.println("---Food & Drinks Inventory Edit---");
System.out.println("\nNo\tItem Name\t\tType\t\t\t\tStock");
System.out.println("------------------------------------------------------------------");
for (int i = 0; i < item.length; i++)
{
System.out.print(i + "\t");
item[i].showmenu();
}
}
while showmenu(); being a method in another java file that does:
public void showmenu()
{
String x = null;
switch (this.type)
{
case 'a':
x = "Meat\t\t\t";
break;
case 'b':
x = "Oil, Vinegar & condiments";
break;
case 'c':
x = "Seasonings\t\t";
break;
case 'd':
x = "Canned Items\t\t";
break;
case 'e':
x = "Grains\t\t\t";
break;
case 'f':
x = "Fridge Basics\t\t";
break;
case 'g':
x = "Fruits\t\t\t";
break;
case 'h':
x = "Vegetables\t\t";
break;
}
System.out.println(this.name + "\t" + x + "\t" + this.stock + " " + this.msm);
}
I'm really quite stumped at what to do from here on out. I'd figured that maybe I'd change the method from void to String and try to return something that way but I've no idea how.