Closed eric-upchurch closed 3 years ago
Hmm I believe Ikonli was not designed to have both Swing and JavaFX icons resolved in the same application. It might have worked like that by mistake. This being said, I'll see if it's possible to officially support this setup.
Thanks for looking into it! If possible, it would great to have that officially supported for our use case since we still have some components that require Swing in an otherwise fully JavaFX UI.
FWIW the problem stems from https://github.com/kordamp/ikonli/commit/c78b2d22840fce2c0bc4c690134b690711d99ced where static members that were previously private to each IkonResolver
type were pushed upward to a common ancestor. As I said, it was pure coincidence the behavior you seek actually worked, I know now how to fix it so that it works for good 😄
With versions 11.5.0 and previous, you could utilize both Swing and JavaFX Ikonli
FontIcon
s in the same application without problems, and easily convert between them by retrieval of theIkon.getIconCode()
and passing it into the respectiveFontIcon.of()
methods of either the Swing or JavaFXFontIcon
classes.With 12.0.0, once you use either a JavaFX or Swing
FontIcon
, theIkonHandler
s for each will return the font class of the first usedFontIcon
type. Using the other (e.g. using JavaFX and then Swing) will cause aCastClassException
because theIkonResolver
for each type will return the sameFont
class - if you use SwingFontIcon
first, it will returnjava.awt.Font
; if you use JavaFXFontIcon
first, it will returnjavafx.scene.text.Font
. This prevents you from using both JavaFX and SwingFontIcon
s within the same application.This can be demonstrated with the following code segment: