satellite03
IS-IT--Management
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Demo {
static JFrame jframe = new JFrame("Example");
public static void setupJFrame() {
jframe.setSize(400,100);
jframe.setVisible(true);
jframe.setLayout( new FlowLayout() );
WindowListener l = new WindowAdapter() { // line-1
public void windowClosing(WindowEvent e) {
System.exit(0);}
};
jframe.addWindowListener(l);
}
public static void main(String[] args) {
setupJFrame();
JButton jb = new JButton("pressure");
jframe.getContentPane().add( jb );
jframe.setVisible(true);
}
}
How can i write //line-1 inside a method ? look, thats not a variable . had it been a variable x,y,z etc we could write
int x=0;
int y=3;
but thats not a variable , so how can i write this way