ClosePath class is a part of JavaFX. ClosePath class closes the path by connecting the two unconnected ends of a specified path. ClosePath class inherits PathElement class.
Constructor of the class:
- ClosePath() : Creates a new Closepath Object.
Commonly Used Method:
|toString()||Returns the string representation of ClosePath Object.|
Example: Java program to create a path and add multiple LineTo objects to it and close the path using ClosePath object and display it:
- In this program, we will create a Path object named path.
- Create four LineTo object with specified X and Y coordinates names Lineto, Lineto1, Lineto2, Lineto3.
- Initially the path is not closed so we will close the path by adding a ClosePath object named close.
- Then create a MoveTo object named moveto.
- Now add the MoveTo and Lineto objects to the path.
- Add this path to Group object and add the group object to the scene and add the scene to the stage and call the show() function to display the final results.
Note: The above programs might not run in an online IDE please use an offline compiler.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- JavaFX | Pos Class
- JavaFX | Tab Class
- JavaFX | Hyperlink Class
- JavaFX | Slider Class
- JavaFX | TabPane Class
- JavaFX | VBox Class
- JavaFX | ToolBar Class
- JavaFX | Background Class
- JavaFX | WebView Class
- JavaFX | InnerShadow Class
- JavaFX | SepiaTone Class
- JavaFX | ColorAdjust Class
- JavaFX | MotionBlur Class
- JavaFX | Popup Class
- JavaFX | ToggleButton Class
- JavaFX | Duration Class
- JavaFX | Rectangle2D Class
- JavaFX | ColorInput Class
- JavaFX | CycleMethod Class
- JavaFX | ImagePattern Class
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.