Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Programming Articles - Page 2009 of 3366
453 Views
In general, a 2D shape is a geometrical figure that can be drawn on the XY plane, these include Line, Rectangle, Circle, etc.The javafx.scene.shape package provides you, various classes, each of them represents/defines a 2d geometrical object or, an operation on them. The class named Shape is the base class of all the 2-Dimensional shapes in JavaFX.Creating 2D shapesTo draw a 2D geometrical shape using JavaFX you need to −Instantiate the class − Instantiate the respective class. For example, if you want to draw a circle you need to instantiate the Circle class as shown below −//Drawing a Circle Circle ... Read More
221 Views
This is class represents the path element arc. It helps you to draw an arc from the current coordinates to the specified (new) coordinates.To create a line path element −Instantiate the ArcTo class.Set values to the properties of this class using setter methods or, bypassing them to the constructor.Instantiate the Path class.Get the observable list object of the above-created Path using the getElements() method.Add the above created ArcTo object to the observable list using the add() method.Finally, add the path to the Group object.Exampleimport javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.scene.shape.ArcTo; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; import ... Read More
2K+ Views
Suppose we have given the head of a linked list; we have to repeatedly delete consecutive sequences of nodes that sum to 0 until there are no such sequences. So after doing so, we have to return the head of the final linked list. So if the list is like [1, 2, -3, 3, 1], then the result will be [3, 1].To solve this, we will follow these steps −Create a node called dummy, and store 0 into it, set next of dummy := headcreate one map m, store dummy for the key 0 into m, set sum = 0while ... Read More
245 Views
This is class represents the path element cubic curve. It helps you to draw a cubic curve form the current coordinates to the specified (new) coordinates.To create a line path element −Instantiate the CubicCurve class.Set values to the properties of this class using setter methods or, bypassing them to the constructor.Instantiate the Path class.Get the observable list object of the above-created Path using the getElements() method.Add the above created CubicCurve object to the observable list using the add() method.Finally, add the path to the Group object.Exampleimport javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.scene.shape.CubicCurveTo; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; ... Read More
192 Views
This is class represents the path element quadratic curve. It helps you to draw a quadratic curve form the current coordinates to the specified (new) coordinates.To create a line path element −Instantiate the QuadCurveTo class.Set values to the properties of this class using setter methods or, bypassing them to the constructor.Instantiate the Path class.Get the observable list object of the above-created Path using the getElements() method.Add the above created QuadCurveTo object to the observable list using the add() method.Finally, add the path to the Group object.Exampleimport javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; import ... Read More
573 Views
Suppose we have a string text, so we are allowed to swap two of the characters in the string. We have to find the length of the longest substring with repeated characters. So if the input is like “ababa”, then the result will be 3, as if we swap first b with last a, or the last b with first a, then the longest repeated character will be “aaa”, so the length is 3.To solve this, we will follow these steps −Define a map cnt, set ret := 1, j := 0, n := size of text, v := 0, ... Read More
471 Views
Suppose we have two strings text1 and text2, we have to return the length of their longest common subsequence. The ubsequence of a string is a new string generated from the original string with some characters deleted without changing the relative order of the remaining characters. (So for example "abe" is a subsequence of "abcde" but "adc" is not). A common subsequence of two strings is a subsequence that is common to both strings. So If there is no common subsequence, return 0. If the input is like “abcde”, and “ace”, then the result will be 3.To solve this, we ... Read More
302 Views
This is class represents the path element vertical line. It helps you to draw a vertical line from the current coordinates to the specified (new) coordinates.To create a line path element −Instantiate the VLineTo class.Set values to the properties of this class using setter methods or, bypassing them to the constructor.Instantiate the Path class.Get the observable list object of the above-created Path using the getElements() method.Add the above created VLineTo object to the observable list using the add() method.Finally, add the path to the Group object.Exampleimport javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.scene.shape.HLineTo; import javafx.scene.shape.LineTo; import ... Read More
356 Views
This is class represents the path element horizontal line. It helps you to draw a horizontal line form the current coordinates to the specified (new) coordinates.To create a line path element −Instantiate the HLineTo class.Set values to the properties of this class using setter methods or, bypassing them to the constructor.Instantiate the Path class.Get the observable list object of the above-created Path using the getElements() method.Add the above created HLineTo object to the observable list using the add() method.Finally, add the path to the Group object.Exampleimport javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.scene.shape.HLineTo; import javafx.scene.shape.LineTo; import ... Read More