Using JavaFX8 to Drag Connected Shapes

Objective In this example we are going to create three connected circles as per the image below: and we will be able to drag these circles around the screen using the mouse: The Code Create the class examples001.ConnectedShapes.java as follows: ConnectedShapes Run the code by right clicking on the file and selecting Run File. Reviewing the…

Using JavaFX to draw a Changing Shape

Objective In this example we are going to create a RoundedRectangle shape with two sliders as per the image below: By moving the slider inside the shape, we will change the curvature on the corners of the shape: By moving the slider underneath the shape, we will move the shape (and the slider within it)…

Java 8 and Lambda to Search a File

In this example we are going to read from a File and use Lambda expressions to  search out and collect every line that contains a .foreach statement. Search Within a File Note that we are also using Java NIO and try-with-resources which makes use of the AutoCloseable interface. Source Code Full source code of a…

Playing with Lambda Functions

Java8 has introduced Lambda Functions. Whilst this looks a little overwhelming at first, it is a really useful feature. Create our Person POJO Person.java Create an Array of People People Array Print People Pre Java8 Java 8 but we know that p is of type Person because our List is List<Person> Sorting People Pre Java8…