Sunteți pe pagina 1din 26

Quiz

January 7, 2020
True or False

1. Every GUI program


requires a window.
True or False

2. Various components are


added to the content pane
of the window and not
to the window itself.
True or False

3. JFrame is a class and the


GUI component window
can be created as an
instance of JFrame.
True or False

4. JLabel is used to label


other GUI components and
to display information
True or False

5. A JTextField can be used


for both input and output.
True or False

6. A JButton generates an
event.
True or False
7. An event handler is a Java
method that determines the
action to be performed as the
event happens.
True or False
8. When you click a button,
an action listener is created
and sent to another
object known as an action
event
True or False

9. In Java, extend is a
reserved word.
True or False

10. We use
showMessageDialog to
create an input dialog box.
Write necessary statements of the
following:
11. Import the appropriate
package for class JButton.
Write necessary statements to create the
following GUI components:
12. Create the class
FirstProgram by extending
the class JFrame.
Write necessary statements to create the
following GUI components:
13. Declare the content
pane.
Write necessary statements to create the
following GUI components:
14. Set the layout of pane
to a flow layout where
components are center-
aligned.
Write necessary statements to create the
following GUI components:
15. Set the text of
jtfPayment to empty string
or null string.
Write necessary statements to create the
following GUI components:
16. A window with the title
“Happy New Year!!!"
Write necessary statements to create the
following GUI components:
17. Set the font color of
jbtOkay to magenta.
Write necessary statements to create the
following GUI components:
18. Set the background
color of jlFirstName to
YELLOW.
Write necessary statements to create the
following GUI components:
19. Set the location of the
window at the center of
the screen.
Write necessary statements to create the
following GUI components:
20. A JCheckBox
jcbManager with the
textString “Manager” and
is selected by default.
Write necessary statements to create the
following GUI components:
21. A JTextField jtfAddress
that can display 50
characters.
Write necessary statements to create the
following GUI components:
22. A window with a height
of 300 pixels and a width of
200 pixels.
Write necessary statements to create the
following GUI components:
23. A JLabel jlGrandTotal
with the text string “Grand
Total “ and is center-
aligned.
Write necessary statements to create the
following GUI components:
24. Set the mnemonic of
the button jbtClear to ‘C’;
Write necessary statements to create the
following GUI components:
25. Declare and instantiate
a button group object
named btgCategory.

S-ar putea să vă placă și