Pavel,

JavaFX does not implement the rounded corners; it's the operating system
that does it.

Generally speaking, desktop environments on Linux use client-side
decorations (CSD). That means the toolkit responsible for
drawing the window contents (for example, GTK) is also responsible for
drawing the window frame, title bar, shadows,
rounded corners, and other window decorations.

As a result, the appearance of windows can vary significantly between
desktop environments.

Because of this, JavaFX cannot reliably control whether a Linux window has
rounded corners.
The actual behavior depends on the desktop environment toolkit (gtk for
gnome).

Additionally, JavaFX currently uses GTK 3 on Linux. As far as I know, GTK 3
does not provide any straightforward way to create a
GTK-decorated window and seamlessly embed or mix JavaFX-rendered content
within it. There are some possible workarounds, but they tend to be fairly
hacky.
GTK 4 introduced APIs that make this kind of integration more feasible, but
JavaFX is not currently based on GTK 4.

I did a POC (with GTK 4):

https://www.youtube.com/watch?v=1CvpakL5RRU

However, it is only a proof of concept intended to validate the feasibility
of the approach. Several corners were cut,
many edge cases were not addressed, and parts of the existing
implementation were bypassed to keep the experiment manageable.
There is still a considerable amount of work required before this could be
proposed as a complete solution.


-- Thiago




Em sáb., 20 de jun. de 2026 às 03:03, PavelTurk <[email protected]>
escreveu:

> Hi Michael,
>
> Thank you very much for your reply.  Yes, I am testing a JavaFX
> application on Ubuntu 20, and when I noticed that there was no window
> border, I assumed this was an intended feature of extended stages. If,
> as you say, extended stages are supposed to have window borders on all
> operating systems, then yes, that would solve the problem. I only raised
> the question about corner radius because of that border.
>
> I simply assumed that on Linux only the rounded corners were not yet
> implemented, while everything else (including the window border) was
> already in place. That's where the misunderstanding came from.
>
> Best regards, Pavel
>
> On 6/19/26 19:00, Michael Strauß wrote:
> > Hi Pavel,
> >
> > you're probably talking about the Linux implementation, because both
> > on macOS and Windows, extended stages already have a window border.
> >
> > In general, an extended stage is like a decorated stage where the OS
> > is responsible for drawing window borders. It is neither intended nor
> > supported that applications draw their own window borders.
> >
> > So instead of adding new API, would your use case be covered if
> > extended stages on Linux just looked like platform-native decorated
> > windows?
> >
> >
> >
> > On Fri, Jun 19, 2026 at 4:23 PM PavelTurk <[email protected]>
> wrote:
> >> In addition to JDK-8386317, I proposed adding an API that would allow
> >> JavaFX applications to obtain the window corner radius from the
> >> operating system. However, Michael Strauß pointed out that this is most
> >> likely not feasible because operating systems generally do not expose
> >> such information.
> >>
> >> Let's look at the problem from a practical perspective. Virtually every
> >> application running in a non-maximized window requires a border
> >> (typically 1 px). This is a standard UI convention. If JavaFX supports
> >> EXTENDED windows with rounded corners, the corners of that border must
> >> also be rendered correctly. Otherwise, the result will look visually
> >> inconsistent.
> >>
> >> If obtaining the corner radius from the OS is not possible, I would
> >> suggest one of the following solutions:
> >>
> >>   1. Add an API that allows the operating system to render the window
> >>      border itself, while the JavaFX developer only specifies its
> >>      appearance (color, thickness, dash pattern, etc.).
> >>   2. Allow the JavaFX developer to specify the corner radius explicitly,
> >>      while the operating system uses that information solely for
> >>      rendering the native window shadow.
> >>
> >> Best regards, Pavel
> >>
>
>

Reply via email to