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

Border style none is not working on TableCell

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8u66
    • Fix Version/s: 9
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      Run this sample program:

      "
      import java.util.ArrayList;
      import java.util.List;
      import javafx.application.Application;
      import javafx.beans.property.SimpleStringProperty;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.SelectionMode;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.control.cell.TextFieldTableCell;
      import javafx.scene.layout.HBox;
      import javafx.scene.text.Font;
      import javafx.stage.Stage;

      public class TableViewSample extends Application {

          List<TableColumn<Person, ?>> list = new ArrayList<>();

          private TableView<Person> table = new TableView<Person>();
          private final ObservableList<Person> data
                  = FXCollections.observableArrayList(
                          new Person("Jacob", "Smith", "jacob.smith@example.com"),
                          new Person("Isabella", "Johnson", "isabella.johnson@example.com"),
                          new Person("Ethan", "Williams", "ethan.williams@example.com"),
                          new Person("Emma", "Jones", "emma.jones@example.com"),
                          new Person("Michael", "Brown", "michael.brown@example.com"));
          final HBox hb = new HBox();

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

          @Override
          public void start(Stage stage) {
              final Label label = new Label("Address Book");
              label.setFont(new Font("Arial", 20));

              table.setEditable(true);
              table.getSelectionModel().setCellSelectionEnabled(true);
              table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

              for (int i = 0; i < 1000; ++i) {
                  data.add(new Person("Jacob", "Smith", "jacob.smith@example.com"));
              }
              addColumns();
              table.setItems(data);

              Scene scene = new Scene(table);
              scene.getStylesheets().add("test.css");
              stage.setTitle("Table View Sample");
              stage.setWidth(900);
              stage.setHeight(900);
              stage.setScene(scene);
              stage.show();

          }

          public void addColumns() {
              for (int i = 0; i < 20; ++i) {
                  TableColumn firstNameCol = new TableColumn("First Name");
                  firstNameCol.setMinWidth(100);
                  firstNameCol.setCellValueFactory(
                          new PropertyValueFactory<Person, String>("firstName"));
                  firstNameCol.setCellFactory(TextFieldTableCell.forTableColumn());
                  list.add(firstNameCol);
              }

              table.getColumns().addAll(list);
          }

          public static class Person {

              private final SimpleStringProperty firstName;
              private final SimpleStringProperty lastName;
              private final SimpleStringProperty email;

              private Person(String fName, String lName, String email) {
                  this.firstName = new SimpleStringProperty(fName);
                  this.lastName = new SimpleStringProperty(lName);
                  this.email = new SimpleStringProperty(email);
              }

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

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

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

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

              public String getEmail() {
                  return email.get();
              }

              public void setEmail(String fName) {
                  email.set(fName);
              }
          }
      }
      "

      You will need this css :
      "

      .table-cell{
          -fx-border-width : 3px;
          -fx-border-color :black;
          /*-fx-background-color: black;*/
          -fx-border-style : none;
      }
      "

      When you run it, all border are black. So basically, if you specify "solid" for border style or "none", the result is the same.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jgiles Jonathan Giles
                Reporter:
                shadzic Samir Hadzic
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: