Each Swing look and feel has a long list of User Interface Defaults (UI defaults) used to initialize Java components with default fonts, colors, icons, borders, and more. You can get and set these defaults to tune your application's overall appearance. This article shows how to use these defaults and surveys the principal look and feels for Java on Windows, Mac OS X, and Linux, to create a long list of the names and data types for their many UI defaults.
Zebra stripes are subtle alternating stripes painted behind list items in a graphical user interface (GUI). They improve the readability of wide and long lists, but the
JList class in Java's Swing doesn't support them. This tip shows how to extend
JList to add zebra background stripes.
Table zebra stripes are alternating subtle background stripes painted behind the table's rows in a graphical user interface (GUI). They improve the readability of long rows in wide tables, but the
JTable class in Java's Swing doesn't support them. This tip shows how to extend
JTable to add zebra background stripes.
Zebra stripes in a graphical user interface (GUI) are subtle background stripes painted behind the rows of a hierarchical list, or tree. They improve the readability of wide tree rows, but the
JTree class in Java's Swing doesn't support them. This tip shows how to extend
JTree to add zebra background stripes.
The starting point for building a link checker, web spider, or web page analyzer is, of course, to get the web page from the web server. Java's
java.net package includes classes to manage URLs and to open web server connections. This tip shows how to use them to a get text, image, audio, or data file from a web server.
Performance optimization requires that you measure the time to perform a task, then try algorithm and coding changes to make the task faster. Prior to Java 5, the only way to time a task was to measure wall clock time. Unfortunately, this gives inaccurate results when there is other activity on the system (and there always is). Java 5 introduced the
java.lang.management package and methods to report CPU and user time per thread. These times are not affected by other system activity, making them just what we need for benchmarking. This article shows how to use the
java.lang.management package to benchmark your application.
Java's threads are essential for building complex applications, but thread control is split across several classes in different packages added at different times in the JDK's history. This tip shows how to connect these classes together to find threads and thread groups, and get thread information.
Java has several ways to parse integers from strings. Performance differences between these methods can be significant when parsing a large number of integers. Doing your own integer parsing can provide an important speed boost. This tip looks at five ways to parse integers, compares their features, and benchmarks them to see which method is the fastest.
Java has several classes for reading files, with and without buffering, random access, thread safety, and memory mapping. Some of these are much faster than the others. This article benchmarks 13 ways to read bytes from a file and shows which ways are the fastest.
User interface themes for Mac OS X, Windows, and Linux define the OS-wide look of window frames, buttons, scrollbars, and the like. Preference settings enable users to tune color schemes to taste. For Java applications, changing the theme also sets colors for pre-defined
java.awt.SystemColor objects that indicate the color of buttons, text, and more. In principal, applications may use these colors to customize their user interfaces to match the current theme. In practice, there are quite a few problems with doing this.
This article begins a series that discusses Java's
SystemColors and their use and problems on different OSes. Series articles also provide color swatches, RGB/HSV values, and downloadable color lists for
SystemColors for each of the standard themes on the Mac, Windows, and Linux. The color swatches provide a resource for comparing theme colors and creating custom Java components that match the themes.