2012-04-27 117 views
0

我想修改代码从AWT到eclipse SWT plugin.Im面临刷新问题。我有查看表(AWT)和另一个视图与图表(AWT)。单独他们都很好,但是当我添加两个我只在图表视图面临刷新问题时,任何建议?提前致谢。Eclipse RCP插件图形用户界面刷新问题

回答

0

这是我必须做的,以在SWT视图中嵌入一个JPanel。

 Composite videoComposite = new Composite(panel, 
       SWT.EMBEDDED | SWT.BORDER | SWT.NO_BACKGROUND); 
     videoComposite.setLayout(new FillLayout()); 
     videoComposite.setLayoutData(new GridData(
       SWT.CENTER, SWT.CENTER, true, true, 1, 1)); 

     CLabel videoImage = new CLabel(videoComposite, SWT.SHADOW_IN); 
     videoImage.setImage(dummyVideo); 

     frame = SWT_AWT.new_Frame(videoComposite); 

     SwingUtilities.invokeLater(new Runnable() { 
      public void run() { 
       setLookAndFeel(); 
       applet = new JApplet(); 
       applet.setFocusCycleRoot(false); 
       mediaPanel = rabidVideo.getVideoPanel(false); 
       applet.add(mediaPanel); 
       frame.add(applet); 
      } 
     }); 

其中frameFrameappletJApplet,和mediaPanelJPanel的延伸。

这里的setLookAndFeel

protected void setLookAndFeel() { 
    try { 
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
    } catch (ClassNotFoundException e) { 
     EclipseLogging.logError(RabidPlugin.getDefault(), 
        RabidPlugin.PLUGIN_ID, e); 
    } catch (InstantiationException e) { 
     EclipseLogging.logError(RabidPlugin.getDefault(), 
        RabidPlugin.PLUGIN_ID, e); 
    } catch (IllegalAccessException e) { 
     EclipseLogging.logError(RabidPlugin.getDefault(), 
        RabidPlugin.PLUGIN_ID, e); 
    } catch (UnsupportedLookAndFeelException e) { 
     EclipseLogging.logError(RabidPlugin.getDefault(), 
        RabidPlugin.PLUGIN_ID, e); 
    } 
}