SWT中Table中放Text的问题?(急急急急急)

liaoningjinbao 2009-02-25 12:18:27
在SWT的Table中,做一个30*30的表格,表格里面用TableEditor放Text,在水平方向出现滚动条的时候,拖动就会出现波浪一样的效果,怎么解决呢?
...全文
122 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
liaoningjinbao 2009-02-25
  • 打赏
  • 举报
回复
大至是这样的吧,代码太长不让发,关键是表格里放的都是控件会影响性能吗?
liaoningjinbao 2009-02-25
  • 打赏
  • 举报
回复
public void setDatas(List<AutoTriggerSettingsDataBean> databeanlist) {
this.beanlist = databeanlist;
int len = databeanlist.size();
datalength = len;
ccy = new String[len];
for(int i=0; i<len; i++){
ccy[i] = databeanlist.get(i).getCycy();
}
comboAutotriger = new Combo[ccy.length];
comboSecond = new Combo[ccy.length];
textSecond = new Text[ccy.length];
comboLongAmt = new Combo[ccy.length];
textLongAmt = new Text[ccy.length];
comboAskProfit = new Combo[ccy.length];
textAskProfit = new Text[ccy.length];
comboAskLoss = new Combo[ccy.length];
textAskLoss = new Text[ccy.length];
comboShortAmt = new Combo[ccy.length];
textShortAmt = new Text[ccy.length];
comboBidProfit = new Combo[ccy.length];
textBidProfit = new Text[ccy.length];
comboBidLoss = new Combo[ccy.length];
textBidLoss = new Text[ccy.length];
comboProfitValue = new Combo[ccy.length];
textProfitValue = new Text[ccy.length];
comboProfitValue2 = new Combo[ccy.length];
textProfitValue2 = new Text[ccy.length];
comboLossValue = new Combo[ccy.length];
comboLossValue2 = new Combo[ccy.length];
textLossValue = new Text[ccy.length];
textLossValue2 = new Text[ccy.length];
comboEod = new Combo[ccy.length];
textEod = new Text[ccy.length];
comboMailSwitch = new Combo[ccy.length];
textMail = new Text[ccy.length];
TableItem item;
for (int i = 0; i < ccy.length; i++) {
item = new TableItem(table, SWT.NULL);
item.setImage(image);
item.setText(0, databeanlist.get(i).getCycy());
}

final TableItem[] items = table.getItems();
TableItem[] itemsss = new TableItem[items.length];
for (int i = 0; i < ccy.length; i++) {

final TableItem currentItem = items[i];
itemsss[i] = currentItem;
final String allpair = currentItem.getText();
AutoTriggerSettingsDataBean bean = databeanlist.get(i);

comboAutotriger[i] = new Combo(this.table, SWT.DROP_DOWN);
setComboBox(currentItem, comboAutotriger[i], bean.getAutotriger(), 1);
comboAutotriger[i].addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) {
if (((Combo) evt.getSource()).getText().equals(
comboValues[0])) {
setAllCombo(ccy, comboAutotriger, comboValues[0]);
} else {
setAllCombo(ccy, comboAutotriger, comboValues[1]);
}
}

}
});

//滞留秒数(秒)
comboSecond[i] = new Combo(this.table, SWT.DROP_DOWN | SWT.NONE);
setComboBox(currentItem, comboSecond[i], bean.getSecondswitch(), 2);
textSecond[i] = new Text(this.table, SWT.NONE);
textSecond[i].addVerifyListener(secondVer);
textSecond[i].setTextLimit(4);

textSecond[i].addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent evt) {
if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) {
Text txtMy = (Text) evt.getSource();
if(null != txtMy){
setAllTextValue(ccy, textSecond, txtMy.getText());
}
}
}
});

textSecond[i].setText(bean.getSecond());
setText(currentItem, textSecond[i], bean.getSecondswitch(), 2);

comboSecond[i].addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if (GlobalResources.AutoTriggerSettingResource.getString(AutoTriggerSettingResourceName.DEALERTRADETYPESETTINGS_ALL).equals(allpair)) {
if (((Combo) evt.getSource()).getText().equals(
comboValues[0])) {
setAllCombo(ccy, comboSecond, comboValues[0]);
setAllText(ccy, textSecond, true);
} else {
setAllCombo(ccy, comboSecond, comboValues[1]);
setAllText(ccy, textSecond, false);
}
} else {
if (((Combo) evt.getSource()).getText().equals(
comboValues[0])) {
int position = getPosition(ccy, currentItem);
textSecond[position].setEnabled(true);
} else {
int position = getPosition(ccy, currentItem);
textSecond[position].setEnabled(false);
}
}

}
});




}

}



private void setText(final TableItem item, Text text, String flag, int position) {
TableEditor editor = new TableEditor(this.table);

editor.grabHorizontal = false;
editor.minimumWidth = 50;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(text, item, position);
}
wunan320 2009-02-25
  • 打赏
  • 举报
回复
最好放代码或者具体说滚动时做了什么。
用过table显示数据几万行*10几列,
也没出现lz提到的问题。

62,634

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧