Java tip: How to use SystemColors to access OS user interface theme colors
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...
View ArticleJava tip: How to read files quickly
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...
View ArticleJava tip: How to parse integers quickly
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...
View ArticleJava tip: How to list and find threads and thread groups
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...
View ArticleJava tip: How to get CPU, system, and user time for benchmarking
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...
View ArticleJava tip: How to get a web page
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...
View ArticleJava tip: How to add zebra background stripes to a JTree
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...
View ArticleJava tip: How to add zebra background stripes to a JTable
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...
View ArticleJava tip: How to add zebra background stripes to a JList
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...
View ArticleAll UI defaults names for common Java look and feels on Windows, Mac OS X,...
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...
View Article