Previous | Next | Trail Map | Creating a GUI with JFC/Swing | Converting to Swing

General Conversion Tips

[PENDING: this section is under construction. Please don't confuse the following notes with real content.]

Empty Space

At least with the default look and feel (Java Look & Feel), the Swing components tend to be tighter (that is, they contain less empty space). To get a sparser look, you might have to add empty borders to some components or margins to text components. [PENDING: explicitly choose a sparser L&F?]

Converting Painting Code

Talk about how painting code should move to paintComponent (and definitely not update), and that double-buffering is automatic now.

If your painting code draws a title or draws edges around the component, consider replacing it with a border(in the Creating a User Interface trail). For example, you an easily create a box around a group of components by adding the components to a JPanel and making the panel have a border.

If you implement paintComponent then you must call super.paintComponent first thing. If you don't, even if the component is opaque it won't automatically paint its background. The drawing trail will have details.

Don't paint directly in JApplet because it will be covered by the automatic content pane. Instead, use a separate class to do the painting and add it to the applet's content pane.

Converting Images

[PENDING]

What Else?

Please send us mail (subject: Converting to Swing) with suggestions. Thanks!


Previous | Next | Trail Map | Creating a GUI with JFC/Swing | Converting to Swing