当前位置: 代码迷 >> Eclipse >> 新手,虚心请问大神们
  详细解决方案

新手,虚心请问大神们

热度:71   发布时间:2016-04-23 00:52:00.0
新手,虚心请教大神们
private void initialize() throws Exception {
   
        panelMain = (JPanel) getContentPane();
        this.setSize(new Dimension(710, 350));
        this.setTitle("SuperMap iObjects Java");
        this.addWindowListener(new Frame1_this_windowAdapter(this));
        this.addComponentListener(new Frame1_this_componentAdapter(this));
        mapControl.setLayout(null);
        panelMain.setLayout(null);
        mapControl.setBounds(new Rectangle(9, 44, 650, 181));
        
        jButtonOpen.setToolTipText("打开地图");
        jButtonOpen.setIcon(openIcon);
        jButtonOpen.addActionListener(new ActionListener(){
             @Override
             public void actionPerformed(ActionEvent e) {
                // 打开工作空间及地图
        openMap();
            }
        });
上面一段代码中的“openMap();”报错:The method openMap() is undefined for the type new ActionListener(){}
求大神们解释一下原因和改错方法,谢谢!
------解决方案--------------------
openMap();是在哪边定义的,你那个方法是内部类中的方法吧,是不能直接调用别的类的
------解决方案--------------------
你确定你类中有这个方法?
如果是其他类的方法你就应该用那个类的对象调用或者类名::方法名(static函数)
  相关解决方案