JAVA homework. _____ provides the basic attributes and behaviors of a window\'s
ID: 3829524 • Letter: J
Question
JAVA homework.
_____ provides the basic attributes and behaviors of a window's title bar: a title bar at the top of the window, and buttons to minimize, maximize and close the window.
Select one:
JLabel.
JSwing.
JFrame.
JWindowControl.
Question 2
A JLabel can be attached to a JPanel (or JFrame) using method ________.
Select one:
append
add
attach
contain
Question 3
Which methods retrieve and set the image that's displayed in a JLabel?
Select one:
getResource, setResource.
getText, setText.
getImageIcon, setImageIcon.
getIcon, setIcon.
Question 4
Which JFrame constant indicates that the program should terminate when the window is closed by the user?
Select one:
TERMINATE_ON_CLOSE.
IMMEDIATELY_CLOSE.
EXIT_ON_CLOSE.
All of the above.
Question 5
Question text
Forgetting to register an event-listener object for a particular GUI component causes .
Select one:
events generated only by that component to be ignored.
all of the GUI component's events to be ignored.
a compilation error.
None of the above.
Question 6
The GUI event with which the user interacts is the _____.
Select one:
event source.
event effector.
event raiser.
event container.
Question 7
Which of the following statements for a JTextField are true? Select all that apply.
Select one or more:
Enables users to enter data from the keyboard.
Can display a multi-line list.
Can be used to display uneditable text.
Can be used to display editable text.
Question 8
Which of the following statements makes the text in a JTextField uneditable?
Select one:
textField.setUneditable(true);
textField.setUneditable(false);
textField.setEditable(false);
textField.setEditable(true);
Explanation / Answer
Question1:
Ans : JFrame
Explanation : JFrame class has some contants (ex : JFrame.EXIT_ON_CLOSE) and some funtions to controll the functionality of title bara and close and minimize buttons
Question2:
Ans : add
Explanation : JPanel.add() method is used to add the any components to the panel.
Question3:
Ans : getIcon, setIcon.
JLabel.setIcon() and JLabel.getIcon() can be used to set and get the icons for JLabel
Question4:
Ans : EXIT_ON_CLOSE
Explanation : frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
after using the above line .. clicking on "close" button exits the applications
Question5:
Ans : events generated only by that component to be ignored.
Explanation : Every component will be registered with diffrent event listener...so event from only that commponent will be ignored
Question6:
Ans : event source.
Explanation : In java every event occurs on ource Object. It consists of all the information about the occurred event
Question7:
Ans (i) :Enables users to enter data from the keyboard.
(ii) Can be used to display uneditable text.
(iii) Can be used to display editable text.
Question8:
Ans : textField.setEditable(false);
Explanation: setEditable(false) will make the text field uneditable
setEditable(true) will make them editable.
textField.setUneditable(true) and textField.setUneditable(false) are NOT valid functions
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.