我有多个包含一些信息的按钮。 现在我希望按下时按下按钮上的信息,即按下第一个按钮时 - 信息打印到文本字段中 当我按下第二个按钮 - 写在按钮上的信息被附加或添加到文本字段中,包含旧信息(按钮1中的数据)。
我正在尝试的代码是:
$date = "2015-11-25";
$start = strtotime($date);
$currentdate = $start;
$times_table = array();
for($i = 0; $i <= 3; $i++){
$times_table[$i] = array();
}
echo "<pre>";
for($i = 0; $i <= 3; $i++){
for($j = 0; $j <= 4; $j++){
if ($j == 0){
$times_table[$i][$j]= "Version 5" ;
}
else if ($j == 1){
$cur_date = date("M-y", $currentdate);
$currentdate = strtotime('+1 month', $currentdate);
$times_table[$i][$j]= $cur_date ;
echo $cur_date . ">". "<br />";
}
else{
$times_table[$i][$j]= "gary" ;
}
if ($j == 3) {
$numbers = mt_rand(1, 100);
$times_table[$i][$j]= $numbers ;
}
if ($j == 4){
if($i == 0 || $i == 3)
{
$pay = "P";
$times_table[$i][$j]= $pay ;
}
else{
$int = "I";
$times_table[$i][$j]= $int ;
}
}
}
}
答案 0 :(得分:4)
简单地:
medianIncomeData[i]=y[2][1]
答案 1 :(得分:2)
有几种方法,setText
是一种,但它不是特别有效(虽然它更容易打字),因为你正在创建额外的临时对象
如果您需要经常更新字段,可以考虑使用更像......
的内容Document doc = userNameField.getDocument();
doc.insertString(doc.getLength(), newString, null);