Author: Gerrit Grunwald

Avatar
Gerrit Grunwald

JUG Leader, Java Champion, Speaker, Author, ❤️ Java(FX) and coding in general

  • Custom Controls in JavaFX (Part VI)

    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.).

    Avatar
    G. Grunwald
    Read more
  • Custom Controls in JavaFX (Part V)

    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.

    Avatar
    G. Grunwald
    Read more
  • Custom Controls in JavaFX (Part IV)

    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.

    Avatar
    G. Grunwald
    Read more
  • Custom Controls in JavaFX (Part III)

    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.

    Avatar
    G. Grunwald
    Read more
  • Custom Controls in JavaFX (Part II)

    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.

    Avatar
    G. Grunwald
    Read more
  • Custom Controls in JavaFX (Part I)

    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.

    Avatar
    G. Grunwald
    Read more

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard