1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
package swingingfx;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import org.jfxtras.scene.SceneToJComponent;
/**
*
* @author fabriceb
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("!!Swinging FX!!");
frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
frame.setTitle("FX Panel Test");
frame.setLayout(new BorderLayout());
String sceneClass = "javafx.scene.Scene";
JComponent theScene = SceneToJComponent.loadScene(sceneClass);
theScene.setPreferredSize(new Dimension(800, 600));
frame.add(new JLabel("JLabel: The following is a JavaFX Scene"), BorderLayout.NORTH);
frame.add(theScene, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
});
}
} |
Partager