CSS on Java Swing from Java Code

自古美人都是妖i 提交于 2020-01-07 02:08:10

问题


I am designing a eclipse plugin, where i use Components of Swing and JavaFx. In this I can apply CSS on JavaFX. But i could not apply CSS for Swing components. I was forced to use Swing component for some features of the plugin. So i would like to apply CSS for Swing components too. Is there any api that supports CSS on Swing component?

//This code applies css for javafx components
SwingJavaFxSample.class.getResource("samples.css").toExternalForm();

Please help me in applying css for Swing components too.


回答1:


You can not use the JavaFX CSS support on Swing controls so to me the question makes no sense. Let me also say that using 3 UI-Technologies together is not really a good idea you'll run into many threading issues (SWT & FX share the same event thread whereas Swing is on another one), ... .

What is the reason you still need Swing? JavaFX can be embedded directly into SWT.



来源:https://stackoverflow.com/questions/18398178/css-on-java-swing-from-java-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!