The JDK Butler is an app that makes use of the Foojay Disco API to enable you to drill down to a JDK of your choice and download it to your machine. As you can see on the screenshot we have columns where we can select things like major version, version, distribution etc.
Every time you select something, the selected text will be colored in a specific color and you will see a small triangle pointing into the direction of the selected item. So, the question is, how did I create this triangle? To explain this, let me show you some screenshots from my vector drawing program to explain what I did.
Drawing on the Canvas node will directly go down to the graphics hardware, which makes it really fast.
Of course, this also comes with drawbacks because all the things that you draw on the Canvas node are part of that one node.
Meaning to say that if you would like to implement something like mouse interaction, you have to implement the whole mouse interaction on your own (tracking the mouse position, calculate if the mouse is inside/outside of objects you draw, keeping track of objects that should interact with the mouse etc.).
Learn how to create a custom control that is based on the JavaFX Region class. The Region class is the class that all JavaFX controls are based on. It is a resizable Parent node which can be styled from CSS.
This is the class that you would want to use when building a JavaFX custom control that is not part of a controls library.
The main difference between the Region and the Control + Skin based approach is the fact that the Region based control contains both, the control logic and the UI where the Control + Skin based control separates the logic from the UI. The logic can be found in the Control and the UI can be found in the Skin.
In this part of the series, I will show you how to create a custom control in JavaFX by using Control and Skin classes.
A custom control created by a Control and Skin class only makes sense if you will provide more than one Skin for your control or if you would like to give people the ability to create their own Skins for your Control.
In any other case, you should choose another approach (e.g., use a Region or Canvas based control).
So, usually, the Control and Skin approach is used in UI libraries where you have one Control with multiple Skins.
If you’ve been following this series of blog posts, you already read about how to create custom controls by re-styling existing controls or combining existing controls.
This time let me show you how to create a custom JavaFX control by extending an existing control.
The goal for today is to create a TextField that looks similar to the TextField that you can find in MaterialDesign.
Last time we saw how to create custom controls in JavaFX by simply playing around with CSS styles for the component.
This time I will show you how to create a custom control by combining existing controls.
The idea is to create a control that contains a text field where you can type in values and besides the text field should be a button that when pressed will convert the value from the text field to another value.
As long as you only would like to create a simple form-based application, the available UI controls in JavaFX will work totally fine.
But when it comes to special requirements, you quickly will run into problems where you need to create your own controls. Unfortunately, in JavaFX, the decision was made to make a lot of the code from the UI controls private and final.
In this part, we will create a custom JavaFX control by changing the style of an existing control.