Declare x as an instance variable of the Example class not a local variable of the Example constructor.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class...
Type: Posts; User: pbrockway2
Declare x as an instance variable of the Example class not a local variable of the Example constructor.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class...
Post code. Not the whole thing but showing the button and how you're writing the listener.
Programs can, but typically don't *make* events - they just happen. If you want to make them, you invoke their constructor, like any other class. This doesn't involve an event listener.
If that...