# how to call a java event for kotlin

**URL:** <https://discuss.kotlinlang.org/t/how-to-call-a-java-event-for-kotlin/6917>\
**Category:** Support\
**Created:** [March 6, 2018, 7:47pm UTC](https://discuss.kotlinlang.org/t/how-to-call-a-java-event-for-kotlin/6917 "2018-03-06T19:47:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![r7.gabrielcrvg](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@r7.gabrielcrvg](https://discuss.kotlinlang.org/u/r7.gabrielcrvg)\
**Post date:** [March 6, 2018, 7:47pm UTC](https://discuss.kotlinlang.org/t/how-to-call-a-java-event-for-kotlin/6917/1 "2018-03-06T19:47:35Z")

</div>

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

```auto
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){

    }
}

```

---

<div class="post-metadata">

**Author:** ![Wasabi375](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/wasabi375/32/4741_2.png) [@Wasabi375](https://discuss.kotlinlang.org/u/Wasabi375)\
**Post date:** [March 6, 2018, 8:10pm UTC](https://discuss.kotlinlang.org/t/how-to-call-a-java-event-for-kotlin/6917/2 "2018-03-06T20:10:09Z")

</div>

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