Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To write a program which makes different shapes. There is a button that reduces the largest circle by 5px.
- Requirements:
- 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).
- 2) There is A BUTTON on screen which calls out Util.getBiggestCircle(main.getChildren()) – this means that shapes must be placed inside main.
- 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.
- 4) When reducing the RADIUS OF CIRCLE you need to use some kind of animation(for example reduces slowly during 0.5sec)
- When pressing the button multiple times all the circles should eventually disappear(radius=0).
- You must use this code:
- import javafx.collections.ObservableList;
- import javafx.scene.Node;
- import javafx.scene.shape.Circle;
- public class Util {
- /**
- * Given a list of Node elements (in JavaFX, containers
- * have a method getChildren() which returns an observable
- * list of child elements (buttons, textboxes etc. and also
- * other containers) return the circle object with the largest
- * radius. The list can contain other elements beside Circle object.
- *
- * @param children A list of child nodes
- * @return The circle with the largest radius
- */
- public static Circle getBiggestCircle(ObservableList<Node> children) {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement