我正在用 JavaFx 框架编写一个 Magicdraw 插件来添加一个新的浏览器。以下是 LibraryBrowser 类中新浏览器的初始化代码。
private static final WindowComponentInfo info = new WindowComponentInfo("test_browser", "Test Browser", null,
ProjectWindowsManager.SIDE_WEST, ProjectWindowsManager.STATE_DOCKED, true);
public LibraryBrowser() {
Browser.addBrowserInitializer(new Browser.BrowserInitializer() {
@Override
public void init(@Nonnull Browser browser, @Nonnull Project project) {
browser.addPanel(new LibraryBrowserView(info)); //add library view
}
@Override
public WindowComponentInfoRegistration getInfo() {
return new WindowComponentInfoRegistration(info, null);
}
});
}
其中 LibraryBrowserView 是一个扩展 ExtendedPanel 的类,它实现了 WindowComponent,如下面的代码所示。
public class LibraryBrowserView extends ExtendedPanel implements WindowComponent {
private WindowComponentInfo info;
public LibraryBrowserView(WindowComponentInfo info) {
//Set WindowComponentInfo
this.info = info;
JFXPanel fxPanel = new JFXPanel();
add(fxPanel);
fxPanel.setVisible(true);
Group root1 = new Group();
Scene scene = new Scene(root1, Color.ALICEBLUE);
Text text = new Text();
text.setX(40);
text.setY(100);
text.setFont(new Font(25));
text.setText("Test JavaFX!");
root1.getChildren().add(text);
fxPanel.setScene(scene);
}
@Override
public WindowComponentContent getContent() {
return new BrowserWindowComponentContext(this);
}
@Override
public WindowComponentInfo getInfo() {
return info;
}}
class BrowserWindowComponentContext implements WindowComponentContent {
private JPanel panel;
public BrowserWindowComponentContext(JPanel panel) {
this.panel = panel;
}
@Override
public Component getWindowComponent() {
return panel;
}
@Override
public Component getDefaultFocusComponent() {
return panel;
}}
打开 MagicDraw 时出现错误。
java.lang.UnsatisfiedLinkError: com.sun.prism.d3d.D3DVertexBuffer.nDrawIndexedQuads(J[F[BI)I