how to call a java event for kotlin


#1

how to call the savebutton event from java to kotlin ? I’m using intellij, remembering that I do not want to create this function directly in kotlin I just want to call this function from java to kotlin

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class FormCad {
    public JPanel panel1;
    private JButton button1;
    private JTextField textField1;
    private JButton button2;
    private JTextField textField2;
    public JButton saveButton;

    public FormCad() {
        saveButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent actionEvent) {

            }
        });
       
    }

    public static void main(String[] args){

    }
}

#2

instead of new ActionListener() { ... } you can use object : ActionListener() { ... }