0

I have problem with Comsol's Java API.

To plot the result of Comsol model, I have to create an instance of com.comsol.modelguiswing.SwingGraphicsPanel

Here is my code:

public void start() {
    frame = new JFrame("Beam GUI - based on COMSOL Multiphysics");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(1000, 730);
    JPanel mainPanel = new JPanel();
    frame.getContentPane().add(mainPanel);
    mainPanel.setLayout(new BorderLayout());
    SwingGraphicsPanel.getDefaultLocale();

    System.out.println("before");
    final SwingGraphicsPanel graphicsPanel
            = new SwingGraphicsPanel("window1", "Window1");
    System.out.println("after");

    mainPanel.add(graphicsPanel, BorderLayout.CENTER);
    frame.setVisible(true);
    model = BeamModel.run();
    model.sol("sol1").runAll();
    model.result("pg1").set("window", "window1");
    model.result("pg1").run();

}

The problem is that when I call its constructor, it never finished its execution ("before" is printed but "after" never be printed and the program is still running). It seems a deadlock is happened. I am using Comsol 5.3 on Windows 10 64x with JDK 1.8.

Would you please let me know what is the problem?!

user2874769
  • 97
  • 2
  • 6

1 Answers1

1

SwingGraphicsPanel is an implementation of JPanel in Comsol software. It seems the problem is with Comsol 5.3. And there is no problem with its implementation in Comsol 4.4. Of course, I did not find any reports in its forum.

user2874769
  • 97
  • 2
  • 6