java - Testfx 4 Getting started -
i want implement simple gui test using testfx 4 on adjusted oracle 'hello world' javafx tutorial. based on testfx tutorial, git website unclear have start, , need.
could please guide me in right direction? side note, have added necessary dependencies in pom.xml
<repositories> <repository> <id>maven-central-repo</id> <url>http://repo1.maven.org/maven2</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <dependencies> <dependency> <groupid>org.testfx</groupid> <artifactid>testfx-core</artifactid> <version>4.0.1-alpha</version> <scope>test</scope> </dependency> <dependency> <groupid>org.testfx</groupid> <artifactid>testfx-junit</artifactid> <version>4.0.1-alpha</version> <scope>test</scope> </dependency> </dependencies>
here adjusted hello world
example
public class helloworld extends application { public static void main(string[] args) { launch(args); } @override public void start(stage primarystage) { primarystage.settitle("hello world!"); button btn = new button(); label label = new label(); btn.settext("say 'hello world'"); label.settext("welcome"); btn.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent event) { label.settext("hello world."); } }); gridpane grid = new gridpane(); grid.setalignment(pos.center); grid.sethgap(10); grid.setvgap(10); grid.setpadding(new insets(10, 10, 10, 10)); scene scene = new scene(grid, 300, 275); primarystage.setscene(scene); grid.add(label, 0, 0); grid.add(hellobutton, 0, 1); primarystage.show(); } }
Comments
Post a Comment