Advertisement
RazorBlade57

----------------

Apr 2nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. package light;
  2. import javafx.application.*;
  3. import javafx.util.*;
  4. import javafx.scene.shape.*;
  5. import javafx.geometry.*;
  6. import javafx.scene.*;
  7. import javafx.stage.Stage;
  8.  
  9. import java.awt.Color;
  10.  
  11. import javafx.*;
  12. public class Traffic_light {
  13.  
  14. public void start(Stage pStage) {
  15. Pane pane = new Pane();
  16. Circle redLight = new Circle(paneWidth/2,30,12);
  17. Circle yellowLight = new Circle(paneWidth/2,60,12);
  18. Circle greenLight = new Circle(paneWidth/2,90,12);
  19. redLight.setStroke(Color.BLACK);
  20. redLight.setFill(Color.WHITE);
  21. yellowLight.setStroke(Color.BLACK);
  22. yellowLight.setFill(Color.WHITE);
  23. greenLight.setStroke(Color.BLACK);
  24. greenLight.setFill(Color.WHITE);
  25.  
  26. Rectangle rect = new Rectangle(paneWidth /2,-25,5,30,100);
  27. rect.setStroke(Color.BLACK);
  28. rect.setFill(Color.BEIGE);
  29.  
  30. pane.getChildren.addAll(rect, redLight, yellowLight, greenLight);
  31.  
  32. Scene scene = new Scene(pane,paneWidth,paneHeight);
  33. pstage.setTitle("Traffic Light");
  34. pStage.setScene(scene);
  35. pStage.show();
  36. }
  37.  
  38.  
  39. public static void main(String[] args) {
  40.  
  41.  
  42. Launch(args);
  43.  
  44. }
  45.  
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement