In this last AWT Video, we will see how to handle events using Adapter Class and Anonymous class. Here, we will use AWT Frame Window and handle window closing events using WindowAdpater.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import java.awt.Window; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class WindowClosingAdaptor extends WindowAdapter { private Window theWindow; WindowClosingAdaptor(Window obj) { theWindow = obj; } @Override public void windowClosing(WindowEvent e) { theWindow.dispose(); } } |
Categories: AWT-Tube