本文整理汇总了Java中javafx.scene.control.TableCell.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java TableCell.setAlignment方法的具体用法?Java TableCell.setAlignment怎么用?Java TableCell.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TableCell
的用法示例。
在下文中一共展示了TableCell.setAlignment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import javafx.scene.control.TableCell; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public TableCell call(final TableColumn param) {
final TableCell cell = new TableCell() {
@SuppressWarnings("unchecked")
@Override
public void updateItem(Object item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
if (ErrorModel.ErrorLevel.ERROR.toString().equals(((String) item))) {
setGraphic(ErrorModel.newErrorIcon());
} else if (ErrorModel.ErrorLevel.WARNING.toString().equals(((String) item))) {
setGraphic(ErrorModel.newWarningIcon());
}
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
}
}
};
cell.setAlignment(Pos.CENTER);
return cell;
}
示例2: call
import javafx.scene.control.TableCell; //导入方法依赖的package包/类
@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;
}
示例3: call
import javafx.scene.control.TableCell; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public TableCell<S, T> call(TableColumn<S, T> p) {
TableCell<S, T> cell = new TableCell<S, T>() {
@Override
public void updateItem(Object item, boolean empty) {
if (item == getItem()) {
return;
}
super.updateItem((T) 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;
}
示例4: call
import javafx.scene.control.TableCell; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public TableCell<S, T> call(TableColumn<S, T> p) {
TableCell<S, T> cell = new TableCell<S, T>() {
@Override
public void updateItem(Object item, boolean empty) {
if (item == getItem()) {
return;
}
super.updateItem((T) item, empty);
if (item == null) {
super.setText(null);
super.setGraphic(null);
}
else if (formatter != null) {
super.setText(formatter.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;
}
示例5: call
import javafx.scene.control.TableCell; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public TableCell call(final TableColumn param) {
final TableCell cell = new TableCell() {
@SuppressWarnings("unchecked")
@Override
public void updateItem(Object item, boolean empty) {
super.updateItem(item, empty);
if (empty) {
setText(null);
setGraphic(null);
} else {
final Button buttonStop = new Button("Stop");
setGraphic(buttonStop);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
buttonStop.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
param.getTableView().getSelectionModel().select(getIndex());
DriveTaskModel task = tableTaskView.getSelectionModel().getSelectedItem();
param.getTableView().getSelectionModel().clearSelection();
if (task == null) {
logger.info("No task to stop...") ;
return ;
} else if (task.isDone()) {
MessageDialogs.showMessageDialog(UiUtils.getStage(event), "The task is already done", "Information", MessageDialogs.MessageType.INFO);
buttonStop.setDisable(true);
return ;
}
else if (Response.NO == MessageDialogs.showConfirmDialog(UiUtils.getStage(event), "Are you sure you want to stop this task?", "Confirmation")) {
return ;
} else {
logger.info("Stop task") ;
task.stop() ;
buttonStop.setDisable(true);
}
}
});
}
}
};
cell.setAlignment(Pos.CENTER);
return cell;
}