Execute test below - the comboBox appears with two arrow buttons. The unwanted button appears at the lop left corner of the combobox. The issue occurs only if a custom TabPanSkin is installed.
package test.combobox;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class ComboTabPaneTest extends Application{
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) {
stage.setScene(new Scene(createContent()));
stage.setTitle(getClass().getSimpleName());
stage.show();
}
private Parent createContent() {
TabPane tabPane = new TabPane();
tabPane.getTabs().add(new Tab("Tab", createTabContent()));
// custom skin installs unwanted controls for some reason - Note: update package if not in text.combobox
tabPane.setStyle("-fx-skin: 'test.combobox.ComboTabPaneTest$TabPaneSkin'");
BorderPane content = new BorderPane();
content.setCenter(tabPane);
return content;
}
private Node createTabContent(){
FlowPane p = new FlowPane();
p.setPadding(new Insets(40));
p.getChildren().add(new ComboBox<>());
return p;
}
// TabPaneSkin class
public static class TabPaneSkin extends com.sun.javafx.scene.control.skin.TabPaneSkin {
public TabPaneSkin(TabPane tabPane){
super(tabPane);
}
}
}
package test.combobox;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.stage.Stage;
public class ComboTabPaneTest extends Application{
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage stage) {
stage.setScene(new Scene(createContent()));
stage.setTitle(getClass().getSimpleName());
stage.show();
}
private Parent createContent() {
TabPane tabPane = new TabPane();
tabPane.getTabs().add(new Tab("Tab", createTabContent()));
// custom skin installs unwanted controls for some reason - Note: update package if not in text.combobox
tabPane.setStyle("-fx-skin: 'test.combobox.ComboTabPaneTest$TabPaneSkin'");
BorderPane content = new BorderPane();
content.setCenter(tabPane);
return content;
}
private Node createTabContent(){
FlowPane p = new FlowPane();
p.setPadding(new Insets(40));
p.getChildren().add(new ComboBox<>());
return p;
}
// TabPaneSkin class
public static class TabPaneSkin extends com.sun.javafx.scene.control.skin.TabPaneSkin {
public TabPaneSkin(TabPane tabPane){
super(tabPane);
}
}
}