fork download
  1. package tests;
  2.  
  3. import java.util.Arrays;
  4.  
  5. import javafx.application.Platform;
  6. import javafx.collections.FXCollections;
  7. import javafx.scene.Group;
  8. import javafx.scene.Scene;
  9. import javafx.scene.control.Button;
  10. import javafx.scene.control.CheckBox;
  11. import javafx.scene.control.ChoiceBox;
  12. import javafx.scene.control.ComboBox;
  13. import javafx.scene.control.Menu;
  14. import javafx.scene.control.MenuBar;
  15. import javafx.scene.control.MenuItem;
  16. import javafx.scene.control.TextArea;
  17. import javafx.scene.control.TreeItem;
  18. import javafx.scene.control.TreeView;
  19. import javafx.scene.paint.Color;
  20.  
  21. import com.jme3.app.SimpleApplication;
  22. import com.jme3.math.ColorRGBA;
  23. import com.jme3x.jfx.JmeFxContainer;
  24.  
  25. public class TestJavaFX extends SimpleApplication {
  26.  
  27. private static Group root;
  28.  
  29. public static void main(String[] args) {
  30. new TestJavaFX().start();
  31. }
  32.  
  33. @Override
  34. public void simpleInitApp() {
  35. this.setPauseOnLostFocus(false);
  36. this.flyCam.setDragToRotate(true);
  37. final JmeFxContainer jmefx = JmeFxContainer.install(this, getGuiNode(), true, null);
  38. Platform.runLater(new Runnable() {
  39.  
  40. @Override
  41. public void run() {
  42. jmefx.setScene(createScene(), root);
  43. }
  44. });
  45.  
  46. this.guiNode.attachChild(jmefx.getJmeNode());
  47.  
  48. this.viewPort.setBackgroundColor(ColorRGBA.Red);
  49. }
  50.  
  51. public static Scene createScene() {
  52.  
  53. root = new Group();
  54.  
  55. Scene scene = new Scene(root, 600, 600, true);
  56. scene.setFill(new Color(0, 0, 0, 0));
  57.  
  58. final TreeItem<String> treeRoot = new TreeItem<String>("Root node");
  59. treeRoot.getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 1"), new TreeItem<String>("Child Node 2"), new TreeItem<String>("Child Node 3")));
  60. treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList(new TreeItem<String>("Child Node 4"), new TreeItem<String>("Child Node 5")));
  61.  
  62. final TreeView treeView = new TreeView();
  63. treeView.setShowRoot(true);
  64.  
  65. treeView.setRoot(treeRoot);
  66.  
  67. treeRoot.setExpanded(true);
  68. treeView.setLayoutY(100);
  69.  
  70. Button test1 = new Button("Test1");
  71. test1.setLayoutX(500);
  72. test1.setLayoutY(500);
  73. test1.setOnAction(event -> {
  74.  
  75. });
  76.  
  77. CheckBox test2 = new CheckBox("Test2");
  78. test2.setLayoutX(700);
  79. test2.setLayoutY(700);
  80.  
  81. MenuBar bar = new MenuBar();
  82.  
  83. Menu testMenu = new Menu("Test");
  84. bar.getMenus().add(testMenu);
  85. MenuItem i1 = new MenuItem("Entry1");
  86. MenuItem i2 = new MenuItem("Entry2");
  87. Menu sub = new Menu("Submenu");
  88. sub.getItems().addAll(new MenuItem("Sub entry 1"), new MenuItem("Sub Entry 2"));
  89. testMenu.getItems().addAll(i1, sub, i2);
  90.  
  91. TextArea ta = new TextArea();
  92. ta.setOpacity(0.4);
  93. ta.setLayoutX(400);
  94. ta.setLayoutY(300);
  95.  
  96. ChoiceBox cb = new ChoiceBox();
  97.  
  98. cb.setItems(FXCollections.observableArrayList("Alfa", "Beta"));
  99. cb.setLayoutX(300);
  100. cb.setLayoutY(200);
  101.  
  102. ComboBox<String> comboBox = new ComboBox<String>();
  103. comboBox.getItems().addAll("11111", "22222", "3333", "44444", "55555", "6666");
  104. comboBox.setLayoutX(350);
  105. comboBox.setLayoutY(250);
  106.  
  107. root.getChildren().addAll(treeView, test1, bar, test2, ta, cb, comboBox);
  108.  
  109. return scene;
  110. }
  111. }
  112.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:73: error: illegal start of expression
		test1.setOnAction(event -> {
		                         ^
Main.java:73: error: illegal start of expression
		test1.setOnAction(event -> {
		                           ^
Main.java:73: error: ';' expected
		test1.setOnAction(event -> {
		                            ^
Main.java:75: error: illegal start of expression
		});
		 ^
4 errors
stdout
Standard output is empty