Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We now present a ColorChooser application to demonstrate the GroupLayout layout manager. The application consists of three JSlider objects, each representing the values from 0 to 255 for specifying the red, green and blue values of a color. The selected values for each JSlider will be used to display a filled rectangle of the specified color. We build the application using NetBeans. For an more detailed introduction to developing GUI applications in the NetBeans IDE, see www.netbeans.org/kb/trails/matisse.html.
Begin by opening a new NetBeans project. Select File > New Project.... In the New Project dialog, choose Java from the Categories list and Java Application from the Projects list then click Next >. Specify ColorChooser as the project name and uncheck the Create Main Class checkbox. You can also specify the location of your project in the Project Location field. Click Finish to create the project.