Did you add a reference to the right .jar or .jmod, too? Swing is not in the base java.base.jmod
thats referenced by default; some Googling tells me that java.desktop
is the right reference to add for Swing.
Similar for AWT and Beans, I assume these are separate references as well, though I don’t know off-hand which one (none of these files seem intuitively named
Also see Namespaces and References.