Everytime I move my JSlider my JDialog box is appearing for each position it is moved, I only want it to be displayed once when the user tries to move the JSlider without them making a selection from my menu. How would I do this?
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());
}