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
|
public class IHMTest extends JPanel {
private JFXPanel jfxPanel;
private Scene scene;
private WebView webView;
private JButton btnQuit = new JButton();
public IHMTest() {
jfxPanel = new JFXPanel();
Platform.runLater(() -> {
webView = new WebView();
scene = new Scene(webView);
jfxPanel.setScene(scene);
webView.getEngine().load("http://www.google.fr");
});
btnQuit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
actionbtnQuitEcran();
}
});
this.add(jfxPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
this.add(btnQuit, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.EAST, GridBagConstraints.EAST, new Insets(5, 5, 5, 5), 0, 0));
}
public void actionbtnQuitEcran() {
Platform.exit();
}
} |
Partager