我正在尝试将 AWT 中的代码改编为 Eclipse SWT 插件。我面临刷新问题。我有一个带有表(AWT)的视图和另一个带有图表(AWT)的视图。单独他们很好,但是当我添加两者时,我只在图表视图上面临刷新问题,有什么建议吗?提前致谢。
问问题
514 次
1 回答
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);
}
});
其中frame
是 a Frame
,applet
是 a JApplet
,并且mediaPanel
是 的延伸JPanel
。
这是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);
}
}
于 2012-04-27T15:09:34.600 回答