Page 755 - Introduction to Programming with Java: A Problem Solving Approach
P. 755

                Figure 17.11 The code that created figure 17.10’s display
Figure 17.12 Modified background color for license-agreement JTextArea component
17.12 JcheckBox Component User Interface
Look at the check box component at the bottom of Figure 17.12. Use a check box component if you want to present an option. A check box component displays a small square with a label to its right. When the square is blank, the check box is unselected. When the square contains a check mark, the check box is selected. Us- ers click on the check box in order to toggle between selected and unselected.
17.12 JcheckBox Component 721
 private void createContents()
{
}
JTextArea license;
JCheckBox confirmBox;
setLayout(new BorderLayout());
license = new JTextArea(
"SOFTWARE END-USER LICENSE AGREEMENT\n\n" +
"READ CAREFULLY: This Software End-User License Agreement" +
" is a legal agreement between us, the software provider," +
" and you, the end user of a software product legitimately" +
" purchased from us. You must accept this agreement to" +
" complete the sale of the software license. If you do not" +
" accept this agreement, you forfeit all rights to your" +
" current and future property and progeny.");
license.setEditable(false);
license.setLineWrap(true);
license.setWrapStyleWord(true);
confirmBox = new JCheckBox(
"I accept the terms of this agreement.", true);
add(license, BorderLayout.CENTER);
add(confirmBox, BorderLayout.SOUTH);
// end createContents
       Apago PDF Enhancer
  





































































   753   754   755   756   757