I read the book "Learning java" and thought that I understood what was happening. But on the Internet I came across a lesson with events. Here is the code:
import java.awt.*; import java.applet.*; public class Focus extends Applet { String msg; public void init() { msg=""; Font font=new Font("TimesRoman",Font.BOLD,16); setFont(font); } public void paint(Graphics g) { g.drawString(msg,50,50); } public boolean gotFocus(Event evt, Object arg) { msg="Получен фокус"; repaint(); return true; } public boolean lostFocus(Event evt, Object arg) { msg="Фокус утерян"; repaint(); return true; } }
How it works? Where are the internal classes with implementations, where are the students? And in general, I was surprised how it started. Comrades, please explain!