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 2008 of 3366
2K+ Views
The stroke width property specifies the width of the boundary line of a shape. You can set the width using the setWidth() method of the javafx.scene.shape.Shape class. This method accepts double value as a parameter and draws a boundary of the specified width.If you haven’t passed any value as a parameter to this method it considers the width as 1.0 by default.Exampleimport javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.Polygon; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; import javafx.stage.Stage; public class StrokeWidthExample extends Application { public void start(Stage stage) { Font font = Font.font("verdana", ... Read More
424 Views
The stroke type property of a shape specifies the type of its boundary line. You can set the stroke type using the setStrokeType() method of the javafx.scene.shape.Shape class.JavaFX supports three kinds of strokes represented by three constants of the Enum named StrokeType they are −StrokeType.INSIDE − Draws the boundary inside the shape.StrokeType.OUTSIDE − Draws the boundary outside the shape.StrokeType.CENTERED − Draws the boundary such that the edge of the shape passes through the center of it.To set a boundary to a shape you need to pass either of these values as a parameter to the setStrokeType()method.Exampleimport javafx.application.Application; import javafx.scene.Group; import ... Read More
454 Views
This operation takes two or more shapes as an input. Then, it returns the area of the first shape excluding the area overlapped by the second one as shown below.The subtract() (static) method of the javafx.scene.shape.Shape class accepts two Shape objects and returns the result of the subtract operation of the given objects.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.Circle; import javafx.scene.shape.Shape; public class JavaFXSubtractExample extends Application { public void start(Stage stage) { //Drawing circle1 Circle circle1 = new Circle(); circle1.setCenterX(230.0f); circle1.setCenterY(100.0f); ... Read More
836 Views
This operation takes two or more shapes as inputs and returns the intersection area between them as shown below.The intersect() (static) method of the javafx.scene.shape.Shape class accepts two Shape objects and returns the result of the intersect operation of the given objects.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.Circle; import javafx.scene.shape.Shape; public class JavaFXIntersectExample extends Application { public void start(Stage stage) { //Drawing circle1 Circle circle1 = new Circle(); circle1.setCenterX(230.0f); circle1.setCenterY(100.0f); circle1.setRadius(75.0f); circle1.setFill(Color.DARKRED); //Drawing ... Read More
316 Views
This operation takes two or more shapes as inputs and returns the area occupied by them combined as shown below.The union() (static) method of the javafx.scene.shape.Shape class accepts two Shape objects and returns the result of the union operation of the given objects.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.Circle; import javafx.scene.shape.Shape; public class JavaFXUnionExample extends Application { public void start(Stage stage) { //Drawing circle1 Circle circle1 = new Circle(); circle1.setCenterX(230.0f); circle1.setCenterY(100.0f); circle1.setRadius(75.0f); circle1.setFill(Color.DARKRED); ... Read More
136 Views
JavaFX supports three operations on 2D objects namely – Union, Subtraction and Intersection.Union Operation − This operation takes two or more shapes as inputs and returns the area occupied by them.Intersection Operation − This operation takes two or more shapes as inputs and returns the intersection area between them.Subtraction Operation − This operation takes two or more shapes as an input. Then, it returns the area of the first shape excluding the area overlapped by the second one.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.Circle; import javafx.scene.shape.Shape; import javafx.scene.text.Font; import javafx.scene.text.FontPosture; import javafx.scene.text.FontWeight; import javafx.scene.text.Text; public ... Read More
680 Views
The javafx.scene.shape package provides classes using which you can draw various 2D shapes, but these are just primitive shapes like line, circle, polygon, and ellipse, etc…Therefore, if you want to draw complex custom shapes you need to use the Path class.The Path ClassThe Path class represents the geometrical outline of a shape and is attached to an observable list which holds various Path Elements such as MoveTo, LineTo, HlineTo, VlineTo, ArcTo, QuadCurveTo, CubicCurveTo.The constructor of this class accepts variable arguments of the type PathElement and constructs a path based on the given path elements.ExampleThe Path Element MoveTo is used to move ... Read More
232 Views
Following are various geometrical shapes that you can draw using JavaFXLine − A line is a geometrical structure joining two-point. The javafx.scene.shape.The line class represents a line in the XY plane.Rectangle − A rectangle is a four-sided polygon that has two pairs of parallel and concurrent sides with all interior angles as right angles. The javafx.scene.The Rectangle class represents a rectangle in the XY plane.Circle − A circle is a line forming a closed loop, every point on which is a fixed distance from a center point. The javafx.scene.The Circle class represents a circle in the XY plane.Ellipse − An ... Read More
220 Views
JShell is an interactive REPL tool to execute and evaluate simple Java programs like variable declarations, statements, expressions, and etc.When the JShell tool launched, the code has pre-loaded by default. To display this code, we just launch the command "/list -start". It is possible to ask JShell to load them automatically when it starts by using the command: "/set start [-retain] [Type]". The first option "-retain" tells JShell to record the desired [Type] startup for the next JShell sessions. If we don't specify it, the default startup can be launched when opening a new session /set start [-retain] -File /set start ... Read More
923 Views
Java 9 supports to create Reactive Streams by introducing a few interfaces: Publisher, Subscriber, Subscription, and SubmissionPublisher class that implements the Publisher interface. Each interface can play a different role corresponding to the principles of Reactive Streams.We can use the Subscriber interface to subscribe to the data that is being published by a publisher. We need to implement the Subscriber interface and provide an implementation for the abstract methods.Flow.Subscriber interface methods:onComplete(): This method has been called when the Publisher object completes its role.onError(): This method has been called when something goes wrong in Publisher and is notified to the Subscriber.onNext(): This method has been called whenever ... Read More