If you have a JavaFX Stage with a JavaFX TabPane in it, and you add as one of the tabs a SwingNode containing a JEditorPane, clicking in the editor does not give focus to the editor as you would expect, but instead seems to give focus to the tab (the label in the tab header).
On Ubuntu 14.04 (Java 8u5), clicking always gives focus to the tab and never to the editor pane. On Mac OS X 10.9.2, clicking first gives focus to the editor, but clicking a second time gives focus to the tab. Third time to the editor again, fourth to the tab, and so on.
Minimal Example:
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.embed.swing.SwingNode;
import javax.swing.JEditorPane;
public class Example extends Application
{
public void start(Stage stage)
{
TabPane tabPane = new TabPane();
Scene scene = new Scene(tabPane, 640, 480);
stage.setScene(scene);
Tab javafxTab = new Tab();
javafxTab.setText("Editor");
SwingNode swingNode = new SwingNode();
swingNode.setContent(new JEditorPane("text/plain", "Try\nand\nclick\nin\nhere"));
javafxTab.setContent(swingNode);
tabPane.getTabs().add(javafxTab);
stage.show();
}
}
On Ubuntu 14.04 (Java 8u5), clicking always gives focus to the tab and never to the editor pane. On Mac OS X 10.9.2, clicking first gives focus to the editor, but clicking a second time gives focus to the tab. Third time to the editor again, fourth to the tab, and so on.
Minimal Example:
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.embed.swing.SwingNode;
import javax.swing.JEditorPane;
public class Example extends Application
{
public void start(Stage stage)
{
TabPane tabPane = new TabPane();
Scene scene = new Scene(tabPane, 640, 480);
stage.setScene(scene);
Tab javafxTab = new Tab();
javafxTab.setText("Editor");
SwingNode swingNode = new SwingNode();
swingNode.setContent(new JEditorPane("text/plain", "Try\nand\nclick\nin\nhere"));
javafxTab.setContent(swingNode);
tabPane.getTabs().add(javafxTab);
stage.show();
}
}