|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.EventQueue | +--de.qfs.lib.gui.EventQueue
This EventQueue enables exception handling for exceptions raised in the AWT event loop thread. Since version 0.98.0 this works even with JDK 1.1.
Additionally, a workaround is provided for a problem with some JDKs on Motif systems (linux for example), where no KEY_PRESSED and KEY_TYPED events are generated for the Shift_Tab combination under certain circumstances. This hack generates the neccessary events so tab traversal works both forwards and backwards.
New in qflib 0.98.0 is another hack needed for some Motif systems like the IBM JDKs on linux: They generate Alt-Key events with the modifier bits for ALT and META set, which causes keyboard access of menus to fail (among other Alt-... bindings). If you enable the meta hack, the META modifier will be removed from these key events.
Yet another hack is needed for the blackdown JDK 1.3 on linux: It generates a KEY_TYPED event for the delete key, causing weird symbols to appear in text components. These events are filtered if the delete hack is enabled.
Different ways are used to install an EventQueue as the system event queue
for JDKs 1.1 and 1.2. With JDK 1.1, make sure that the class is in your
CLASSPATH and add the line
AWT.EventQueueClass=de.qfs.lib.gui.EventQueue
to the file
awt.properties
in the lib directory of your JDK. Make sure you
don't put any extra SPACE characters on the line, as some JDKs choke on
them. In any case you must call install
.
Warning: If you use this EventQueue with JDK 1.1 and
install
it, EventQueue.getNextEvent
and EventQueue.peekEvent()
will return WrapperEvents
instead of the normal events and EventQueue.peekEvent(int)
will cease to work. If you want to use these
methods, either check for WrapperEvents and call WrapperEvent.getWrappedEvent
to access the
original event (but dispatch the event through the WrapperEvent's dispatch
method), or temporarily disable the
EventQueue with uninstall
.
Warning: If you use this EventQueue with JDK 1.2 or above,
you must use the EventQueue returned by the instance
method instead of Toolkit.getSystemEventQueue
to poll events with EventQueue.getNextEvent
etc. You can
EventQueue.postEvent
to the system
event queue as usual.
Inner Class Summary | |
class |
EventQueue.WrapperEvent
ActiveEvent that wraps itself around an AWTEvent and dispatches it in JDK 1.2 style through the EventQueue's dispatchEvent method. |
Field Summary | |
protected boolean |
installed
Whether the queue is currently installed. |
protected static EventQueue |
theQueue
The installed Queue or null. |
static int |
WRAPPER_ID
Id for WrapperEvents. |
Constructor Summary | |
EventQueue()
Create a new EventQueue. |
Method Summary | |
void |
dispatchEvent(java.awt.AWTEvent event)
Dispatch an event. |
static boolean |
install()
Install the EventQueue instance as the System EventQueue. |
static java.awt.EventQueue |
instance()
Get the EventQueue instance, if it has been installed. |
static boolean |
isDeleteHackEnabled()
Query whether the delete hack is enabled. |
static boolean |
isInstalled()
Check, whether the EventQueue has been installed. |
static boolean |
isMetaHackEnabled()
Query whether the meta hack is enabled. |
static boolean |
isTabHackEnabled()
Query whether the tab hack is enabled. |
void |
pop()
Public version of pop. |
static void |
setDeleteHackEnabled(boolean enabled)
Set whether the delete hack should be enabled. |
static void |
setExceptionHandler(ExceptionHandler handler)
Set a handler for Exceptions that occur in the AWT event dispatch thread. |
static void |
setMetaHackEnabled(boolean enabled)
Set whether the meta hack should be enabled. |
static void |
setTabHackEnabled(boolean enabled)
Set whether the tab hack should be enabled. |
protected boolean |
tabHack(java.awt.AWTEvent e)
At least on Motif systems (linux for example), no KEY_PRESSED and KEY_TYPED events are generated for the Shift_Tab combination, but only under certain circumstances. |
static void |
uninstall()
Uninstall the EventQueue. |
Methods inherited from class java.awt.EventQueue |
getNextEvent, invokeAndWait, invokeLater, isDispatchThread, peekEvent, peekEvent, postEvent, push |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int WRAPPER_ID
protected static EventQueue theQueue
protected boolean installed
Constructor Detail |
public EventQueue()
Method Detail |
public static java.awt.EventQueue instance()
public static boolean install()
public static void uninstall()
public static boolean isInstalled()
public void dispatchEvent(java.awt.AWTEvent event)
This method is public for the sake of SwingUtil.withEvents
. Don't use it unless you really know what you are
doing.
dispatchEvent
in class java.awt.EventQueue
event
- The event to dispatch.public void pop()
pop
in class java.awt.EventQueue
public static void setExceptionHandler(ExceptionHandler handler)
handler
- The ExceptionHandler to set.public static final boolean isTabHackEnabled()
public static final void setTabHackEnabled(boolean enabled)
enabled
- True to enable the hack.public static final boolean isMetaHackEnabled()
public static final void setMetaHackEnabled(boolean enabled)
enabled
- True to enable the hack.public static final boolean isDeleteHackEnabled()
public static final void setDeleteHackEnabled(boolean enabled)
enabled
- True to enable the hack.protected boolean tabHack(java.awt.AWTEvent e)
e
- The event to check.
|
qflib 0.98.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |