您好,我把一个类继承了jframe,在里面添加了scenecontrol控件,但是在调用这个方法sceneControl.getScene();时报错java.awt.IllegalComponentStateException: 三维地图控件必须显示。-com.supermap.ui.SceneControl.makeSureNewFromJNI(SceneControl.java:971)
应该用swing控件添加一下scenecontrol,
//初始化scenecontrol private SceneControl getSceneControl() { if (m_sceneControl == null) { m_sceneControl = new SceneControl(); } return m_sceneControl; } //初始化jpanel private JPanel getJContentPane() { if (m_contentPane == null) { m_contentPane = new JPanel(); m_contentPane.setLayout(new BorderLayout()); m_contentPane.add(getSceneControl(), BorderLayout.CENTER); } return m_contentPane; } /** * 初始化窗体 Initialize the form. */ private void initialize() { // 最大化显示窗体 // Maximize the form this.setExtendedState(Frame.MAXIMIZED_BOTH); this.setContentPane(getJContentPane()); this.setTitle("我的第一个地球"); this.addWindowListener(new java.awt.event.WindowAdapter() { // 在主窗体加载时,初始化SampleRun类型,来完成功能的展现 // Initialize the SampleRun type when loading the main window public void windowOpened(java.awt.event.WindowEvent e) { m_workspace = new Workspace();} // 在窗体关闭时,需要释放相关的资源 // Release resources when you close the window public void windowClosing(java.awt.event.WindowEvent e) { m_sceneControl.dispose(); m_workspace.dispose(); } }); }