TAILIEUCHUNG - Java Programming for absolute beginner- P13
Java Programming for absolute beginner- P13:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | 2 25 03 8 52 AM Page 198 Java Programming for the Absolute Beginner 9 13. setFont new Font Courier 16 List l4 new List 14. add Not Enabled Nope 1 false Make the Frame and add the Lists to it ComponentTestFrame frame new ComponentTestFrame List Test ll l2 l3 l4 true public static void main String args ListTest lt new ListTest figure The List component allows the users to choose only one or more than one item depending on how you set it up. The Checkbox Component Checkbox is a fairly simple component that defines one item that can be either checked or unchecked true or false . It has a text label used to identify it. The Checkbox class has constructors that allow you to specify its label its state true or false and the CheckboxGroup it belongs to. Table shows some of the Checkbox class s methods. The CheckboxTest application creates some Checkbox objects. Figure shows the output. You can select or deselect any one of these objects except for the two disabled ones Garlic and Sugar . Note that you can also select more than one of them simultaneously. Each time the user clicks a Checkbox its state reverses from true to false or from false to true. team Line - live informative Non-cost and Genuine Please purchase PDF Split-Merge on to remove this watermark. 2 25 03 8 52 AM Page 199 199 Table Checkbox Methods Method Description Checkbox Constructs a new Checkbox object. Checkbox String Constructs a new Checkbox object with the given String label. Checkbox String boolean Constructs a new Checkbox with the given String label and the given state true if it is initially checked or false if it is not . Checkbox String boolean CheckboxGroup Constructs a new Checkbox with the given String label and the given state true if it is initially .
đang nạp các trang xem trước