I need help in trying to understand why I am getting the following error message when i was once able to compile and run the program, but now all of a sudden, i'm getting en error.
-------------------------
java.lang.NoSuchMethodError: main
Exception in
thread "main"
--------------------------
Below is the program code:
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
class Changes extends JFrame implements ChangeListener {
// Create the components
JSlider scale = new JSlider(0,100,10);
JLabel position = new JLabel("Set Position");
public Changes() {
// Create the window
super("Change Events"); setSize(300, 80);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
// Create the container
Container content = getContentPane();
FlowLayout lay = new FlowLayout(FlowLayout.LEFT);
content.setLayout(lay);
// Configure slider component
scale.setMajorTickSpacing(10);
scale.setMinorTickSpacing(5);
scale.setPaintTicks(true);
scale.setPaintLabels(true);
// Add the event listener
scale.addChangeListener(this);
// Add the components
content.add(scale);
content.add(position);
setContentPane(content);
}
public void stateChanged(ChangeEvent event)
{
// Add the event handler
JSlider src = (JSlider) event.getSource();
if(!src.getValueIsAdjusting())
position.setText("Position is "+ scale.getValue());
}
public static void main(
String[] args)
{ Changes eg = new Changes(); }
}
----------------------
Thanks in advance!