Advertisement
myshkin1

Untitled

Apr 17th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. To write a program which makes different shapes. There is a button that reduces the largest circle by 5px.
  2. Requirements:
  3. 1) After a click ON SCREEN with leftmouse the program will create either a circle or rectangle. The probability of circle must be 0.8, probability of rectangle must be 0.2. For both shapes, the dimensions are random(radius for circle OR side lengths of rectangle) BUT THEY MUST BE numbers between 10 to 100 (including).
  4. 2) There is A BUTTON on screen which calls out Util.getBiggestCircle(main.getChildren()) – this means that shapes must be placed inside main.
  5. 3) IF THERE IS A CIRCLE ON SCREEN then you get Circle object after pressing THE BUTTON, then the radius of THE CIRCLE must be reduced by 5px.
  6. 4) When reducing the RADIUS OF CIRCLE you need to use some kind of animation(for example reduces slowly during 0.5sec)
  7. When pressing the button multiple times all the circles should eventually disappear(radius=0).
  8.  
  9. You must use this code:
  10.  
  11. import javafx.collections.ObservableList;
  12. import javafx.scene.Node;
  13. import javafx.scene.shape.Circle;
  14.  
  15. public class Util {
  16. /**
  17. * Given a list of Node elements (in JavaFX, containers
  18. * have a method getChildren() which returns an observable
  19. * list of child elements (buttons, textboxes etc. and also
  20. * other containers) return the circle object with the largest
  21. * radius. The list can contain other elements beside Circle object.
  22. *
  23. * @param children A list of child nodes
  24. * @return The circle with the largest radius
  25. */
  26. public static Circle getBiggestCircle(ObservableList<Node> children) {
  27. return null;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement