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

TabContentArea bounces for deviant alignment

XMLWordPrintable

    • x86_64
    • generic

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Professional
      Service Pack 1

      A DESCRIPTION OF THE PROBLEM :
      The layoutChildren method of the TabPaneSkin sets the Pos of the TabContentArea everytime to TOP_LEFT, independend of the settings of inline styles or additional styleSheets.

      The Problem is the code snippet in TabPaneSkin at Line 605:
      tabContent.setAlignment(Pos.TOP_LEFT);

      Removing this and extend modena.css would be very fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Creating the class FXTabPaneTest and the cssFile TabPaneStyle (Codes are appended)
      See the TabPane and do some of the following:
      - Click on the "SomeText"-Label
      - Switch the window focus to another window
      - Resize the window

      The Label jumps into the center and on layoutChildren of the TabPane it jumps to the TOP_LEFT Pos.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Label should stay in the center. (or any other pos that is defined in css)
      ACTUAL -
      The Label jumps into the center and on layoutChildren of the TabPane it jumps to the TOP_LEFT Pos.



      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      ========================== FXTabPaneTest.java
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.stage.Stage;

      import java.net.URL;

      public class FXTabPaneTest extends Application {

        public static void main(String[] args) {
          launch();
        }

        @Override
        public void start(Stage primaryStage) throws Exception {
          TabPane tabPane = new TabPane();

          URL url = getClass().getResource("TabPaneStyle.css");
          tabPane.getStylesheets().add(url.toExternalForm());

          Label label = new Label("SomeText");
          tabPane.getTabs().add(new Tab("Text", label));

          primaryStage.setScene(new Scene(tabPane, 300, 300));
          primaryStage.show();
        }
      }

      ========================== TabPaneStyle.css
      .tab-pane > .tab-content-area {
           -fx-alignment: center;
       }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not really possible.


        1. FXTabPaneTest.java
          0.8 kB
          Priyanka Mangal
        2. TabPaneStyle.css
          0.1 kB
          Priyanka Mangal

            pmangal Priyanka Mangal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: