2012-04-27 116 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); 
    } 
}