Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend


SwingX provides many useful components to enhance your Swing-based GUIs. This article explored the date picker, month view, hyperlink, and Tip of the Day dialog box components. Although limited space prevented coverage of SwingX features and additional components, I briefly present one useful feature and two more components below:

  • Automatic completion. SwingX provides an automatic completion feature in which SwingX supplies remaining characters as you enter characters in a combo box editor or a text component. Enable this feature for these components by calling javax.jdesktop.swingx.autocomplete.Configurator’s public static void enableAutoCompletion(JComboBox comboBox) and other methods. The output of the MoreSwingX1 application in Figure 6 (included in this article’s code) shows automatic completion.
    Figure 6

    Figure 6 Automatic completion is available for combo boxes and other components.

  • Table row sorting, filtering, and highlighting. SwingX provides a javax.swingx.JXTable class that extends javax.swing.JTable. This class provides several new capabilities, including the capabilities for sorting, filtering, and highlighting rows. The MoreSwingX2 application that I’ve included in this article’s code provides an example of row highlighting—check out Figure 7 to see the results of the alternate row highlighter.
    Figure 7

    Figure 7 JXTable makes it possible to highlight a table’s rows.

  • Translucent panels. SwingX provides a JXPanel class that extends JPanel. This class provides the capability for setting an alpha value. This value determines the extended panel’s level of translucency, from completely transparent to completely opaque. The output from the MoreSwingX3 application in Figure 8 (included in this article’s code) shows how a translucent panel improves the contrast between text and an underlying image.
    Figure 8

    Figure 8 JXPanel supports translucent panels.

That’s it for my SwingX coverage. If you’re new to this tool, I recommend that you dig into its documentation to learn more. By the way, if you plan to distribute SwingX with your code, keep in mind that SwingX is licensed under the GNU Lesser General Public License.

  • + Share This
  • 🔖 Save To Your Account