import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
*/
public static void main(String[] args)
{
- // setLogging(); // BH - for event debugging in JavaScript
+ // Platform.startJavaLogging();
getInstance().doMain(args);
}
- private static void logClass(String name)
- {
- // BH - for event debugging in JavaScript
- ConsoleHandler consoleHandler = new ConsoleHandler();
- consoleHandler.setLevel(Level.ALL);
- Logger logger = Logger.getLogger(name);
- logger.setLevel(Level.ALL);
- logger.addHandler(consoleHandler);
- }
-
@SuppressWarnings("unused")
- private static void setLogging()
- {
-
- /**
- * @j2sIgnore
- *
- */
- {
- System.out.println("not in js");
- }
-
- // BH - for event debugging in JavaScript (Java mode only)
- if (!Platform.isJS())
- /**
- * Java only
- *
- * @j2sIgnore
- */
- {
- Logger.getLogger("").setLevel(Level.ALL);
- logClass("java.awt.EventDispatchThread");
- logClass("java.awt.EventQueue");
- logClass("java.awt.Component");
- logClass("java.awt.focus.Component");
- logClass("java.awt.focus.DefaultKeyboardFocusManager");
- }
-
- }
-
/**
* @param args
*/
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Properties;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.swing.SwingUtilities;
public static long time, mark, set, duration;
+ /**
+ * typical usage:
+ *
+ * Platform.timeCheck(null, Platform.TIME_MARK);
+ *
+ * ...
+ *
+ * Platform.timeCheck("some message", Platform.TIME_MARK);
+ *
+ * @param msg
+ * @param mode
+ */
public static void timeCheck(String msg, int mode)
{
long t = System.currentTimeMillis();
}
}
+ /**
+ * Initialize Java debug logging. A representative sample -- adapt as desired.
+ */
+ public static void startJavaLogging()
+ {
+ /**
+ * @j2sIgnore
+ */
+ {
+ logClass("java.awt.EventDispatchThread", "java.awt.EventQueue",
+ "java.awt.Component", "java.awt.focus.Component",
+ "java.awt.event.Component",
+ "java.awt.focus.DefaultKeyboardFocusManager");
+ }
+ }
+
+ /**
+ * Initiate Java logging for a given class. Only for Java, not JavaScript;
+ * Allows debugging of complex event processing.
+ *
+ * @param className
+ */
+ public static void logClass(String... classNames)
+ {
+ /**
+ * @j2sIgnore
+ *
+ *
+ */
+ {
+ Logger rootLogger = Logger.getLogger("");
+ rootLogger.setLevel(Level.ALL);
+ ConsoleHandler consoleHandler = new ConsoleHandler();
+ consoleHandler.setLevel(Level.ALL);
+ for (int i = classNames.length; --i >= 0;)
+ {
+ Logger logger = Logger.getLogger(classNames[i]);
+ logger.setLevel(Level.ALL);
+ logger.addHandler(consoleHandler);
+ }
+ }
+ }
+
+
}