1 Explain the difference between check boxes and radio butto
1. Explain the difference between check boxes and radio buttons.
2. Explain the difference between a combo boxand a dialog box.
3. Give an example ofa common use ofa dialog box.
4. Write a shortsnippetofcodethatcreates a J Panel objectcalled p1, and creates a border around it containing the title \"this is a JPanel.\"
Write a keyPressed method that behaves as follows. If the user presses the up arrow, the method should output \"You pressed up\"using the System.out.printin method. Ifthe user presses the down arrow, the method should output \"You pressed down\" using the System.out.printin method.
6. Should a component ever be disabled? Why orwhy not?
7. Write a program that produces a simple GUI that has a single button labeled \"Push Me.\"
8. Write a short class that represents a panelwith a single radio button that has the option \"Yes\"and the option \"No.\" Bydefault, the Yes buttonshould be checked.
9. Suppose we have created a class called MyGUI, which represents a GUI. Write a programthat creates a JFrame object, adds a MyGUI object to the frame and makes it visible.
10. Write a short class that represents a panelwith a single sliderthat has values from 0 to 250, with largetick marks in incrementsof 50 and smalltick marks in increments of 10.
Solution
1.The difference between check boxes and radio buttons :-
* When Radio Buttons are grouped they allow us to select one Radio Button at a time.
* When Check Boxes are grouped they allow us to select multiple Check Boxes at a time.
Explanation :-
Do not take single Radio Button. Because once Radio Button is selected we can not dis-select it. we always take multiple Radio Buttons together in a group.
