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

TableView with border has graphical artifacts

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.1
    • Component/s: javafx
    • Environment:

      java6
      windows 7
      fx b41

      Description

      To reproduce run following code



      import javafx.application.Application;
      import javafx.beans.property.SimpleStringProperty;
      import javafx.beans.value.ObservableValue;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Node;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableColumn.CellDataFeatures;
      import javafx.scene.control.TableView;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;
      import javafx.util.Callback;

      public class TableViewSample 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<Person, String> column1 = new TableColumn<Person,String>("First Name");
              column1.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {

                  @Override
                  public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
                      return new SimpleStringProperty(p.getValue().getFirstName());
                  }
              });
              TableColumn<Person, String> column2 = new TableColumn<Person,String>("Last Name");
              column2.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Person, String>, ObservableValue<String>>() {

                  @Override
                  public ObservableValue<String> call(CellDataFeatures<Person, String> p) {
                      return new SimpleStringProperty(p.getValue().getLastName());
                  }
              });
              TableView table = new TableView(items);
              table.getColumns().setAll(column1, column2);
              table.setPrefHeight(200);
              table.setFocusTraversable(false);
              table.setStyle("-fx-border-color:green;-fx-border-width:9;");
              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.show();
          }

          public static class Person {

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

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

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

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

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

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

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

        Attachments

          Activity

            People

            • Assignee:
              jgiles Jonathan Giles
              Reporter:
              anazarov Andrey Nazarov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: