|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectd.g
public final class g
This class provides static methods which send output to a GUI.
This class was designed to require as little typing as possible to use. In particular, all public names (package, class, and method) are lower case and very short. So, you can avoid import statements and easily invoke all methods using their fully qualified form. Here is a typical use:
StringBuilder sb = new StringBuilder();
d.g.s(sb);
Mnemonic: the package name d stands for debug; the class name g stands for GUI; all the methods named s stand for send.
Like typical Java GUI code, this class's gui parts (the g.ObjectStateDisplay
inner class) are not multithread safe:
they expect to only be called by EventQueue
's dispatch thread
.
Note, however, that the public API s
methods may be safely called by any thread.
Nested Class Summary | |
---|---|
private static class |
g.ObjectStateDisplay
... |
static class |
g.UnitTest
See the Overview page of the project's javadocs for a general description of this unit test class. |
Constructor Summary | |
---|---|
private |
g()
This private constructor suppresses the default (public) constructor, ensuring non-instantiability. |
Method Summary | |
---|---|
static void |
s(Object obj)
Simply calls s(null, obj, true) . |
static void |
s(Object obj,
boolean pauseExecution)
Simply calls s(null, obj, pauseExecution) . |
static void |
s(String label,
Object obj)
Simply calls s(label, obj, true) . |
static void |
s(String label,
Object obj,
boolean pauseExecution)
Displays obj's state in a new window. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
private g()
Method Detail |
---|
public static void s(Object obj) throws RuntimeException
s(null, obj, true)
.
RuntimeException
public static void s(Object obj, boolean pauseExecution) throws RuntimeException
s(null, obj, pauseExecution)
.
RuntimeException
public static void s(String label, Object obj) throws RuntimeException
s(label, obj, true)
.
RuntimeException
public static void s(String label, Object obj, boolean pauseExecution) throws RuntimeException
Any thread may call this method with any combination of params except this one situation:
if EventQueue
's dispatch thread
calls this method,
then the pauseExecution param must be false (if it were true, then the GUI would freeze).
label
- text labelling the new windowobj
- the object whose state is displayed; there are no constraints on it (e.g. may be null)pauseExecution
- if true, then executes synchronously
(i.e. the calling Thread waits until the user either closes the window or clicks on the "Continue Execution" button before returning from this method);
otherwise executes asynchornously (i.e. exits almost immediately, regardless of user input)
RuntimeException
- (or some subclass) if any error occurs; this may merely wrap some other underlying Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |