<div style="font-family: 'verdana'; font-size: 12px; color: #000;">I also agree that this is a good idea. <br>As of now, we can only change the theme by reacting to the Platform Preferences (listener) and change the Stylesheet of the Scene(s). <br>I'm not sure how well this works as I never tried it as of now (Might even be problematic for Tooltips, Dialogs and Dialogs without an owner). </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">So media queries are the better and correct solution for this problem.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">I use them myself for light/dark theme in the Web and they work pretty good, are easy to set up and read. So following this standard is the right choice.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">Media queries are normally often used with 'width' and 'height' as well, e.g.<br>
<pre class="brush: css notranslate"><code><span class="token atrule"><span class="token rule">@media</span> <span class="token punctuation">(</span>width <= 1250px<span class="token punctuation">)</span></span> <span class="token punctuation">{</span>
<span class="token comment">/* … */</span>
<span class="token punctuation">}</span></code></pre>
I wonder if we want to support that as well. <br>Since JavaFX follows the 'container' approach, where the container (Pane) is responsible for the layout, this does not seem to be that useful or needed in JavaFX (compared to the Web).</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">Although I can think of some usecases like changing (decrease/increase) the padding or the alignment of some Controls when a specific width or height is reached.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">Are there any plans to include this at a later date? If not, perhaps we should document this.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">Other opinions on this topic are also welcome.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"><br>In any case, starting with the preferences is the right decision and IMO will bring the most benefit.</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;">-- Marius</div>
<div style="font-family: 'verdana'; font-size: 12px; color: #000;"> </div>
<div id="sub-body-container" style="margin: 10.0px 5.0px 5.0px 10.0px; padding: 10.0px 0.0px 10.0px 10.0px; border-left: 2.0px solid rgb(195,217,229);">
<div style="margin: 0.0px 0.0px 10.0px;">
<div><strong>Gesendet: </strong>Montag, 2. Dezember 2024 um 17:22</div>
<div><strong>Von: </strong>"Michael Strauß" <michaelstrau2@gmail.com></div>
<div><strong>An: </strong>openjfx-dev <openjfx-dev@openjdk.org></div>
<div><strong>Betreff: </strong>CSS Media Queries</div>
</div>
Hi everyone,<br><br>here's a proposal to add media queries to JavaFX, which is a powerful<br>feature to adjust stylesheets to changes in the runtime environment.<br><br>Proposal: <a href="https://gist.github.com/mstr2/cbb93bff03e073ec0c32aac317b22de7" target="_blank" rel="noopener noreferrer">https://gist.github.com/mstr2/cbb93bff03e073ec0c32aac317b22de7</a><br>PR: <a href="https://github.com/openjdk/jfx/pull/1655" target="_blank" rel="noopener noreferrer">https://github.com/openjdk/jfx/pull/1655</a></div>