import java.util.regex.Matcher; import java.util.regex.Pattern; import javafx.application.Application; import javafx.application.Platform; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.text.Font; import javafx.scene.text.FontWeight; import javafx.geometry.Insets; import javafx.geometry.Pos; public class RegexTest extends Application { /* Define TextArea and TextField as instance variables * so they can be used throughout the program. Not needed * in this program, but fairly typical in more complex * programs. */ /** * Start method builds the GUI and shows the window. */ public void start(Stage stage) { // Initial text for TextField. // Initial text for TextField. // Initial text for TextArea /* Create and configure the TextField and TextArea */ regexInput.setPrefColumnCount(20); titleInput.setPrefColumnCount(20); contentInput.setText(content); contentInput.setPrefRowCount(6); contentInput.setPrefColumnCount(30); /* A button that will clear the TextArea. It also selects all of the * text in the TextField and gives the focus to the TextField. If the * user just starts typing at that point, the old text will be deleted * and replaced with what the user types. */ quitButton.setOnAction( e -> { Platform.exit(); }); runButton.setOnAction( e -> { findAndReplace(); }); HBox buttonBar = new HBox( 20, runButton, quitButton); buttonBar.setAlignment(Pos.CENTER); GridPane root = new GridPane(); //Adding all elements along with labels root.add(regexInput, 1, 0); root.add(titleInput, 1, 1); root.add(contentInput, 1, 2); root.setStyle("-fx-background-color: #444444"); root.add(buttonBar, 1, 3); /* Add the scene to the window and make it visible. */ Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("Regex Test Harness"); stage.show(); } // end start() public void findAndReplace() { //getting all text input //creating a pattern, case sensitive //creating a matcher Pattern pattern = Pattern.compile(regex); Matcher matcher = pattern.matcher(inputtext); output.setText(done); } launch(args); } }
Standard input is empty
Main.java:21: error: class RegexTest is public, should be declared in a file named RegexTest.java public class RegexTest extends Application { ^ Main.java:4: error: package javafx.application does not exist import javafx.application.Application; ^ Main.java:5: error: package javafx.application does not exist import javafx.application.Platform; ^ Main.java:6: error: package javafx.stage does not exist import javafx.stage.Stage; ^ Main.java:7: error: package javafx.scene does not exist import javafx.scene.Scene; ^ Main.java:8: error: package javafx.scene.layout does not exist import javafx.scene.layout.BorderPane; ^ Main.java:9: error: package javafx.scene.layout does not exist import javafx.scene.layout.GridPane; ^ Main.java:10: error: package javafx.scene.layout does not exist import javafx.scene.layout.HBox; ^ Main.java:11: error: package javafx.scene.control does not exist import javafx.scene.control.TextArea; ^ Main.java:12: error: package javafx.scene.control does not exist import javafx.scene.control.TextField; ^ Main.java:13: error: package javafx.scene.control does not exist import javafx.scene.control.Button; ^ Main.java:14: error: package javafx.scene.control does not exist import javafx.scene.control.Label; ^ Main.java:15: error: package javafx.scene.text does not exist import javafx.scene.text.Font; ^ Main.java:16: error: package javafx.scene.text does not exist import javafx.scene.text.FontWeight; ^ Main.java:17: error: package javafx.geometry does not exist import javafx.geometry.Insets; ^ Main.java:18: error: package javafx.geometry does not exist import javafx.geometry.Pos; ^ Main.java:21: error: cannot find symbol public class RegexTest extends Application { ^ symbol: class Application Main.java:29: error: cannot find symbol private TextField regexInput; ^ symbol: class TextField location: class RegexTest Main.java:30: error: cannot find symbol private TextField titleInput; ^ symbol: class TextField location: class RegexTest Main.java:31: error: cannot find symbol private TextArea contentInput; ^ symbol: class TextArea location: class RegexTest Main.java:32: error: cannot find symbol private TextArea output; ^ symbol: class TextArea location: class RegexTest Main.java:37: error: cannot find symbol public void start(Stage stage) { ^ symbol: class Stage location: class RegexTest Main.java:49: error: cannot find symbol regexInput = new TextField(regex); ^ symbol: class TextField location: class RegexTest Main.java:50: error: cannot find symbol regexInput.setFont( Font.font(null, FontWeight.BOLD, 20) ); ^ symbol: variable FontWeight location: class RegexTest Main.java:50: error: cannot find symbol regexInput.setFont( Font.font(null, FontWeight.BOLD, 20) ); ^ symbol: variable Font location: class RegexTest Main.java:55: error: cannot find symbol titleInput = new TextField(title); ^ symbol: class TextField location: class RegexTest Main.java:56: error: cannot find symbol titleInput.setFont( Font.font(null, FontWeight.BOLD, 20) ); ^ symbol: variable FontWeight location: class RegexTest Main.java:56: error: cannot find symbol titleInput.setFont( Font.font(null, FontWeight.BOLD, 20) ); ^ symbol: variable Font location: class RegexTest Main.java:59: error: cannot find symbol contentInput = new TextArea(); ^ symbol: class TextArea location: class RegexTest Main.java:61: error: cannot find symbol contentInput.setFont( Font.font(16) ); ^ symbol: variable Font location: class RegexTest Main.java:71: error: cannot find symbol Button quitButton = new Button("Quit"); ^ symbol: class Button location: class RegexTest Main.java:71: error: cannot find symbol Button quitButton = new Button("Quit"); ^ symbol: class Button location: class RegexTest Main.java:73: error: cannot find symbol Platform.exit(); ^ symbol: variable Platform location: class RegexTest Main.java:76: error: cannot find symbol Button runButton = new Button("Run Regex"); ^ symbol: class Button location: class RegexTest Main.java:76: error: cannot find symbol Button runButton = new Button("Run Regex"); ^ symbol: class Button location: class RegexTest Main.java:83: error: cannot find symbol HBox buttonBar = new HBox( 20, runButton, quitButton); ^ symbol: class HBox location: class RegexTest Main.java:83: error: cannot find symbol HBox buttonBar = new HBox( 20, runButton, quitButton); ^ symbol: class HBox location: class RegexTest Main.java:84: error: cannot find symbol buttonBar.setAlignment(Pos.CENTER); ^ symbol: variable Pos location: class RegexTest Main.java:87: error: cannot find symbol GridPane root = new GridPane(); ^ symbol: class GridPane location: class RegexTest Main.java:87: error: cannot find symbol GridPane root = new GridPane(); ^ symbol: class GridPane location: class RegexTest Main.java:108: error: cannot find symbol BorderPane.setMargin(regexInput, new Insets(2,2,0,2)); ^ symbol: class Insets location: class RegexTest Main.java:108: error: cannot find symbol BorderPane.setMargin(regexInput, new Insets(2,2,0,2)); ^ symbol: variable BorderPane location: class RegexTest Main.java:109: error: cannot find symbol BorderPane.setMargin(contentInput, new Insets(2)); // Set margins around components ^ symbol: class Insets location: class RegexTest Main.java:109: error: cannot find symbol BorderPane.setMargin(contentInput, new Insets(2)); // Set margins around components ^ symbol: variable BorderPane location: class RegexTest Main.java:110: error: cannot find symbol BorderPane.setMargin(titleInput, new Insets(2,2,0,2)); ^ symbol: class Insets location: class RegexTest Main.java:110: error: cannot find symbol BorderPane.setMargin(titleInput, new Insets(2,2,0,2)); ^ symbol: variable BorderPane location: class RegexTest Main.java:114: error: cannot find symbol Scene scene = new Scene(root); ^ symbol: class Scene location: class RegexTest Main.java:114: error: cannot find symbol Scene scene = new Scene(root); ^ symbol: class Scene location: class RegexTest Main.java:156: error: cannot find symbol launch(args); ^ symbol: method launch(String[]) location: class RegexTest 49 errors
Standard output is empty