Kuix is an open-source project for kalmeo's j2-based graphics;
As a graphics library, it has several standard configurations:
A basic canvas. This canvas is called kuixcanvas. It belongs to the package org. kalmeo. kuix. Core;
An interface. A wide range of graphic class libraries on the canvas all implement the same interface or inherit from the same adapter class;
This adapter class is called a widget; it belongs to the package: org. kalmeo. kuix. widget;
How does kuixcanvas pass button events or touch screen events to widgets? Kuixcanvas's response to key events is handled by processkeyevent. processkeyevent converts a key event to a key value defined by kuix based on the key value table of kuix, and then works with the key type, put in an int [], and finally added to a vector. This vector is called keyevents;
Processing of touch screen events is handled by processpointerevent and added to pointerevents;
Kuix defines its own key-value table to be compatible with different mobile phone platforms. It also defines some specific key-value tables through platform recognition;
Kuix supports Moto, Nokia, Samsung, Sony Ericsson, and sun;
In kuixcanvas, A workertask processes keyevents and pointerevents. it traverses the entire vector, obtains the focusmanager, and uses the focusmanager to process events;
If (! Keyevents. isempty () if not empty <br/> for (INT I = 0; I <keyevents. size (); ++ I) traverses keyevent <br/> int [] keyevent = (INT []) keyevents. elementat (I); Retrieve keyevent <br/> focusmanager = desktop. getcurrentfocusmanager (); get the current focus manager; <br/> focusmanager. processkeyevent (byte) keyevent [0], keyevent [1]) Let the focus manager handle this event; <br/> repaintnextframe (); redraw; <br/> keyevents. removeallelements (); clear;
In focusmanager, the event processing method of the current focus widget is called:
Focusdwidget. processkeyevent ();