import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import java.util.function.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.geom.*;
import javax.imageio.*;
import java.math.*;
import java.time.Duration;
import java.lang.invoke.VarHandle;
import java.lang.invoke.MethodHandles;
import javax.swing.event.AncestorListener;
import javax.swing.event.AncestorEvent;
import javax.swing.Timer;
import static x30_pkg.x30_util.DynamicObject;
import java.text.*;
import java.text.NumberFormat;
import java.util.TimeZone;
import java.awt.geom.*;
class main {
static A repaintEvery(int ms, A c) {
return awtDoEvery(c, ms, () -> c.repaint());
}
static A repaintEvery(double seconds, A c) {
return awtDoEvery(c, seconds, () -> c.repaint());
}
static A repaintEvery(A c, int ms) {
return repaintEvery(ms, c);
}
static A awtDoEvery(A component, long delay, Runnable r) {
return awtEvery(component, delay, r);
}
static A awtDoEvery(A component, long delay, long firstDelay, Runnable r) {
return awtEvery(component, delay, firstDelay, r);
}
static void awtDoEvery(RootPaneContainer frame, long delay, Runnable r) {
awtEvery(frame, delay, r);
}
static A awtDoEvery(A component, double delaySeconds, Runnable r) {
return awtEvery(component, delaySeconds, r);
}
static A awtEvery(A component, long delay, Object r) {
swingEvery(component, delay, r);
return component;
}
static A awtEvery(A component, long delay, Runnable r) { return awtEvery(component, delay, delay, r); }
static A awtEvery(A component, long delay, long firstDelay, Runnable r) {
return awtEvery(component, delay, firstDelay, (Object) r);
}
static A awtEvery(A component, long delay, long firstDelay, Object r) {
swingEvery(component, delay, firstDelay, r);
return component;
}
static void awtEvery(RootPaneContainer frame, long delay, Object r) {
swingEvery(frame, delay, r);
}
static A awtEvery(A component, double delaySeconds, Object r) {
return awtEvery(component, toMS(delaySeconds), r);
}
static void swingEvery(JComponent component, long delay, Object r) {
installTimer(component, delay, r);
}
static void swingEvery(JComponent component, long delay, long firstDelay, Object r) {
installTimer(component, r, delay, firstDelay);
}
static void swingEvery(RootPaneContainer frame, long delay, Object r) {
installTimer(frame, delay, r);
}
static void swingEvery(RootPaneContainer frame, long delay, long firstDelay, Object r) {
installTimer(frame, delay, firstDelay, r);
}
static long toMS(double seconds) {
return (long) (seconds*1000);
}
// first delay = delay
static Timer installTimer(JComponent component, Object r, long delay) {
return installTimer(component, r, delay, delay);
}
// first delay = delay
static Timer installTimer(RootPaneContainer frame, long delay, Object r) {
return installTimer(frame.getRootPane(), r, delay, delay);
}
// first delay = delay
static Timer installTimer(JComponent component, long delay, Object r) {
return installTimer(component, r, delay, delay);
}
static Timer installTimer(JComponent component, long delay, long firstDelay, Object r) {
return installTimer(component, r, delay, firstDelay);
}
static Timer installTimer(final JComponent component, final Object r, final long delay, final long firstDelay) {
return installTimer(component, r, delay, firstDelay, true);
}
static Timer installTimer(final JComponent component, final Object r, final long delay, final long firstDelay, final boolean repeats) {
if (component == null) return null;
return (Timer) swingAndWait(new F0