You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With versions 11.5.0 and previous, you could utilize both Swing and JavaFX Ikonli FontIcons in the same application without problems, and easily convert between them by retrieval of the Ikon.getIconCode() and passing it into the respective FontIcon.of() methods of either the Swing or JavaFX FontIcon classes.
With 12.0.0, once you use either a JavaFX or Swing FontIcon, the IkonHandlers for each will return the font class of the first used FontIcon type. Using the other (e.g. using JavaFX and then Swing) will cause a CastClassException because the IkonResolver for each type will return the same Font class - if you use Swing FontIcon first, it will return java.awt.Font; if you use JavaFX FontIcon first, it will return javafx.scene.text.Font. This prevents you from using both JavaFX and Swing FontIcons within the same application.
This can be demonstrated with the following code segment:
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 c78b2d2 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:
The text was updated successfully, but these errors were encountered: