2016-09-16 9 views
3

こんにちは、テーブルの輪郭をどうやってできるのか教えてください。私はテーブルのすべての行に輪郭があることを願っています。私のテーブルには、次のようになります。テーブルのJavaFXテーブルの輪郭

TableColumn busNumberCol = new TableColumn("Linia"); 
     busNumberCol.setCellValueFactory(
       new PropertyValueFactory<>("busNumber")); 
     busNumberCol.setPrefWidth(tb.getPrefWidth()/5); 

     TableColumn courseCol = new TableColumn("Kierunek"); 
     courseCol.setCellValueFactory(
       new PropertyValueFactory<>("nameBusStpo")); 
     courseCol.setPrefWidth((tb.getPrefWidth()-tb.getPrefWidth()/5)/2-1); 
     TableColumn departureCol = new TableColumn("Odjazd"); 
     departureCol.setPrefWidth((tb.getPrefWidth()-tb.getPrefWidth()/5)/2-1); 
     departureCol.setCellValueFactory(
       new PropertyValueFactory<>("busTimetable")); 
     table.setPrefHeight(tb.getPrefHeight()); 

     table.setStyle("-fx-background-color: orange"); 
     table.setPrefWidth(tb.getPrefWidth()); 
     table.setItems(list); 
     table.getColumns().addAll(busNumberCol, courseCol, departureCol); 
     table.setPlaceholder(new Label(""));  
+1

を見て: '.table行セル{-fx背景色:青、-fx -バックグラウンド; } '。結果は水平の青い線でなければなりません。 – DVarga

答えて

1

.table-row-cell{ 
     -fx-border-color:red; 
     -fx-border-width:1.0; 
     /* -fx-background-color */ 
    } 

述べるので、それをこれはすべての行の周りに境界線を追加します。背景色の場合は、上記のコメントを/* -fx-background-color*/

また

テーブルビューの詳細なスタイリングのためにあなたのスタイルシートに、このクラスセレクタを追加Change JavaFX TableView font size

1

は(私が働いているため)、CSSでこれを試してください:

あなたが使用することができます
.table-row-cell{ 
    -fx-background-color: -fx-table-cell-border-color, /*coloryouwant*/; 
}