?
_.-=
Hi!
I know that there is definitely something wrong with this code but I'm
trying to get both the class that creates a frame as well as the class that
implements the WindowListener into one single class so the compiled code
results in a single .class file. Could anyone help me out with this?
import java.awt.*;
import java.awt.event.*;
class SymbiWin {
public static void main(String args[]) {
SymbiWin s1 = new SymbiWin();
}
SymbiWin() {
Frame win1 = new Frame("win1");
Label lab1 = new Label("lab1");
win1.add(lab1);
win1.addWindowListener(this);
win1.pack();
win1.show();
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
I know that there is definitely something wrong with this code but I'm
trying to get both the class that creates a frame as well as the class that
implements the WindowListener into one single class so the compiled code
results in a single .class file. Could anyone help me out with this?
import java.awt.*;
import java.awt.event.*;
class SymbiWin {
public static void main(String args[]) {
SymbiWin s1 = new SymbiWin();
}
SymbiWin() {
Frame win1 = new Frame("win1");
Label lab1 = new Label("lab1");
win1.add(lab1);
win1.addWindowListener(this);
win1.pack();
win1.show();
}
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}