本文整理匯總了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;
}