Eclipse RCP 学习记录
时间:2010-12-08 来源:轻剑
1.RCP中怎么实现全屏显示的程序
ApplicationWorkbenchWindowAdvisor 类中增加以下代码
public void postWindowCreate(){
super.postWindowCreate();
getWindowConfigurer().getWindow().getShell().setMaximized(true);
}
2.在设置Layout为 BorderLayout时,会自动增加swing2swt.jar,但是在运行该工程时会报错,The activator ****.Activator for bundle aabb is invalid
我的解决办法是 打开plugin.xml文件,选择Runtime标签,在Classpath中将swing2swt.jar删除后再增加进来,并把swing2swt.jar Add to Build Path
3.增加table事件,点击某一行时改变颜色,始终没有效果出现

public void widgetSelected(SelectionEvent e){
int total = table.getItemCount();
TableItem tableItem = new TableItem(table, SWT.NONE,table.getSelectionIndex()+1);
tableItem.setText(new String[]{"1","2","3"});
for(int i=0;i<total;i++){
TableItem[] ii= table.getSelection();
table.getSelectionIndex();
table.getSelectionCount();
TableItem item = table.getItem(i);
if(table.isSelected(i)){
item.setBackground(item.getDisplay().getSystemColor(SWT.COLOR_RED));
item.setForeground(item.getDisplay().getSystemColor(SWT.COLOR_GREEN));
}else{
item.setBackground(null);
item.setForeground(null);
}
}
}
});
终于发现这个问题是创建TableView时选择样式FULL_SELECTION ,设置选择一行高亮的样式后,设置点击某一行时改变颜色(前景,后景色)就不起作用
但是出现新问题,只能选中第一列中的单元格
相关阅读 更多 +
排行榜 更多 +