Get Java Foundations Introduction to Program Design and Data Structures 4th Edition Lewis Test Bank free all chapters
Get Java Foundations Introduction to Program Design and Data Structures 4th Edition Lewis Test Bank free all chapters
com
https://testbankfan.com/product/java-foundations-
introduction-to-program-design-and-data-structures-4th-
edition-lewis-test-bank/
OR CLICK HERE
DOWLOAD NOW
https://testbankfan.com/product/java-software-solutions-foundations-
of-program-design-7th-edition-lewis-test-bank/
testbankfan.com
https://testbankfan.com/product/java-software-solutions-foundations-
of-program-design-7th-edition-lewis-solutions-manual/
testbankfan.com
https://testbankfan.com/product/c-programming-program-design-
including-data-structures-6th-edition-malik-test-bank/
testbankfan.com
https://testbankfan.com/product/brunner-and-suddarths-textbook-of-
medical-surgical-nursing-12th-edition-smeltzer-test-bank/
testbankfan.com
Nonverbal Communication in Human Interaction 8th Edition
Knapp Test Bank
https://testbankfan.com/product/nonverbal-communication-in-human-
interaction-8th-edition-knapp-test-bank/
testbankfan.com
https://testbankfan.com/product/essentials-of-financial-
management-3rd-edition-brigham-test-bank/
testbankfan.com
https://testbankfan.com/product/using-mis-6th-edition-kroenke-
solutions-manual/
testbankfan.com
https://testbankfan.com/product/innovation-and-entrepreneurship-3rd-
edition-bessant-test-bank/
testbankfan.com
https://testbankfan.com/product/fundamentals-of-advanced-
accounting-5th-edition-hoyle-test-bank/
testbankfan.com
Governing States and Localities 6th Edition Smith
Solutions Manual
https://testbankfan.com/product/governing-states-and-localities-6th-
edition-smith-solutions-manual/
testbankfan.com
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
1) The default layout manager used by the JPanel class is the _______________________ layout.
a) flow
b) border
c) box
d) grid
e) gridBag
Answer: a
Explanation: The flow layout is the default layout manager used by JPanel objects.
2) A(n) ___________________ is an object that defines a screen element used to display information or allow the user to
interact with a program in a certain way.
a) GUI
b) component
c) event
d) listener
e) AWT
Answer: b
Explanation: A component is an object that defines a screen element used to display information or allow the user to
interact with a program in a certain way. A GUI is a graphical user interface. An event is an object that represents some
occurrence in which we may be interested. A listener is an object that waits for an event to occur and responds in some way
when it does. AWT stands for the Abstract Windowing Toolkit, which is a package that contains classes related to Java GUIs.
3) A(n) ____________________ is an object that waits for an event to occur and responds in some way when it does.
a) GUI
b) component
c) listener
d) frame
e) panel
Answer: c
Explanation: A listener is an object that waits for an event to occur and responds in some way when it does. A
component is an object that defines a screen element used to display information or allow the user to interact with a program in a
certain way. A GUI is a graphical user interface. A frame is a container that is used to display GUI-based Java applications. A
panel is also a container, but unlike a frame it cannot be displayed on its own.
1
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
4) A GUI is being designed that will detect and respond to a mouse event. How many methods must appear in the listener
object for the event?
a) 1
b) 2
c) 3
d) 4
e) 5
Answer: e
Explanation: A listener for a mouse event implements the MouseListener interface. The MouseListener
interface contains specifications for five methods to respond to different types of mouse events that can be detected. Each of
these methods must appear in the listener and have a body. If a method is not needed, its body can be an empty set of { }.
5) A container is governed by a(n) __________________, which determines exactly how the components added to the panel
will be displayed.
a) event
b) content pane
c) JFrame object
d) JPanel object
e) layout manager
Answer: e
Explanation: The layout manager determines exactly how the components added to the panel will be displayed. A
content pane's frame is where all visible elements of a Java interface are displayed. The JFrame and JPanel objects are part of
the AWT package. An event is an object that represents some occurrence in which we may be interested.
6) Which of the following components allows the user to enter typed input from the keyboard.
a) check boxes
b) radio buttons
c) sliders
d) combo boxes
e) none of the above
Answer: e
Explanation: None of the listed components allow typed input. A text field allows typed input from the user.
7) Which of the following components allows the user to select one of several options from a "drop down" menu?
a) check boxes
b) radio buttons
c) sliders
d) combo boxes
e) none of the above
Answer: d
Explanation: Combo boxes allow the user to select one of several options from a "drop down" menu.
2
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
8) Which of the following layout managers organize the components from left to right, starting new rows as necessary?
a) Border Layout
b) Box Layout
c) Card Layout
d) Flow Layout
e) Grid Layout
Answer: d
Explanation: The flow layout organizes components from left to right, starting new rows as necessary. A border
layout organizes components into five areas: north, south, east, west, and center. The box layout organizes components into a
single row or column. The card layout organizes components into one area such that only one is visible at any time. A grid
layout organizes components into a grid of rows and columns.
9) Which of the following event descriptions best describes the mouse entered event?
Answer: c
Explanation: The mouse entered event is triggered when the mouse pointer is moved onto a component. Choice a best
describes a mouse pressed event. Choice b best describes a mouse clicked event. Choice d best describes a mouse released event.
Choice e best describes a mouse dragged event.
10) A(n) _______________________ is a graphical window that pops up on top of any currently active window so that the
user can interact with it.
a) component
b) dialog box
c) event
d) listener
e) none of the above
Answer: b
Explanation: The sentence describes a dialog box. Events and listeners are not windows. Components are graphical
elements that appear in windows, but they are not windows.
Answer: e
Explanation: All of the choices are fundamental ideas of good GUI design.
3
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
a) it starts when a GUI component is first initialized, and ends when it is destroyed
b) it generates action events at regular intervals
c) every object has a timer, and it is implicitly activated in the constructor of the object
d) it determines the amount of time it takes to execute a method
e) a timer cannot be considered a GUI component
Answer: b
Explanation: Choice b is the best description of a timer component. None of the other choices are true statements.
13) Which of the following border styles can make a component appear raised or lowered from the rest of the components?
a) line border
b) etched border
c) bevel border
d) titled border
e) matte border
Answer: c
Explanation: A bevel border can be used to add depth to a component and give it a 3-D appearance.
14) Which of the following represents a dialog box that allows the user to select a file from a disk or other storage medium?
a) color chooser
b) disk chooser
c) tool tip chooser
d) file chooser
e) none of the above
Answer: d
Explanation: A file chooser is a dialog box that allows the user to select a file. A color chooser allows the user to select
a color. There are no dialog boxes in the AWT that represent a tool tip chooser or a disk chooser.
15) Which of the following classes play a role in altering a visual aspect of a component?
a) ColorChooser
b) ToolTip
c) BorderFactory
d) ColorCreator
e) none of the above
Answer: c
Explanation: The BorderFactory class can be used to create borders, and when used with the setBorder()
method, the borders of components can be changed. The other options are not classes that are included with the AWT.
4
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
True/False Questions:
1) A panel is displayed as a separate window, but a frame can only be displayed as part of another container.
Answer: False
Explanation: A frame is displayed as a separate window, but a panel can only be displayed as part of another container.
4) A dialog box allows the user to select one of several options from a "drop down" menu.
Answer: False
Explanation: A combo box allows the user to select one of several options from a "drop down" menu. A dialog box is
a pop-up window that allows for user interaction.
5) The grid layout organizes components into a grid of rows and columns, and also allows components to span more than one
cell.
Answer: False
Explanation: Both the grid and the GridBag layouts organized components into a grid of rows and columns. Only a
GridBag layout allows components to span more than one cell.
9) When designing a GUI, the ability of the user is not an important consideration. A GUI should be designed with the lowest
common denominator in mind.
Answer: False
Explanation: It is important to design GUIs that are flexible and that support both skilled and unskilled users.
10) A mnemonic is a short line of text that will appear when the cursor is rested momentarily on top of the component.
Answer: False
Explanation: A mnemonic is a character that allows the user to push a button or make a menu choice using the
keyboard in addition to the mouse. A tool-top is a short line of text that will appear when the cursor is rested momentarily on
top of the component.
5
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
Answer: A check box sets a boolean condition to true or false. Therefore if there are multiple items listed with check
boxes by each, any or all of them can be checked at the same time. A radio button represents a set of mutually exclusive
options. This means that at any given time, only one option can be selected.
Answer: A combo box is a component that allows the user to select one of several options from a "drop down" menu.
A dialog box is a graphical window that pops up on top of any currently active windows so that the user can interact with it.
Answer: A confirm dialog box presents the user with a simple yes-or-no question. A file chooser is a dialog box that
presents the user with a file navigator that can be used to select a file. A color chooser is a dialog box that allows the user to
select an RGB color.
4) What method in what interface is used in a GUI application to detect that a user typed the letter 'Y'?
Answer: The keyPressed() method in the KeyListener interface can be used to determine which key was
typed.
5) 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.println method. If the user presses the down arrow, the method should output "You
pressed down" using the System.out.println method.
Answer:
Answer: A component should be disabled whenever it is inappropriate for the user to interact with it. This minimizes
error handling and special cases.
6
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
7) Write a segment of code that will use a dialog box to ask a user to enter their age. Their age will then be stored in an int
variable named userAge. Assume that the necessary import statements to support the dialog box are already in place.
Answer:
int userAge;
String ageStr; // used for user's response
ageStr = JOptionPane.showInputDialog("How old are you"?);
userAge = Integer.parseInt(ageStr);
8) Write a short class that represents a panel with a single radio button that has the option "Yes" and the option "No." By
default, the Yes button should be checked.
Answer:
import javax.swing.*;
import java.awt.*;
public RadioPanel() {
yes = new JRadioButton("Yes", true);
no = new JradioButton("No");
add(yes);
add(no);
} // end constructor
9) Suppose we have created a class called MyGUI, which represents a GUI. Write a program that creates a JFrame object,
adds a MyGUI object to the frame and makes it visible.
Answer:
import javax.swing.*;
frame.getContentPane().add(new MyGUI());
frame.pack();
frame.setVisible(true);
} // end main
} // end class MyGUIDisplayer
7
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
10) Write a short class that represents a panel with a single slider that has values from 0 to 250, with large tick marks in
increments of 50 and small tick marks in increments of 10.
Answer:
import javax.swing.*;
import java.awt.*;
public SlidePanel() {
slide = new Jslider(JSlider.HORIZONTAL, 0, 255, 0);
slide.setMajorTickSpacing(50);
slide.setMinorTickSpacing(10);
slide.setPaintTicks(true);
slide.setPaintLabels(true);
add(slide);
} // end constructor
} // end class SlidePanel
Answer: Border layout is divided into five areas: North, South, East, West and Center. The North and South areas are
at the top and bottom of the container, respectively, and span the entire width of the container. Sandwiched between them,
from left to right, are the West, Center, and East areas. Any unused area takes up no space, and the others fill in as needed.
12) One of the fundamental ideas of good GUI design is to "know the user". How does "know the user" influence a GUI
design?
Answer: The software has to meet the user's needs. This means not only that it has to do what it is designed to do, but
it also must be software that the user understands how to use. It needs to have an interface that the user is comfortable with in
order to be usable and useful to the user. A person who designs a GUI without an awareness of the user's preferences or skills
is less likely to please the user than someone who takes these into consideration.
Answer: A mnemonic is a character that allows the user to push a button or make a menu choice using the keyboard in
addition to the mouse. A tool-top is a short line of text that will appear when the cursor is rested momentarily on top of the
component. The difference is that the mnemonic allows for more flexibility on the users end (it allows for multiple methods of
achieving the same task), which a tool-tip is simply a helpful reminder of the role of a particular component and offers no
flexibility on the users end.
8
Pearson © 2017
Java Foundations: Introduction to Program Design & Data Structures, 4/e
John Lewis, Peter DePasquale, Joseph Chase
Test Bank: Chapter 6
14) Describe the difference between a heavyweight container and a lightweight container. Give an example of each.
Answer: A heavyweight container is a container that is managed by the underlying operating system on which the
program is run, whereas a lightweight container is managed by the Java program itself. A frame is an example of a heavyweight
container and a panel is a lightweight container.
15) When using a box layout, how is the orientation – horizontal or vertical box – specified?
9
Pearson © 2017
Other documents randomly have
different content
The Project Gutenberg eBook of The Works of
John Dryden, now first collected in Eighteen
Volumes, Volume 11
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Language: English
WORKS
OF
JOHN DRYDEN,
NOW FIRST COLLECTED
IN EIGHTEEN VOLUMES.
ILLUSTRATED
WITH NOTES,
AND
A LIFE OF THE AUTHOR,
BY
VOL. XI.
LONDON:
PRINTED FOR WILLIAM MILLER, ALBEMARLE STREET,
BY JAMES BALLANTYNE AND CO. EDINBURGH.
1808.
CONTENTS
OF
VOLUME ELEVENTH.
PAGE.
Epistles.
Epistle I. To John Hoddeson, 3
II. To Sir Robert Howard, 5
III.To Dr Charleton, 12
IV. To the Lady Castlemain, 18
V. To Mr Lee, 22
VI. To the Earl of Roscommon, 26
VII. To the Duchess of York, 31
VIII. To Mr J. Northleigh, 35
IX. To Sir George Etherege, 38
X. To Mr Southerne, 47
XI. To Henry Higden, Esq. 52
XII. To Mr Congreve, 57
XIII. To Mr Granville, 63
XIV. To Mr Motteux, 67
XV. To Mr John Driden, 71
XVI. To Sir Godfrey Kneller, 84
Elegies and Epitaphs.
Upon the Death of Lord Hastings, 94
To the Memory of Mr Oldham, 99
To the pious Memory of Mrs Anne Killigrew, 105
Upon the Death of the Viscount of Dundee, 115
Eleonora, a panegyrical Poem, to the Memory of
the Countess of Abingdon, 117
Dedication to the Earl of Abingdon, 121
On the Death of Amyntas, 139
On the Death of a very young Gentleman, 142
Upon young Mr Rogers of Gloucestershire, 144
On the Death of Mr Purcell, 145
Epitaph on the Lady Whitmore, 150
Mrs Margaret Paston, 151
the Monument of the Marquis of Winchester, 152
Sir Palmer Fairbones' tomb in Westminster Abbey 155
The Monument of a fair Maiden Lady, 158
Inscription under Milton's Picture, 160
Odes, Songs, and Lyrical Pieces.
The Fair Stranger, 163
A Song for St Cecilia's Day, 165
The Tears of Amynta, 171
A Song, 173
The Lady's Song, 175
A Song, 176
A Song, 177
Rondelay, 178
A Song, 180
A Song to a fair young Lady, 181
Alexander's Feast, or the power of Music, an Ode, 183
Veni Creator Spiritus, paraphrased, 190
Fables.—Tales from Chaucer.
Dedication to the Duke of Ormond, 195
Preface prefixed to the Fables, 205
Palamon and Arcite; or the Knight's Tale, 241
Dedication to the Duchess of Ormond, 245
The Cock and the Fox; or the Tale of the Nun's Priest, 327
The Flower and the Leaf; or the Lady in the Arbour, 356
The Wife of Bath, her Tale, 377
The Character of a good Parson, 395
Fables.—Translations from Boccace.
Sigismonda and Guiscardo, 403
Theodore and Honoria, 433
Cymon and Iphigenia, 452
EPISTLES.
EPISTLE THE FIRST,
TO HIS FRIEND
JOHN HODDESDON,
ON HIS
DIVINE EPIGRAMS.
EXCELLENT POEMS.
This epistle was prefixed to Sir Robert Howard's poems, printed for
Herringman, 12mo, 1660, and entered in the Stationers' books on
16th April that year. It was probably written about the
commencement of Dryden's intimacy with the author, whose sister
he afterwards married. Sir Robert Howard, son to the Earl of
Berkshire, a man of quality, a wit, and a cavalier, was able to extend
effectual patronage to a rising author; and so willing to do it, that he
is even said to have received Dryden into his own house. These
lines, therefore, make part of Dryden's grateful acknowledgments, of
which more may be found in the prefatory letter to the "Annus
Mirabilis," addressed to Sir Robert Howard.[1] The friendship of the
brother poets was afterwards suspended for some time, in
consequence of Sir Robert's strictures on the "Essay on Dramatic
Poetry," and Dryden's contemptuous refutation of his criticism. But
there is reason to believe, that this interval of coldness was of short
duration; and that, if the warmth of their original intimacy was never
renewed, they resumed the usual kindly intercourse of relations and
friends.
The epistle itself is earlier in date than the poem called "Astrea
Redux," which was probably not published till the summer of 1660
was somewhat advanced. This copy of verses, therefore, is the first
avowed production of our author after the Restoration, and may
rank, in place and merit, with "Astrea Redux," the "Poem on the
Coronation," and the "Address to the Chancellor." There is the same
anxiety to turn and point every sentence, and the same tendency to
extravagant and unnatural conceit. Yet it is sometimes difficult to
avoid admiring the strength of the author's mind, even when
employed in wresting ideas the wrong way. It is remarkable, also,
that Dryden ventures to praise the verses of his patron, on account
of that absence of extravagant metaphor, and that sobriety of poetic
composition, for which, to judge by his own immediate practice, he
ought rather to have censured them.
Those who may be induced to peruse the works of Sir Robert
Howard, by the high commendation here bestowed upon them, will
have more reason to praise the gratitude of our author, than the
justice of his panegyric. They are productions of a most freezing
mediocrity.
EPISTLE THE SECOND.
As there is music uninformed by art
In those wild notes, which, with a merry heart,
The birds in unfrequented shades express,
Who, better taught at home, yet please us less;
So in your verse a native sweetness dwells,
Which shames composure,[2] and its art excells.
Singing no more can your soft numbers grace,
Than paint adds charms unto a beauteous face.[3]
Yet as when mighty rivers gently creep,
Their even calmness does suppose them deep,
Such is your muse: no metaphor swelled high
With dangerous boldness lifts her to the sky:
Those mounting fancies, when they fall again,
Show sand and dirt at bottom do remain.
So firm a strength, and yet withal so sweet,
Did never but in Sampson's riddle meet.
'Tis strange each line so great a weight should bear,
And yet no sign of toil, no sweat appear.
Either your art hides art, as stoics feign
Then least to feel, when most they suffer pain;
And we, dull souls, admire, but cannot see
What hidden springs within the engine be:
Or 'tis some happiness, that still pursues
Each act and motion of your graceful muse.
Or is it fortune's work, that in your head
The curious net that is for fancies spread,[4]
Lets through its meshes every meaner thought,
While rich ideas there are only caught?
Sure that's not all; this is a piece too fair
To be the child of chance, and not of care.
No atoms, casually together hurled,
Could e'er produce so beautiful a world;
Nor dare I such a doctrine here admit,
As would destroy the providence of wit.
'Tis your strong genius then which does not feel
Tis your strong genius, then, which does not feel
Those weights, would make a weaker spirit reel.
To carry weight, and run so lightly too,
Is what alone your Pegasus can do.
Great Hercules himself could ne'er do more,
Than not to feel those heavens and gods he bore.
Your easier odes, which for delight were penned,
Yet our instruction make their second end;
We're both enriched and pleased, like them that woo
At once a beauty, and a fortune too.
Of moral knowledge poesy was queen,
And still she might, had wanton wits not been;
Who, like ill guardians, lived themselves at large,
And, not content with that, debauched their charge.
Like some brave captain, your successful pen
Restores the exiled to her crown again;
And gives us hope, that having seen the days
When nothing flourished but fanatic bays,
All will at length in this opinion rest,—
"A sober prince's government is best."
This is not all; your art the way has found
To make improvement of the richest ground;
That soil which those immortal laurels bore,
That once the sacred Maro's temples wore.[5]
Eliza's griefs are so expressed by you,
They are too eloquent to have been true.
Had she so spoke, Æneas had obeyed
What Dido, rather than what Jove, had said.
If funeral rites can give a ghost repose,
Your muse so justly has discharged those,
Eliza's shade may now its wandering cease,
And claim a title to the fields of peace.
But if Æneas be obliged, no less
Your kindness great Achilles doth confess;
Who, dressed by Statius in too bold a look,
Did ill become those virgin robes he took.[6]
d dh h
To understand how much we owe to you,
We must your numbers, with your author's, view:
Then we shall see his work was lamely rough,
Each figure stiff, as if designed in buff;
His colours laid so thick on every place,
As only showed the paint, but hid the face.
But, as in perspective, we beauties see,
Which in the glass, not in the picture, be;
So here our sight obligingly mistakes
That wealth, which his your bounty only makes.
Thus vulgar dishes are, by cooks, disguised,
More for their dressing than their substance prized.
Your curious notes[7] so search into that age,
When all was fable but the sacred page,
That, since in that dark night we needs must stray,
We are at least misled in pleasant way.
But, what we most admire, your verse no less
The prophet than the poet doth confess.
Ere our weak eyes discerned the doubtful streak
Of light, you saw great Charles his morning break:[8]
So skilful seamen ken the land from far,
Which shows like mists to the dull passenger.
To Charles your muse first pays her duteous love,
As still the ancients did begin from Jove;
With Monk you end,[9] whose name preserved shall be,
As Rome recorded Rufus' memory;
Who thought it greater honour to obey
His country's interest, than the world to sway.[10]
But to write worthy things of worthy men,
Is the peculiar talent of your pen;
Yet let me take your mantle up, and I
Will venture, in your right, to prophecy:—
"This work, by merit first of fame secure,
Is likewise happy in its geniture;[11]
For since 'tis born when Charles ascends the throne,
h h f d "
It shares at once his fortune and its own."