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/2003

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/2002

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/2002

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/2002

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/2002

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/2002

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/2002

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/2002

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/2002

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/2002

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/2002

Java Tip 122: Beware of Java typesafe enumerations

The so-called typesafe enum construct has gained popularity since its increased coverage in several publications and admittance into the Sun JDK implementation. But be warned: this tip shows that the construct isn't as safe as you...

01/04/2002

Java Tip 120: Execute self-extracting JARs

This tip presents an easy way to make self-extracting Java Archives (JARs). A self-extracting archive can extract the contained files to user-selected directories on any Java platform. Your users are only required to have a Java...

11/16/2001

Java Tip 119: Don't know much about file history?

Many file processing applications have a history mechanism that tracks the last processed files. Typically these filenames are appended to the bottom of a File menu in the order you have processed them. This tip provides a class that...

11/02/2001

Java Tip 118: Utilize the EjbProxy

This tip introduces you to the EjbProxy utility class. It instantiates and invokes a remote EJB without coupling your code directly to a specific implementation of that particular EJB.

10/12/2001

Java Tip 117: Transfer binary data in an XML document

XML has gained popularity as a platform- and language-independent format for transferring data across systems. In situations where you need to transfer binary data within an XML document, you must encode that binary data into an...

09/28/2001

Java Tip 116: Set your table options -- at runtime!

The JTable class offers rich functionality for grid-like data display. This Java tip addresses common display issues related to dynamically changing such things as scroll bars, column width, and row height.

09/14/2001

Java Tip 115: Secure JavaMail with JSSE

JavaMail storage providers lack direct SSL connection support, but luckily, the JSSE API provides support for SSL or TLS network connections. This tip combines the functionality of a JavaMail framework with an SSL socket factory from...

08/31/2001

Java Tip 114: Add ghosted drag images to your JTrees

When using drag and drop, a drag image is a useful visual reminder of what is actually being dragged. However on some platforms, notably Microsoft's Win32, the drag image requested in your Java program is ignored, depriving the user...

08/10/2001

Java Tip 113: Identify subclasses at runtime

Java Reflection provides a lot of information about a given class at runtime; you can easily know all its super classes, implemented interfaces, methods, constructors, fields, and so on. But in some cases, you may want to know all the...

06/29/2001

Load More