當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。