Drools6.1 and JavaFX8 with Java8 – Genealogy Rules

I wanted to create a simple project that integrated Drools6.0 with JavaFX8 using Java8 and some of its new features.  So, here goes. Objective We are going to go back to one of the classic problems of Genealogy.  You're tracing your family tree and you've found hundreds of people who could be related but matching … Continue reading Drools6.1 and JavaFX8 with Java8 – Genealogy Rules

Advertisements

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 … Continue reading Using JavaFX8 to Drag Connected Shapes

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) … Continue reading Using JavaFX to draw a Changing Shape

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 … Continue reading Java 8 and Lambda to Search a File

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 … Continue reading Playing with Lambda Functions