Eclipse RCP插件GUI刷新问题

时间:2012-04-27 11:23:51

标签: eclipse-rcp

我正在尝试将代码从AWT改为eclipse SWT插件。我正面临刷新问题。我有表(AWT)和另一个带图表(AWT)的视图。单独他们是好的,但当我添加我只面对刷新问题只在图表视图,任何建议?提前致谢。

1 个答案:

答案 0 :(得分: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);
            }
        });

frameFrameappletJAppletmediaPanelJPanel的扩展。

这是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);
    }
}