Beginning Java with NetBeans: Chapter 22 How to develop a GUI with Swing (part 2
ID: 3716140 • Letter: B
Question
Beginning Java with NetBeans: Chapter 22
How to develop a GUI with Swing (part 2)
MULTIPLE CHOICE
[Answers are in tables – delete all but the correct answer’s cell]
What field of a GridBagConstraints object specifies the amount of external padding for a component?
a.
ipad
b.
xpad
c.
anchor
d.
insets
What does the following code do?
Dimension dim = new Dimension(100, 20);
addressField.setPreferredSize(dim);
addressField.setMinimumSize(dim);
a.
It sets the external padding for the component named address.
b.
It sets the internal padding for the component named address.
c.
It prevents the component named address from collapsing to a size of zero.
d.
It prevents the user from resizing the window that contains the component named address field.
In Swing, what class do you inherit to create a custom dialog?
a.
Dialog
c.
JCustomDialog
b.
JDialog
d.
JOptionPane
What method can a custom dialog call to get a reference to its parent component?
a.
getParent()
c.
getOwner()
b.
getWindow()
d.
getFrame()
What class can you use to allow the GUI to remain responsive while a long-running task runs and to be able to update the GUI when that task finishes?
a.
Thread
c.
EventDispatch
b.
SwingWorker
d.
GUIHelper
a.
ipad
b.
xpad
c.
anchor
d.
insets
Explanation / Answer
1)
Option C
Gridbag object constraints specifies the Possible value for the anchor component.
2)
Option B
It sets the internal padding for the component named address.
3)
Option B
JDialog class want to inherit to create a custom dialog
4)
Option A
Every JComponent supports the Method getParent(). As method says, it returns you a reference to the parent of this component
5)
Option B
Even thread will not respond well we have long processes SwingWorker will improve the responsivity of the gui
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.