|
Re: Fonts and Keyboard State [message #467127 is a reply to message #466964] |
Wed, 25 January 2006 16:02 |
Eclipse User |
|
|
|
Originally posted by: eclipse.stefkoch.net
Adam Kumpf wrote:
> Hello,
>
> Does anyone know of a way to get a key stateMask (to see if control,
> shift, etc.) are being pushed without explicitly creating a handful of
> keydown, keyup listeners?
>
> Also, I really like to serialize classes to save state of objects I'm
> using in various places. What is the best way to store and set font
> information? Can I build a font without putting it on a display? or is
> there a way to easily extract the font information into a
> display-independant variable so that it can be serialized and re-loaded
> later?
>
> Thanks,
> Adam
> kumpf@mit.edu
>
>
>
>
try this
static String stateMask(int stateMask) {
String string = "";
if ((stateMask & SWT.CTRL) != 0)
string += " CTRL";
if ((stateMask & SWT.ALT) != 0)
string += " ALT";
if ((stateMask & SWT.SHIFT) != 0)
string += " SHIFT";
if ((stateMask & SWT.COMMAND) != 0)
string += " COMMAND";
return string;
}
u can retrieve the stateMask from the event by using e.stateMask
regards,
stefan
|
|
|
Powered by
FUDForum. Page generated in 0.02795 seconds