Java Reference
In-Depth Information
innerPanel.add(first);
firstField = new JTextField(10);
innerPanel.add(firstField);
last = new JLabel("Last Name:");
innerPanel.add(last);
lastField = new JTextField(10);
innerPanel.add(lastField);
JButton button = new JButton("Submit");
button.addActionListener((event) -> {
Platform.runLater(()-> {
UserEntryForm.fxLabel.setText("Message from
Swing form...");
});
});
buttonLbl = new JLabel("Click Me:");
innerPanel.add(buttonLbl);
innerPanel.add(button);
add(innerPanel);
}
}
Next, let's look at the JavaFX code that is used to create the graphical user inter-
face, including the toggle button and the JavaFX form. Note that the Swing form is em-
bedded using the SwingNode object.
public class UserEntryForm extends Application {
private static ToggleButton fxbutton;
private static GridPane grid;
public static Label fxLabel;
@Override
public void start(Stage stage) {
final SwingNode swingNode = new SwingNode();
createSwingContent(swingNode);
BorderPane pane = new BorderPane();
Image fxButtonIcon = new Image(
Search WWH ::




Custom Search