Java Code Examples for javafx.scene.control.TableCell#setAlignment()
The following examples show how to use
javafx.scene.control.TableCell#setAlignment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormatedTableCellFactory.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public TableCell<S,T> call(TableColumn<S,T> p) { TableCell<S,T> cell = new TableCell() { @Override public void updateItem(Object item, boolean empty) { if (item == getItem()) return; super.updateItem(item, empty); if (item == null) { super.setText(null); super.setGraphic(null); } else if (format != null) { super.setText(format.format(item)); } else if (item instanceof Node) { super.setText(null); super.setGraphic((Node)item); } else { super.setText(item.toString()); super.setGraphic(null); } } }; cell.setTextAlignment(alignment); switch(alignment) { case CENTER: cell.setAlignment(Pos.CENTER); break; case RIGHT: cell.setAlignment(Pos.CENTER_RIGHT); break; default: cell.setAlignment(Pos.CENTER_LEFT); break; } return cell; }
Example 2
Source File: FormatedTableCellFactory.java From marathonv5 with Apache License 2.0 | 5 votes |
@Override public TableCell<S,T> call(TableColumn<S,T> p) { TableCell<S,T> cell = new TableCell() { @Override public void updateItem(Object item, boolean empty) { if (item == getItem()) return; super.updateItem(item, empty); if (item == null) { super.setText(null); super.setGraphic(null); } else if (format != null) { super.setText(format.format(item)); } else if (item instanceof Node) { super.setText(null); super.setGraphic((Node)item); } else { super.setText(item.toString()); super.setGraphic(null); } } }; cell.setTextAlignment(alignment); switch(alignment) { case CENTER: cell.setAlignment(Pos.CENTER); break; case RIGHT: cell.setAlignment(Pos.CENTER_RIGHT); break; default: cell.setAlignment(Pos.CENTER_LEFT); break; } return cell; }