貌似RCP的资料比较少,仅有的也没发现介绍的比较详细的,现在都是东学一点西学一点,此帖简单记录一下要点

 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事件,点击某一行时改变颜色,始终没有效果出现

table.addSelectionListener(new SelectionAdapter(){
            
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);
                    }
                }
            }
        });

相关文章:

  • 2022-12-23
  • 2021-10-02
  • 2021-07-10
  • 2022-03-07
  • 2021-10-14
  • 2021-10-10
  • 2022-12-23
  • 2021-06-24
猜你喜欢
  • 2021-05-19
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-11-05
  • 2021-07-01
  • 2021-11-16
相关资源
相似解决方案