I want a pop up window when I pressed a button.Can anyon helo me with the right code.Here is my code.Iam new to java swings.Thank you in advance.here is my code.
JButton testButton=new JButton("test");
toolBar.addComponentRight(testButton);
testButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
here I want to replace code--------
JOptionPane.showMessageDialog(null,"you clicked me");
}
});
Here in output pop up window I am getting only OK button.I need CANCEL button also along with OK button.Can anyone suggest me with the right code.Thank you in advance.
I got the code.I hope it would be useful.here is my modified code.Thank you vishal.
JButton testButton=new JButton("test");
toolBar.addComponentRight(testButton);
testButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JOptionPane.showConfirmDialog((Component) null, "Do you want to close ?", "Window Title", JOptionPane.OK_CANCEL_OPTION);
}
});