Java Tip 142: Pushing JButtonGroup

Swing's ButtonGroup class allows radio button grouping to ensure single selection; however, the implementation raises many question marks. You cannot retrieve a reference to the currently selected button in the group, and the class...

09/19/03

Java Tip 141: Fast math with JNI

Java 2 Platform, Standard Edition (J2SE) 1.4x uses a new StrictMath package to perform mathematical calculations, but many of these math routines are much slower than the corresponding routines in J2SE 1.3. Luckily, Java...

08/15/03

Java Tip 140: Automatically generate JavaBeans from XSL files in J2EE applications

One way to write Java 2 Platform, Enterprise Edition (J2EE) applications that produce dynamic content is to use servlets, JavaBeans, XML, HTML, and XSLT (Extensible Stylesheet Language Transformations). In this tip, Klaus Berg looks...

07/11/03

Java Tip 139: Ask the right questions in your survey application

Businesses often use surveys for market research, user feedback, and various evaluation methods. Increasingly, surveys are being placed online, and good software is needed to make them more efficient and cost effective. Some surveys...

06/27/03

Java Tip 138: Still parsing to generate your JavaBeans' XML representation?

Empower your JavaBeans to handle data conversion to and from their XML document format without complicating the code. This tip shows you how to write and use a component to convert a JavaBean to its XML document representation and...

05/09/03

Java Tip 137: Manage distributed JTables

When displaying tables with tens of thousands of rows (or more), it is imperative they quickly respond and display. One way to achieve this is by using a specialized TableModel that retrieves data from a server only when it is...

04/18/03

Java Tip 136: Protect Web application control flow

Struts, from the Apache Jakarta Project, implements the Synchronizer Token pattern to prevent duplicate form submission. Applying this pattern, you can detect this situation and follow an alternate course of action when it happens....

03/14/03

Java Tip 135: Layer and compare property files

Are you still using one big property file? Using multiple property files instead can also be unwieldy, unless you have the right tools. You can layer property files easily when you use the PropDiff utility. Layered property files are...

02/28/03

Java Tip 134: When catching exceptions, don't cast your net too wide

In contrast to some other languages, Java's simplicity and consistency allow compilers to detect many more errors. Java developers learn to rely on their compilers to catch assignments to incorrect types, calls of nonexistent methods...

02/14/03

Java Tip 133: More on typesafe enums

Published in early 1997, " Java Tip 27: Typesafe Constants in C++ and Java" discussed how to create and use typesafe constants (enums) in both Java and C++. Since then, various JavaWorld articles have covered how to enhance this...

01/24/03

Java Tip 132: The taming of the thread

With MutableThread and ThreadWatchDog, you can make your threads come back to life and continue running seamlessly even after thread death.

11/15/02

Java Tip 131: Make a statement with javac!

To learn part of a new API or even some important Java nuance, you'll often find it useful to run a short bit of code. In this Java Tip, Shawn Silverman explains how to easily and quickly test one or more Java statements. The program...

08/30/02

Java Tip 130: Do you know your data size?

Over the years many Java developers have asked, "How much memory does a Java object consume?" In this Java Tip, Vladimir Roubtsov explains problems with previous solutions. In addition, based on his experience exploring memory usage,...

08/16/02

Java Tip 129: SGLayout—a layout manager for the rest of us

Complex graphical user interfaces (GUIs) can be difficult to set up using standard Java layout managers like BorderLayout, GridLayout, or FlowLayout. While GridBagLayout proves a much more powerful standard Java layout manager, it...

08/02/02

Java Tip 128: Create a quick-and-dirty XML parser

This tip shows you how to parse XML when running in an applet or other space-restricted environment, such as a J2ME (Java 2 Platform, Micro Edition) application. The process limits functionality in a way that many small applications...

05/31/02

Java Tip 127: See JAR run

This tip shows how to turn an unrunnable Java Archive (JAR) into a runnable one, without having to directly manipulate manifest files. You learn to develop a short program that enables any JAR to run with the java -jar command or on...

05/10/02

Java Tip 126: Prepare cross-server database access methods with JDBC

Server-side Web applications often need to access backend databases. A set of well-designed and efficiently implemented database access methods can greatly reduce the maintenance overhead and improve your Web applications'...

04/05/02

Java Tip 125: Set your timer for dynamic properties

Property files let you reconfigure your Java application without recompiling. Typically, however, you need to restart your application to load the new properties. This tip shows you how to load new property files without restarting...

03/29/02

Java Tip 124: Trace your steps in Java 1.4

Ever get the feeling you might be lost? Java can help you find your way back, at least in your programs. In the past, Java lacked the simple ability to map runtime code back to its position in the source code file. The pre-Java 1.4...

03/08/02

Java Tip 123: Dial into the wireless world

This tip uses a phone book example to show how to build, configure, and run a simple wireless application. The example demonstrates connectivity between a WML (Wireless Markup Language) client device and the Tomcat Web server through...

02/08/02

Load More