gpt4 book ai didi

gwt - GWT 的进度条

转载 作者:行者123 更新时间:2023-12-04 23:07:09 28 4
gpt4 key购买 nike

是否有可以与 GWT 一起使用的进度条小部件,还是必须自己制作?我尝试在 google-web-toolkit-incubator、gwtupload 和 upload4gwt 中使用进度条,但没有任何运气。

最佳答案

一些代码:

import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Widget;

public class ProgressBar extends Widget {
private static final String PERCENT_PATTERN = "#,##0%";
private static final NumberFormat percentFormat = NumberFormat.getFormat(PERCENT_PATTERN);

private final Element progress;
private final Element percentageLabel;
private double percentage;
private final double max;

public ProgressBar(double value, double max) {
assert max != 0;
this.max = max;

progress = DOM.createElement("progress");
progress.setAttribute("max", Double.toString(max));
progress.setAttribute("value", Double.toString(value));

percentageLabel = DOM.createElement("span");
percentage = value / max;
percentageLabel.setInnerHTML(percentFormat.format(percentage));
progress.insertFirst(percentageLabel);

setElement(progress);
}

public void setProgress(double value) {
progress.setAttribute("value", Double.toString(value));
percentage = value / max;
percentageLabel.setInnerHTML(percentFormat.format(percentage));
}

}

关于gwt - GWT 的进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9482665/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com