CoreJava - Delegation Versus Inheritance In Graphical User Interfaces (GUI) - english - 4k @Sentinel-for-Java
CoreJava - Delegation Versus Inheritance In Graphical User Interfaces (GUI) - english - 4k  @Sentinel-for-Java
Uploaded February 2021 | Updated November 2026, 3 days ago
In this article, we will look at the difference between the inheritance and delegation concepts. Or, to put it better, why I prefer delegation and why I want to emphasize this rarely-used feature in Java.

The challenge we face today is quite common in the field of graphic user interfaces like desktop- or web-apps. Java is widely used as the development language for both worlds, and it does not matter if we are in the classic swing, JavaFX, or the field of web frameworks like Vaadin. Explicitly, I've opted for a pseudo-class model in core Java, as I'd like to look at the design patterns here without any technical details.

The goal is to create a custom component that consists of a text input field and a button. Both elements should be displayed next to each other, i.e. in a horizontal layout. The respective components have no function in this example. I want to be here exclusively to work towards the differences between inheritance and delegation.

### TOC ###
00:00 - Intro
00:26 - The Challenge We Have
01:04 - The Base-Class-Modell
02:56 - Inheritance - Bad Practices
04:38 - Inheritance for Core Components
06:28 - Delegation for Composites
09:42 - make it final again
10:52 - Conclusion

________________________________________________________________________________________________
►► Sven Ruppert WebSite svenruppert.com
________________________________________________________________________________________________
►► Would you like to support my channel financially? paypal.me/outdoorskills
________________________________________________________________________________________________
►► My social media channels
- Instagram: instagram.com/sven.ruppert
- Facebook: facebook.com/sven.ruppert
- Facebook Page: facebook.com/sven.outdoor
________________________________________________________________________________________________
►► You can find more equipment I used at
- svenruppert.com/my-outdoor-equipment
CoreJava - Delegation Versus Inheritance In Graphical User Interfaces (GUI) - english - 4k
Sentinel For Java |

CoreJava - Delegation Versus Inheritance In Graphical User Interfaces (GUI) - english - 4k

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER