JSlider を移動するたびに、移動する位置ごとに JDialog ボックスが表示されます。ユーザーがメニューから選択せずに JSlider を移動しようとすると、一度だけ表示されるようにします。どうすればいいですか?
public void stateChanged(ChangeEvent e)
{
if(myFrame.shape == null)
{
JOptionPane.showMessageDialog(popUp, "You should select an item first.", "Information", JOptionPane.WARNING_MESSAGE);
}
else if(myFrame.shape != null)
{
DecimalFormat df = new DecimalFormat("0.0");
float value = diameterJSlider.getValue();
String strValue = Float.toString(value);
sliderLabel.setText(strValue);
boundaryTextField.setText("" + df.format(myFrame.shape.getBoundary(value)));
areaTextField.setText("" + df.format(myFrame.shape.getArea(value)));
myTopPanel.reDraw(diameterJSlider.getValue());
}