Batch Text Inserts with JTextPane

Part II of “Faster JTextPane Text Insertion” describes another technique for overcoming some of JTextPane‘s performance limitations when initiatializing large documents with complex styles. The ElementSpec class, defined as part of DefaultStyledDocument, provides a way to batch updates and apply them in bulk. Depending on size and complexity of the document, the speed boost can be significant.

Setting JTextPane Font and Color

Swing’s JTextPane supports styled text, embedded images and components, and other features not available in the AWT TextArea. However, basic operations like setting the font and color for the text are somewhat more complicated with JTextPane than with TextArea and other simpler text components. “Setting JTextPane Font and Color” illustrates the use of character attributes for setting these text properties.

Speeding Up Deep Copies

You can use Java Object Serialization to make deep copies of Java objects, creating distinct copies of an object and all of the objects that it references. “Faster Deep Copies of Java Objects” explains the difference between deep copies and shallow copies (as implemented by the clone method), shows a common approach to using Java Object Serialization for copies, and then provides some simple optimizations to squeeze a bit more speed out of the deep copy process.

Before you sign up for a Virtual Dedicated Server…

Virtual Dedicated Servers (or Virtual Private Servers) provide a cost-effective alternative to dedicated servers for many kinds of application deployments. There are, however, some subtle issues with deploying Java applications on these systems. “Deploying Java Apps on a Virtual Dedicated Server” describes some questions you may want to ask before signing up with a VDS hosting service.