How can jFrames be used inside of JavaFX?
-
22-07-2019 - |
Question
I just saw a article on Swing being used in JavaFX. How can an application that uses a jFrame to display graphics be ported into JavaFX? Also, will the jButtons and jSliders work in the normal manner?
I know this is a generic question but I know little of JavaFX and am curious about porting some desktop applications to the web via the JavaFX package.
Solution
javafx file:
import javax.swing.JComponent;
import javafx.ext.swing.SwingComponent;
class NewFxComponent extends SwingComponent
{
var comp: JComponent;
public override function createJComponent():JComponent
{
return new OldJComponent();
}
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow