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

Wrong scrollbar rendering in table view with custom shape, padding, border,custom background

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Duplicate
    • Affects Version/s: fx2.0
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
    • Environment:

      b32
      jdk6

      Description

      To reproduce run following code



      import javafx.application.Application;
      import javafx.beans.property.StringProperty;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Node;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Hyperlink;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.layout.VBox;
      import javafx.scene.paint.Color;
      import javafx.scene.shape.Rectangle;
      import javafx.stage.Stage;

      public class TableViewShape extends Application {

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

          private Parent getContent() {
              VBox list = new VBox(10);

              ObservableList<Person> items = FXCollections.observableArrayList();
              for (int i = 0; i < 10; i++) {
                  items.add(new Person("name " + i, "surname " + i));
              }
              TableColumn<Node> column1 = new TableColumn<Node>("First Name");
              column1.setProperty("firstName");
              TableColumn<Node> column2 = new TableColumn<Node>("Last Name");
              column2.setProperty("lastName");
              TableView table = new TableView(items);
              table.getColumns().setAll(column1, column2);
              table.setPrefHeight(200);
              table.setFocusTraversable(false);
              table.setStyle("-fx-shape: "
                          + "\"M 50 50 L 150 50 L 100 150 Z\";-fx-background-color: red;");
              table.setMaxSize(200, 300);
              list.getChildren().add(table);
              return list;
          }

          public void start(Stage stage) {
              stage.setX(100);
              stage.setY(100);
              stage.setWidth(300);
              stage.setHeight(300);
              Scene scene = new Scene(getContent());
              stage.setScene(scene);
              stage.setVisible(true);
          }

          public static class Person {

              Person(String firstName, String lastName) {
                  this.firstName = new StringProperty(firstName);
                  this.lastName = new StringProperty(lastName);
              }
              public StringProperty firstName;

              public void setFirstName(String value) {
                  firstName.set(value);
              }

              public String getFirstName() {
                  return firstName.get();
              }

              public StringProperty firstNameProperty() {
                  if (firstName == null) {
                      firstName = new StringProperty();
                  }
                  return firstName;
              }
              public StringProperty lastName;

              public void setLastName(String value) {
                  lastName.set(value);
              }

              public String getLastName() {
                  return lastName.get();
              }

              public StringProperty lastNameProperty() {
                  if (lastName == null) {
                      lastName = new StringProperty();
                  }
                  return lastName;
              }
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              miflemi Mick Fleming (Inactive)
              Reporter:
              anazarov Andrey Nazarov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: