You should have a reference of the frame so that you can access it whereever you need.
I guess the frame is the main application frame. So it can be singleton. What I would do in this scenario is...
class MyFrame extends JFrame {
private static frame MyFrame;
private MyFrame () {
}
public static getFrame() {
if (frame == null)
frame = new MyFrame();
return frame;
}
And in the Listener(instead anywhere you want)...
I can use MyFrame.getFrame() to access the frame...