void (JPanel panel, String[] buttons, int index) { JButton button = new JButton("Show Buttons with Cancel Alert"); button.addActionListener(event -> Messages.showDialog(button, MESSAGE, TITLE, buttons, index, null)); panel.add(button); }