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 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 javax.imageio.*;
import java.math.*;
import processing.core.*;
import oshi.SystemInfo;
import oshi.hardware.*;
import javax.imageio.metadata.*;
import javax.imageio.stream.*;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.awt.datatransfer.StringSelection;
public class main {
public static void main(final String[] args) throws Exception {
final PGauge gauge1 = pMain(PGauge.class);
Window w = getWindow(gauge1);
for (WindowListener l : w.getWindowListeners()) w.removeWindowListener(l);
getParent(gauge1).remove(gauge1);
disposeWindow(w);
showPackedFrame(gauge1);
printComponentTree(getFrame(gauge1));
while (licensed()) {
try {
GlobalMemory m = oshi_systemMemory();
double percent = 100 - percentRatio(m.getAvailable() - m.getSwapUsed(), m.getTotal());
String title = "RAM used";
gauge1.setValue(percent, iround(percent) + "% of " + title);
} catch (Throwable __e) {
_handleException(__e);
}
sleepSeconds(1);
}
}
public static A pMain(final Class c) {
return first(pMainWithFrame(c));
}
public static Pair pMainWithFrame(final Class c) {
return swing(new F0>() {
public Pair get() {
try {
fixContextClassLoader();
A a = nuInstance(c);
PApplet.runSketch(new String[] { c.getName() }, a);
Frame frame = a.frame;
return pair(a, frame);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "fixContextClassLoader();\r\n A a = nuInstance(c);\r\n //Set frames =...";
}
});
}
public static PApplet2 pMain() {
return pMain(mc());
}
public static Window getWindow(Object o) {
if (!(o instanceof Component))
return null;
Component c = (Component) o;
while (c != null) {
if (c instanceof Window)
return (Window) c;
c = c.getParent();
}
return null;
}
public static Container getParent(final Component c) {
return c == null ? null : swing(new F0() {
public Container get() {
try {
return c.getParent();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "c.getParent()";
}
});
}
public static void disposeWindow(final Window window) {
if (window != null) {
swing(new Runnable() {
public void run() {
try {
window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
myFrames_list.remove(window);
window.dispose();
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING)); //...";
}
});
}
}
public static void disposeWindow(final Component c) {
disposeWindow(getWindow(c));
}
public static void disposeWindow(Object o) {
if (o != null)
disposeWindow(((Component) o));
}
public static void disposeWindow() {
disposeWindow(heldInstance(Component.class));
}
public static JFrame showPackedFrame(String title, Component contents) {
return packFrame(showFrame(title, contents));
}
public static JFrame showPackedFrame(Component contents) {
return packFrame(showFrame(contents));
}
public static void printComponentTree(String indent, Component c) {
print(indent + c);
if (c instanceof Container)
for (Component comp : ((Container) c).getComponents()) printComponentTree(indent + " ", comp);
}
public static void printComponentTree(Component c) {
printComponentTree("", c);
}
public static JFrame getFrame(final Object _o) {
return swing(new F0() {
public JFrame get() {
try {
Object o = _o;
if (o instanceof ButtonGroup)
o = first(buttonsInGroup((ButtonGroup) o));
if (!(o instanceof Component))
return null;
Component c = (Component) o;
while (c != null) {
if (c instanceof JFrame)
return (JFrame) c;
c = c.getParent();
}
return null;
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "O o = _o;\r\n if (o instanceof ButtonGroup) o = first(buttonsInGroup((Button...";
}
});
}
public static volatile boolean licensed_yes = true;
public static boolean licensed() {
ping();
return licensed_yes;
}
public static void licensed_off() {
licensed_yes = false;
}
public static GlobalMemory oshi_systemMemory() {
return oshi_hardware().getMemory();
}
public static double percentRatio(double x, double y) {
return ratioToPercent(x, y);
}
public static int iround(double d) {
return (int) Math.round(d);
}
public static volatile Throwable _handleException_lastException;
public static List _handleException_onException = synchroList(ll("printStackTrace2"));
public static void _handleException(Throwable e) {
_handleException_lastException = e;
for (Object f : cloneList(_handleException_onException)) try {
callF(f, e);
} catch (Throwable e2) {
printStackTrace2(e2);
}
}
public static void sleepSeconds(double s) {
if (s > 0)
sleep(round(s * 1000));
}
public static Map myFrames_list = weakHashMap();
public static List myFrames() {
return swing(new F0>() {
public List get() {
try {
return keysList(myFrames_list);
} catch (Exception __e) {
throw rethrow(__e);
}
}
public String toString() {
return "keysList(myFrames_list)";
}
});
}
public static Throwable printStackTrace2(Throwable e) {
print(getStackTrace2(e));
return e;
}
public static void printStackTrace2() {
printStackTrace2(new Throwable());
}
public static void printStackTrace2(String msg) {
printStackTrace2(new Throwable(msg));
}
public static Object first(Object list) {
return empty((List) list) ? null : ((List) list).get(0);
}
public static A first(List list) {
return empty(list) ? null : list.get(0);
}
public static A first(A[] bla) {
return bla == null || bla.length == 0 ? null : bla[0];
}
public static A first(Iterable i) {
if (i == null)
return null;
Iterator it = i.iterator();
return it.hasNext() ? it.next() : null;
}
public static Character first(String s) {
return empty(s) ? null : s.charAt(0);
}
public static A first(Pair p) {
return p == null ? null : p.a;
}
public static Object swing(Object f) {
return swingAndWait(f);
}
public static A swing(F0 f) {
return (A) swingAndWait(f);
}
public static A get(List l, int idx) {
return l != null && idx >= 0 && idx < l(l) ? l.get(idx) : null;
}
public static A get(A[] l, int idx) {
return idx >= 0 && idx < l(l) ? l[idx] : null;
}
public static boolean get(boolean[] l, int idx) {
return idx >= 0 && idx < l(l) ? l[idx] : false;
}
public static Object get(Object o, String field) {
try {
if (o instanceof Class)
return get((Class) o, field);
if (o instanceof Map)
return ((Map) o).get(field);
Field f = getOpt_findField(o.getClass(), field);
if (f != null) {
f.setAccessible(true);
return f.get(o);
}
} catch (Exception e) {
throw asRuntimeException(e);
}
throw new RuntimeException("Field '" + field + "' not found in " + o.getClass().getName());
}
public static Object get_raw(Object o, String field) {
try {
Field f = get_findField(o.getClass(), field);
f.setAccessible(true);
return f.get(o);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static Object get(Class c, String field) {
try {
Field f = get_findStaticField(c, field);
f.setAccessible(true);
return f.get(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
public static Field get_findStaticField(Class> c, String field) {
Class _c = c;
do {
for (Field f : _c.getDeclaredFields()) if (f.getName().equals(field) && (f.getModifiers() & java.lang.reflect.Modifier.STATIC) != 0)
return f;
_c = _c.getSuperclass();
} while (_c != null);
throw new RuntimeException("Static field '" + field + "' not found in " + c.getName());
}
public static Field get_findField(Class> c, String field) {
Class _c = c;
do {
for (Field f : _c.getDeclaredFields()) if (f.getName().equals(field))
return f;
_c = _c.getSuperclass();
} while (_c != null);
throw new RuntimeException("Field '" + field + "' not found in " + c.getName());
}
public static void fixContextClassLoader() {
Thread.currentThread().setContextClassLoader(myClassLoader());
}
public static A nuInstance(Class c) {
return nuEmptyObject(c);
}
public static Pair pair(A a, B b) {
return new Pair(a, b);
}
public static Pair pair(A a) {
return new Pair(a, a);
}
public static RuntimeException rethrow(Throwable t) {
if (t instanceof Error)
_handleError((Error) t);
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t);
}
public static Class mc() {
return main.class;
}
public static A heldInstance(Class c) {
List