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

Alignment for TableColumn header not set via CSS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.1
    • Component/s: javafx
    • Labels:

      Description

      ' -fx-alignment: TOP_RIGHT' does not get honoured by table column header. Ideally the header would support all attributes of the CSS 'Labeled' class as per http://download.oracle.com/javafx/2.0/api/javafx/scene/doc-files/cssref.html#labeled

      *** Code ***

          import javafx.application.Application;
          import javafx.scene.Scene;
          import javafx.scene.control.TableColumn;
          import javafx.scene.control.TableView;
          import javafx.scene.layout.FlowPane;
          import javafx.stage.Stage;
          
          public class TestApp extends Application
          {
              public static void main(String[] args) throws Exception
              {
                  launch(args);
              }
          
              public void start(Stage stage) throws Exception
              {
                  FlowPane rootNode = new FlowPane();
                  TableView table = new TableView();
                  table.getColumns().add(new TableColumn("Column 1"));
                  table.getColumns().add(new TableColumn("Column 2"));
                  rootNode.getChildren().add(table);
                  Scene scene = new Scene(rootNode, 800, 600);
                  scene.getStylesheets().add("styles.css");
                  stage.setScene(scene);
                  stage.show();
              }
          }

      *** CSS ***

          .table-view .column-header {
              -fx-border-color: red;
              -fx-alignment: TOP_RIGHT;
          }


      When running this, the border gets applied (indicating the CSS selector works) and is around the full width of the header (indicating that the header is being sized correctly) but the header text stays centered.

      Cheers,
      zonski


        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            dzwolenskjfx Daniel Zwolenski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: