Created
September 21, 2017 18:53
-
-
Save mik30s/7806963075d2da432e07fcfea0d50bbc to your computer and use it in GitHub Desktop.
A dumb text editor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lab.pkg2.texteditor; | |
import javafx.application.Application; | |
import javafx.scene.Scene; | |
import javafx.scene.control.TextArea; | |
import javafx.scene.layout.StackPane; | |
import javafx.stage.Stage; | |
public class Lab2TextEditor extends Application { | |
/** | |
* Prepares gui components for rendering | |
* @param primaryStage | |
*/ | |
@Override | |
public void start(Stage primaryStage) { | |
StackPane root = new StackPane(); | |
String prompt = "Type here..."; | |
Scene scene = new Scene(root, 300, 250); | |
TextArea textarea = new TextArea(prompt); | |
textarea.positionCaret(prompt.length()); | |
textarea.positionCaret(5); | |
root.getChildren().add(textarea); | |
primaryStage.setTitle("Lab 2 - text editor"); | |
primaryStage.setScene(scene); | |
primaryStage.show(); | |
} | |
/** | |
* Entry point of the app | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
launch(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment