我想在单击 button.that 弹出 window 时弹出 window 应该包含标签 name.OK 按钮 CLOSE 按钮
I want to get a pop up window when I click a button.that pop window should consists of a label name.OK button CLOSE button
我想要一个弹出 window 当我按下 button.Can 任何人帮助我正确 code.Here 是我的 code.Iam java swings.Thank你在advance.here是我的密码
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.
你也可以这样做,
JOptionPane.showConfirmDialog((Component) null, "Do you want to close ?", "Window Title", JOptionPane.OK_CANCEL_OPTION);
同样会显示,
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);
}
});
我想要一个弹出 window 当我按下 button.Can 任何人帮助我正确 code.Here 是我的 code.Iam java swings.Thank你在advance.here是我的密码
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.
你也可以这样做,
JOptionPane.showConfirmDialog((Component) null, "Do you want to close ?", "Window Title", JOptionPane.OK_CANCEL_OPTION);
同样会显示,
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);
}
});