Advertisement
Guest User

Untitled

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