RFR: 8267606: Style classes not always working

Kevin Rushforth kevin.rushforth at oracle.com
Wed Sep 29 12:33:36 UTC 2021

I can see the original submission you sent (and yes, Praveen didn't 
attach it). I can attach it, but I have a question about it. Also, it 
will need some modifications before we can take a look at it.

1. There are differences between the one you originally sent and the one 
pointed two in your google drive project below. Which version would you 
like attached to the JBS bug?

2. We really need a self-contained test program, without using gradle or 
maven to download any artifacts. There should be no dependencies on any 
external libraries / jar files / etc. We need to be able to build it 
from source, pointing to a local build of JavaFX, in order to debug it 
(so we don't need any .class files or .jar files in the zip bundle).

-- Kevin

On 9/29/2021 3:47 AM, Alessandro Parisi wrote:
>> It would be very helpful if you could provide a minimum reproducable
>> example. So really just the code which is necessary for all of us to
>> reproduce it.
> Oh wow, what happened on JBS, there should be the projects files attached,
> did Praveen forget to upload them?
> Do I re-send additional information? What should I do?
> For now, here's the link to download the project: Google Drive
> <https://drive.google.com/file/d/19Y0_hLwvblNpRCTMIJpNoLDymTv9GXu4/view?usp=sharing>
> Explanation and info on how to test:
> The project has changed a bit, now there's a third example and the JavaFX
> version has been updated to 17.
> All examples can be run by modifying the Launcher class.
> CSS files are in the resources folder and loaded by a ResourceManager.
> 1) The first example is TableTest. The main files for this test are
> TableViewSkin and TableView.css.
> The table has a HBox which contains the columns, from the CSS the
> bottom border is set to be 'lightgray'. The test is set up to succeed
> initially. However, if you go in the skin class and switch the ID for a
> style class, update the CSS file accordingly (.custom-table-view
> .columns-container) you'll see that the bottom border is not styled anymore.
> Both the second and third examples are about the userAgentStylesheet which
> doesn't behave correctly.
> 2) Let's start with the NotificationsTest first. The main files are
> MFXNotificationCenter, MFXNotificationCenterSkin and NotificationCenter.css.
> The icon shown in the StackPane comes from the NotificationsCounter class
> (inner class of the skin). The icon should be big and gray. The test is set
> to succeed initially. Let's take a look at the MFXNotificationCenter class,
> at the bottom you'll see that I commented the getUserAgentStylesheet()
> method and instead of using that I added a this call
> 'getStylesheets().add(STYLESHEET);' in the initialize() method. If you
> invert this (uncomment the user agent method and remove this call) you'll
> notice that the icon is not styled anymore. Now let's check the skin class,
> check lines 31-109-212. If you comment the latter one you'll see that the
> icon is styled again. The other lines have no visible effect for this test
> but in the real control I must add them too, otherwise not everything is
> styled.
> 3) The last example is the ToggleTest. This shows the exact same issue
> described above but the structure/control is simplier. The example is set
> to fail initially. If you run it you can see that the label has a black
> line underneath which would be normal but the issue is that in the
> MFXRectangleToggleNode.css (at the bottom of the file) the lines are set to
> be transparent, the background too. To make it work, go into the skin class
> (MFXRectangleToggleNodeSkin) uncomment the indicated line and it will work.
> Another workaround is like I did above, instad of using the user agent, add
> the stylesheet with 'getStylesheets().add(STYLESHEET);'

More information about the openjfx-dev mailing list