Java ProgressIndicator类使用实例

发布时间:2025-12-09 11:56:38 浏览次数:1

实例1: updateProgressIndicator

import ika.gui.ProgressIndicator; //导入依赖的package包/类/** * Updates the progress indicator with the current progress * * @param progress indicator to update * @param currentPolygon the number of polygons filled so far * @param totalPolygons the total number of polygons to fill * @return if false, abort operation */private boolean updateProgressIndicator(ProgressIndicator progress,        int currentPolygon, int totalPolygons) {    DecimalFormat f = new DecimalFormat("#,###");    StringBuilder sb = new StringBuilder();    sb.append("<html>Filling polygon ");    sb.append(currentPolygon);    sb.append(" of ");    sb.append(totalPolygons);    sb.append(" <br>Total ");    sb.append(generateScreeStones ? "stones" : "lines");    sb.append(" generated: ");    sb.append(f.format(stonesCounter));    sb.append("</html>");    if (progress != null) {        if (progress.progress(100 * (currentPolygon + 1) / totalPolygons) == false) {            return false;        }        if (progress instanceof CmdLineProgress == false) {            progress.setMessage(sb.toString());        }    }    return true;} 

实例2: read

import ika.gui.ProgressIndicator; //导入依赖的package包/类/** Read a Grid from a file in ESRI ASCII format. * @param fileName The path to the file to be read. * @param progress A WorkerProgress to inform about the progress. * @return The read grid. */public static GeoGrid read(String filePath, ProgressIndicator progressIndicator)        throws java.io.IOException {    File file = new File(filePath);    FileInputStream fis = new FileInputStream(file.getAbsolutePath());    GeoGrid grid = ESRIASCIIGridReader.read(fis, progressIndicator);    if (progressIndicator != null && progressIndicator.isAborted()) {        return null;    }    String name = file.getName();    if (!"".equals(name)) {        grid.setName(name);    }    return grid;} 

实例3: read

import ika.gui.ProgressIndicator; //导入依赖的package包/类/** Read a Grid from a file in ESRI ASCII format. * @param fileName The path to the file to be read. * @param progress A WorkerProgress to inform about the progress. * @return The read grid. */public static GeoGrid read(String filePath, ProgressIndicator progressIndicator)        throws java.io.IOException {    File file = new File(filePath);    InputStream fis = new FileInputStream(file.getAbsolutePath());    EsriASCIIGridReader esriReader = new EsriASCIIGridReader();    GeoGrid grid = esriReader.read(fis, progressIndicator);    if (progressIndicator != null && progressIndicator.isAborted()) {        return null;    }    String name = file.getName();    if (!"".equals(name)) {        grid.setName(name);    }    return grid;} 
progressindicator
需要做网站?需要网络推广?欢迎咨询客户经理 13272073477