sorry if this has already been asked but I can't find it anywhere. I made a custom JOptionPane
with a JSlider
. It does what it is supposed to do, but how can I check if the pressed ok or cancel? Because right now it does it anyway.
Code:
JOptionPane optionPane = new JOptionPane();
JSlider slider = getSlider(optionPane);
slider.setValue(value);
optionPane.setMessage(new Object[]{"Select a value: ", slider});
optionPane.setMessageType(JOptionPane.QUESTION_MESSAGE);
optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION);
optionPane.createDialog(parent, title).setVisible(true);
// get return value of optionPane
I've gone through the methods and didn't find it, that doesn't mean; howerever, that it's not there.
Any help is appreciated. Thanks!