Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.42 KB | None | 0 0
  1. public class FastFoodOrderingSystem extends Application {
  2. String host = "jdbc:derby://localhost:1527/fooder";
  3. String username = "cho";
  4. String password = "cho";
  5. suport support = new suport();
  6. String str;
  7. String str1;
  8.  
  9. @Override
  10. public void start( final Stage primaryStage) {
  11. Group root = new Group();
  12. Scene scene = new Scene(root, 1000, 650, Color.ORANGE);
  13.  
  14. ImageView iv = new ImageView("img1a.png");
  15. iv.setLayoutX(330);
  16. iv.setLayoutY(10);
  17. iv.setFitHeight(282);
  18. iv.setFitWidth(500);
  19. iv.setSmooth(true);
  20. iv.setCache(true);
  21.  
  22.  
  23. root.getChildren().addAll(iv);
  24. Text tx = new Text("Name:");
  25. tx.setLayoutX (300);
  26. tx.setLayoutY (430);
  27. tx.setStyle("-fx-fill:white;");
  28. tx.setFont(Font.font("Cataneo BT", FontWeight.BOLD, 40));
  29. tx.setFontSmoothingType(FontSmoothingType.LCD);
  30.  
  31. Text txx = new Text("Address:");
  32. txx.setLayoutX (300);
  33. txx.setLayoutY (490);
  34. txx.setStyle("-fx-fill:white;");
  35. txx.setFont(Font.font("Cataneo BT", FontWeight.BOLD, 40));
  36. txx.setFontSmoothingType(FontSmoothingType.LCD);
  37.  
  38. final TextField tf = new TextField();
  39. tf.setLayoutX (550);
  40. tf.setLayoutY (405);
  41. tf.setPrefSize(300,40);
  42. tf.setPromptText("Enter name");
  43. // root.getChildren().addAll(tx,tf);
  44.  
  45. final TextField tn = new TextField();
  46. tn.setLayoutX (550);
  47. tn.setLayoutY (455);
  48. tn.setPrefSize(300,40);
  49. tn.setPromptText("Enter Address here");
  50. root.getChildren().addAll(tx,tf,tn,txx);
  51.  
  52. Text txt = new Text();
  53. txt.setText("n FAST FOOD ORDERING SYSTEM");
  54. txt.setLayoutX(110);
  55. txt.setLayoutY(5);
  56. txt.setStyle("-fx-fill:white;");
  57. txt.setFont(Font.font("Cataneo BT", FontWeight.BOLD, 55));
  58. txt.setFontSmoothingType(FontSmoothingType.LCD);
  59.  
  60. Rectangle rect2 = new Rectangle();
  61. rect2.setFill(Color.WHITE);
  62. rect2.setLayoutX(0);
  63. rect2.setLayoutY(520);
  64. rect2.setHeight(5);
  65. rect2.setWidth(1500);
  66.  
  67. Button btn = new Button("NEXT");
  68. btn.setPrefSize(200, 50);
  69. btn.setLayoutX(390);
  70. btn.setLayoutY(580);
  71. btn.setStyle("-fx-color:white; -fx-font-weight:bold; -fx-font-family:"Cataneo BT"; -fx-font-size:30");
  72.  
  73. FadeTransition ft = new FadeTransition();
  74. ft.setDuration(Duration.millis(690));
  75. ft.setNode(btn);
  76. ft.setFromValue(1.0);
  77. ft.setToValue(0.5);
  78. ft.setCycleCount(Timeline.INDEFINITE);
  79. ft.setAutoReverse(true);
  80. ft.play();
  81. root.getChildren().add(btn);
  82. btn.setOnAction(new EventHandler<ActionEvent>() {
  83. String str = tn.getText();//address
  84. String str1 = tf.getText();//name
  85.  
  86. @Override
  87. public void handle(ActionEvent event) {
  88. if (tf.getText() == null || tf.getText().trim().isEmpty() || tn.getText() == null || tn.getText().trim().isEmpty()) {
  89. // your code here
  90.  
  91. }else{
  92. // try{
  93. // String sql = "insert into info(name,address) values ('"+tf.getText().toString()+"','"+tn.getText().toString()+"')";//,'"+txtCost.getText().toString()+"')
  94. // Connection con = DriverManager.getConnection(host,username,password);
  95. // Statement stmt = con.createStatement();
  96. // stmt.executeUpdate(sql);
  97. // }catch(SQLException ex){
  98. // //support.showAlert("sql connetion error",ex.getMessage(),Alert.AlertType.ERROR);
  99. // }
  100.  
  101. CreateStage createStage = new CreateStage();
  102. }
  103.  
  104. }
  105. });
  106. // // root.getChildren().add(btn);
  107. primaryStage.setTitle("G16 FOOD ORDERING SYSTEM");
  108. primaryStage.setScene(scene);
  109. primaryStage.setResizable(false);
  110. primaryStage.show();
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement