package mpmetr.ui;
import javax.swing.JApplet;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
public final class MainApplet extends JApplet {
private MainPanel panel;
@Override
public void init() {
panel = new MainPanel("Click to start");
add(panel);
}
@Override
public void start() {
panel.scale();
addFocusListener(new FocusAdapter() {
boolean launched = false;
@Override
public void focusGained(FocusEvent focusEvent) {
if (launched) return;
launched = true;
panel.launch();
}
});
}
}