// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
package fxtest;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextArea;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage;

public class TestGUI extends Application {
	public static void main(String[] args) {
		Application.launch(TestGUI.class, args);
	}
	@Override
	public void start(Stage stg) throws Exception {
		stg.setTitle("This is a test");
		final TextArea ta = new TextArea();
		ta.setId("myta");
		Button btn = new Button("Double");
		btn.setOnAction(new EventHandler<ActionEvent>() {
			public void handle(ActionEvent ev) {
				ta.setText(ta.getText() + ta.getText());
			}
		});
		BorderPane p = new BorderPane();
		p.setPrefSize(400, 400);
		p.setCenter(ta);
		p.setBottom(btn);
		Scene scene = new Scene(p);
		scene.getStylesheets().add(getClass().getResource("test.css").toString());
		stg.setScene(scene);
		stg.show();
	}
}
