这是一个片段
kit.insertHTML(doc, doc.getLength(), "Hello", 0, 0, null);
try{
Thread.sleep(1000);
}catch(Exception e){}
Run Code Online (Sandbox Code Playgroud)
我正在使用HTMLEditorKit()并HTMLDocument()作为文本框.文本框应该显示"Hello"然后等待一秒然而,当我尝试这个时,它等待一秒然后把单词"Hello"这不是我想要的.
我不确定为什么会这样,因为我把它按逻辑顺序排列.如果有人能帮助我,那就太好了.
编辑:
有没有人知道另一种选择,所以我可以使用"延迟"的那种效果?
下面是数字格式化程序的代码:
double value = 12345.678;
// locale preference should be retrieved from user preferences
Locale defaultLocale = new Locale("en", "US", "USD");
NumberFormat nf = NumberFormat.getCurrencyInstance(defaultLocale);
String formattedValue = nf.format(value);
System.out.println(formattedValue);
Run Code Online (Sandbox Code Playgroud)
输出值:12,345.68美元但在这里,我希望我的输出值为:12,345.68美元.我需要在价值结束时获得美元(货币代码).
此外,我正在调用Webservice以获取值,如何将值传递给Required字段,并格式化它?
我试图在路线中返回随机函数函数的输出...我一直在'未定义' - 但不知道我做错了什么...
var randomizer = function() {
// A load of stuff happens here.. and functions that are needed by the pullOut function (I've removed for brevity)
var pullOut = function(pick) {
if (playerList.length !== pick) {
var random_item = getRandomItem(list, weight);
if (playerList.indexOf(random_item) == -1) { // doesn't exist. So add to array.
playerList.push(random_item);
}
pullOut(pick);
} else {
console.log(playerList)
return playerList;
}
}
return pullOut(pick);
}
router.route('/ordercreated')
.post(function(req, res) {
var orderedItems = req.body.line_items;
// I foreach …Run Code Online (Sandbox Code Playgroud) 它工作正常但我不确定它是如何工作的,任何人都可以解释它吗?谢谢
public static int gcd(int a, int b) {
return b==0 ? a : gcd(b, a%b);
}
Run Code Online (Sandbox Code Playgroud)