当前位置: 首页>>代码示例>>Java>>正文


Java TableCell.setAlignment方法代码示例

本文整理汇总了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;
      }
 
开发者ID:roikku,项目名称:drive-uploader,代码行数:26,代码来源:ErrorReportViewController.java

示例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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:FormatedTableCellFactory.java

示例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;
}
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:40,代码来源:FormattedTableCellFactory.java

示例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;
}
 
开发者ID:fthevenet,项目名称:binjr,代码行数:43,代码来源:DecimalFormatTableCellFactory.java

示例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;
      }
 
开发者ID:roikku,项目名称:drive-uploader,代码行数:48,代码来源:DriveTaskPanelViewController.java


注:本文中的javafx.scene.control.TableCell.setAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。