13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

17.3 Porting BudgetPro to SWT395model. This will be your biggest challenge. Go to it. It is a great way to learn.Of course, you can also just download the complete SWT applicati<strong>on</strong> from thebook Web site. 1517.3.5 Completing the C<strong>on</strong>versi<strong>on</strong> of the <str<strong>on</strong>g>Applicati<strong>on</strong></str<strong>on</strong>g>Completing the c<strong>on</strong>versi<strong>on</strong> of the BudgetPro class does not complete thec<strong>on</strong>versi<strong>on</strong> of the entire applicati<strong>on</strong>. The AcctDialog class must also be c<strong>on</strong>verted.Use the same techniques we described here to c<strong>on</strong>vert that class as well.(Or, again, just download the complete SWT applicati<strong>on</strong>.)17.3.6 Closing ThoughtsOur overall impressi<strong>on</strong> is that SWT is more easily comprehended in its entiretythan Swing. It may be easier to learn SWT first, since Swing’s core model ismore complex but more powerful. But SWT and Swing weren’t developed inthat order and Swing is still much more widely used. 16For many GUI applicati<strong>on</strong>s, our feeling is that it may be faster to write inthe SWT idiom. The problem lies in that SWT’s model has limitati<strong>on</strong>s thatSwing’s does not. Notably, SWT GUI elements are in a single rigid tree structure.It is not possible to have a factory class that c<strong>on</strong>structs a GUI elementsuch as a dialog box which is passed up to the caller to be grafted into place <strong>on</strong>a GUI. Instead, the parent element must be passed in, so all GUI elements bel<strong>on</strong>gto the single tree from the moment they are created. Also, by introducingobjects that cannot be garbage-collected, SWT brings into your applicati<strong>on</strong> thepossibility of a class of bugs that Java otherwise eliminates.Moreover, while c<strong>on</strong>verting a Swing applicati<strong>on</strong> helped give this chaptershape, we would, in general, prefer that an applicati<strong>on</strong> be designed with its GUItoolkit in mind. You would likely make slightly different design decisi<strong>on</strong>sdepending <strong>on</strong> which style of the GUI you choose.15. http://www.javalinuxbook.com/16. A gut feel—not based <strong>on</strong> any real statistics.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!