Wednesday, March 15, 2006

Java Widgets....SWT??

I have started investigating SWT as a platform for a Java based widget library. A quick test on my Fedora machine showed everything I require is possible, plus support for non rectangular windows, err Shells. I will continue my testing on Windows and OS X and see if all of these features work on all platforms. I have my doubts.

EDIT: After a year of not messing with this idea, looks like I can just use the work done by Joshua Marinacci. Thanks!

Sunday, March 12, 2006

J2SE and Widgets

I am working on creating a JWidget class and am looking for the correct base class. I want my widget to be always on top, not appear in the windows task bar, have no decorations and accept both mouse and keyboard input. I have investigated JFrame, JWindow and JDialog on J2SE 1.4.2 and J2SE 5. here are the results:

J2SE 1.4.2
FeatureJFrameJWindowJDialog
Invisible on task barNOYESYES
can be always on topNONONO
No DecorationsYESYESNO
Accepts mouse inputYESYESYES
Accepts keyboard inputYESNOYES



J2SE 5
FeatureJFrameJWindowJDialog
Invisible on task barNOYESYES
can be always on topYESYES*YES
No DecorationsYESYESYES
Accepts mouse inputYESYESYES
Accepts keyboard inputYESNOYES
(*) must always be on top.

Unfortunately there are some considerable differences between 1.4.2 and 5. I might want to limit my JWidget class to 1.4.2 functionality to support OS X. more on that later. Provided J2SE is an option, it looks like JDialog is the way to go, though JFrame is perfectly acceptable if being invisible on the task bar is not a concern. I admit I was surprised that JDialog would meet all my requirements, I am going to do some more investigating to make sure that JDialog does not perform oddly on the different platforms.

Also, since these different pieces of functionality are provided by different classes. It looks as though making sensible methods like setVisibleOnTaskBar() will be impossible.