Question:
there is the weird error appering
Repl link:
Ephraim mart (JavaFX) - Replit
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.scene.Group;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.geometry.Pos;
import javafx.event.EventHandler;
import javafx.event.ActionEvent;
import static java.lang.System.out;
// lets you type "out.println();"instead of "System.out.println();"
import java.util.Scanner;
// lets access the Scanner class
public class Main extends Application {
static String txt;
@Override
public void start(Stage primaryStage) {
Label label;
TextField tf;
Button yButton;
Button nButton;
VBox vbox;
HBox hbox;
Scene scene;
// tf = new TextField("Yes/No");
// tf.setMaxWidth(200);
txt = """
Hello! Welcome to \"Ephraim's SuperStore\"!
In this store you can: dine at the
legendary EPHRAIM'S FAST-FOOD BAR,
buy quality produce at Ephraim mart,
use our quality ATM, or play on the
slots machine
First, I have a question for you. Are you
the owner or CEO of this magnificent store?
""";
label = new Label(txt);
yButton = new Button("YES");
nButton = new Button("NO");
yButton.setTranslateX(-50);
yButton.setTranslateY(20);
nButton.setTranslateX(50);
nButton.setTranslateY(10);
vbox = new VBox(label);
vbox.setSpacing(5);
vbox.setAlignment(Pos.CENTER);
hbox = new HBox(yButton, nButton);
scene = new Scene(vbox, hbox, 600, 400);
primaryStage.setTitle("EphraimMart");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
Scanner input = new Scanner(System.in);
out.print("\033[H\033[2J");
out.flush();
// an ASCI code to clear the console
out.println("Which version do you want: \n 1) JavaFX (graphical) \n 2) Java (text)?");
String answer = input.nextLine();
if (answer.equals("1")) {
out.println("Please watch the output screen and click fullscreen");
launch(args);
} else {
EPStore.initialize();
}
}
}
note: this this happened after I added this
txt = """
Hello! Welcome to \"Ephraim's SuperStore\"!
In this store you can: dine at the
legendary EPHRAIM'S FAST-FOOD BAR,
buy quality produce at Ephraim mart,
use our quality ATM, or play on the
slots machine
First, I have a question for you. Are you
the owner or CEO of this magnificent store?
""";