help (jdialog - jframe)

0

When calling a jdialog there is no problem:

//llama a consultar Perfume
JMenuItem mntmConsultarPerfumes = new JMenuItem("Consultar Perfumes");
mntmConsultarPerfumes.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        M_consultarPerfume cp=new M_consultarPerfume();
        cp.setVisible(true);
    }
});

But if I want to call MODAL that jdialog I get an error in line new M_consultarPerfume(this,true); :

//llama a consultar Perfume
JMenuItem mntmConsultarPerfumes = new JMenuItem("Consultar Perfumes");
mntmConsultarPerfumes.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        M_consultarPerfume cp=new M_consultarPerfume(this,true);
        cp.setVisible(true);
    }
});

Error:

  

The constructor M_consultPerfume (new ActionListener () {}, boolean) is undefined

Thanks for the help

    
asked by Jr Mezaq 04.07.2018 в 00:29
source

1 answer

0

You should implement overload in the dialogue so that one receives the parameters you send and the other that does not receive parameters.

I should have two builders like:

public M_consultarPerfume(){}

public M_consultarPerfume(ActionListener listener, boolean state){}
    
answered by 04.07.2018 / 00:45
source