Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8152532

On TabPane With Custom Skin ComboBox Has Two Arrow Buttons

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u74
    • javafx

      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);
          }
        }
      }

            jgiles Jonathan Giles
            wzberger Wolfgang Zitzelsberger
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: