Advertisement
shamiul93

Untitled

Jan 15th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. package tele.communication.system.application;
  2.  
  3. import java.util.logging.Level;
  4. import java.util.logging.Logger;
  5. import javafx.application.Application;
  6. import javafx.scene.Group;
  7. import javafx.scene.Scene;
  8. import javafx.scene.image.Image;
  9. import javafx.scene.image.ImageView;
  10. import javafx.scene.input.MouseEvent;
  11. import javafx.scene.paint.Color;
  12. import javafx.scene.shape.Rectangle;
  13. import javafx.scene.text.Font;
  14. import javafx.scene.text.Text;
  15. import javafx.stage.Stage;
  16.  
  17. /**
  18. *
  19. * @author HAROLD FINCH
  20. */
  21. public class Home extends Application {
  22.  
  23. public static Stage stage;
  24. public static Group root;
  25. public static Scene scene;
  26.  
  27. @Override
  28. public void start(Stage primaryStage) throws Exception {
  29. stage = primaryStage;
  30. HomeScene();
  31. }
  32.  
  33. public void HomeScene() {
  34. BackSceneOnly();
  35. ImageView homeimg = new ImageView("file:homepage.jpg");
  36. root.getChildren().add(homeimg);
  37. Text us = new Text("USER PART");
  38. Text em = new Text("EMPLOYEE PART");
  39. us.setX(900);
  40. us.setY(435);
  41. us.setFill(Color.rgb(216, 231, 232));
  42. us.setFont(Font.font(80));
  43. em.setX(810);
  44. em.setY(635);
  45. em.setFill(Color.rgb(216, 231, 232));
  46. em.setFont(Font.font(80));
  47. Rectangle userboxdown = new Rectangle(700, 120);
  48. userboxdown.setFill(Color.rgb(18, 55, 97, 0.8));
  49. userboxdown.relocate(750, 350);
  50. Rectangle userboxup = new Rectangle(700, 120);
  51. userboxup.setFill(Color.rgb(0, 0, 0, 0));
  52. userboxup.relocate(750, 350);
  53. userboxup.addEventHandler(MouseEvent.MOUSE_CLICKED, (MouseEvent e) -> {
  54. User_UI user = new User_UI();
  55. try {
  56. user.go();
  57. } catch (Exception ex) {
  58. Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex);
  59. }
  60. });
  61. userboxup.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> {
  62. userboxdown.setFill(Color.rgb(18, 55, 97, 1));
  63. });
  64. userboxup.addEventHandler(MouseEvent.MOUSE_EXITED, e -> {
  65. userboxdown.setFill(Color.rgb(18, 55, 97, 0.8));
  66. });
  67.  
  68. Rectangle empboxdown = new Rectangle(700, 120);
  69. empboxdown.setFill(Color.rgb(18, 55, 97, 0.8));
  70. empboxdown.relocate(750, 550);
  71. Rectangle empboxup = new Rectangle(700, 120);
  72. empboxup.setFill(Color.rgb(0, 0, 0, 0));
  73. empboxup.relocate(750, 550);
  74. empboxup.addEventHandler(MouseEvent.MOUSE_CLICKED, (MouseEvent e) -> {
  75. Employee_UI emp = new Employee_UI();
  76. try {
  77. emp.go();
  78. } catch (Exception ex) {
  79. Logger.getLogger(Home.class.getName()).log(Level.SEVERE, null, ex);
  80. }
  81. });
  82. empboxup.addEventHandler(MouseEvent.MOUSE_ENTERED, e -> {
  83. empboxdown.setFill(Color.rgb(18, 55, 97, 1));
  84. });
  85. empboxup.addEventHandler(MouseEvent.MOUSE_EXITED, e -> {
  86. empboxdown.setFill(Color.rgb(18, 55, 97, 0.8));
  87. });
  88. root.getChildren().add(userboxdown);
  89. root.getChildren().add(us);
  90. root.getChildren().add(userboxup);
  91. root.getChildren().add(empboxdown);
  92. root.getChildren().add(em);
  93. root.getChildren().add(empboxup);
  94. StageShow();
  95. }
  96.  
  97. public static void BackSceneOnly() {
  98. root = new Group();
  99. //Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();
  100. scene = new Scene(root, 1800, 900);
  101. scene.setFill(Color.rgb(255, 255, 255));//rgb(red, green, blue)
  102. }
  103.  
  104. public static void StageShow() {
  105. stage.setTitle("HOME");
  106. stage.setScene(scene);
  107. Image logo = new Image("file:comlogo.png");
  108. stage.getIcons().add(logo);
  109. stage.show();
  110. }
  111.  
  112. public static void main(String[] args) {
  113. launch(args);
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement