SlideShare a Scribd company logo
IntelliJ IDEA in Action In Action series 1st
Edition Stephen Saunders pdf download
https://ebookfinal.com/download/intellij-idea-in-action-in-
action-series-1st-edition-stephen-saunders/
Explore and download more ebooks or textbooks
at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.
WebWork in Action In Action First Edition Patrick
Lightbody
https://ebookfinal.com/download/webwork-in-action-in-action-first-
edition-patrick-lightbody/
Business Studies in Action 4th edition. Edition Stephen
John Chapman
https://ebookfinal.com/download/business-studies-in-action-4th-
edition-edition-stephen-john-chapman/
Performance Projections Film and the Body in Action 1st
Edition Stephen Barber
https://ebookfinal.com/download/performance-projections-film-and-the-
body-in-action-1st-edition-stephen-barber/
Scala in Action Nilanjan Raychaudhuri
https://ebookfinal.com/download/scala-in-action-nilanjan-raychaudhuri/
DSLs in Action Debasish Ghosh
https://ebookfinal.com/download/dsls-in-action-debasish-ghosh/
Camel in Action Claus Ibsen
https://ebookfinal.com/download/camel-in-action-claus-ibsen/
Grails in Action 1st Edition Glen Smith
https://ebookfinal.com/download/grails-in-action-1st-edition-glen-
smith/
Kafka in Action 1st Edition Dylan Scott
https://ebookfinal.com/download/kafka-in-action-1st-edition-dylan-
scott/
Netty in Action 1st Edition Norman Maurer
https://ebookfinal.com/download/netty-in-action-1st-edition-norman-
maurer/
IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders
IntelliJ IDEA in Action In Action series 1st Edition
Stephen Saunders Digital Instant Download
Author(s): Stephen Saunders, Duane K. Fields, Eugene Belayev
ISBN(s): 1932394443
Edition: 1
File Details: PDF, 12.57 MB
Year: 2006
Language: english
IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders
IntelliJ IDEA in Action
IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders
IntelliJ IDEA
in Action
DUANE K. FIELDS
STEPHEN SAUNDERS
EUGENE BELYAEV
WITH ARRON BATES
M A N N I N G
Greenwich
(74° w. long.)
For online information and ordering of this and other Manning books, please go to
www.manning.com. The publisher offers discounts on this book when ordered in quantity.
For more information, please contact:
Special Sales Department
Manning Publications Co.
209 Bruce Park Avenue Fax: (203) 661-9018
Greenwich, CT 06830 email: orders@manning.com
©2006 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted,
in any form or by means electronic, mechanical, photocopying, or otherwise, without
prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in the book, and Manning
Publications was aware of a trademark claim, the designations have been printed in initial
caps or all caps.
Recognizing the importance of preserving what has been written, it is Manning’s policy
to have the books they publish printed on acid-free paper, and we exert our best efforts
to that end.
Manning Publications Co. Copyeditor: Tiffany Taylor
209 Bruce Park Avenue Typesetter: Denis Dalinnik
Greenwich, CT 06830 Cover designer: Leslie Haimes
ISBN 1-932394-44-3
Printed in the United States of America
1 2 3 4 5 6 7 8 9 10 – VHG – 10 09 08 07 06
To my son Jake, who while too young to read this book,
will certainly enjoying coloring in it.
—D.F.
To my wife Michelle, whose support and understanding
never cease to astound me.
—S.S.
IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders
vii
1 ■ Getting started with IDEA 1
2 ■ Introducing the IDEA editor 22
3 ■ Using the IDEA editor 63
4 ■ Managing projects 107
5 ■ Building and running applications 142
6 ■ Debugging applications 185
7 ■ Testing applications with JUnit 231
8 ■ Using version control 254
9 ■ Analyzing and refactoring applications 295
10 ■ Developing Swing applications 341
11 ■ Developing J2EE applications 370
12 ■ Customizing IDEA 425
13 ■ Extending IDEA 461
Appendix ■ Getting help with IDEA 481
brief contents
IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders
ix
preface xix
acknowledgments xxi
about this book xxiii
1 Getting started with IDEA 1
1.1 Installing and running IDEA 2
Downloading the latest version 2 ■
Installing IDEA 4
Running IDEA for the first time 6
1.2 Reviewing the IDEA interface 7
The main IDEA workspace 7 ■
The main menu bar 8
The IDEA toolbar 8 ■
The source code editor 9
The tool windows 9
1.3 Implementing “Hello, World” 10
Creating a project 10 ■
Making a Java class 15
Building the project 17 ■
Running the project 17
1.4 The plot thickens 19
Welcome to ACME Incorporated 19
Starting the ACME project 19
1.5 Summary 20
contents
x CONTENTS
2 Introducing the IDEA editor 22
2.1 Exploring the IDEA interface 23
Hanging out in the gutter 24 ■ Using the marker bar 24
Using the editor tabs 25 ■ Exploring the status bar 30
Exploring the tool windows 32
2.2 Using the IDEA editor 40
Writing the first ACME classes and interfaces 40 ■ Opening files
into the editor 42 ■ Saving your work 45
Printing your file 47 ■ Navigating in the editor 48
Making text selections 50 ■ Using IDEA’s undo and redo
mechanism 52 ■ Cutting, copying, and pasting 53
Searching for and replacing text 55
2.3 Summary 61
3 Using the IDEA editor 63
3.1 What makes IDEA the intelligent editor? 64
3.2 Using code folding 64
3.3 Navigating through your Java code 66
Navigating between methods 67 ■ Navigating to a symbol’s
declaration 67 ■ Navigating to a symbol by name 69
Navigating with the structure view pop-up 70
Navigating to an overridden/implemented or overriding/
implementing method 71
3.4 Analyzing your Java code in real-time 72
How IDEA alerts you to problems in your code 73 ■ Monitoring
the status of the current document 73 ■ Navigating between
problems in the current file 74 ■ Controlling the reparse
delay 74 ■ Configuring IDEA’s warning levels 74
3.5 Getting help from the JavaDoc and API references 76
Viewing method parameters 76 ■ Viewing the JavaDoc 77
Creating JavaDoc comments 78 ■ Generating your project’s
JavaDoc reference 79
3.6 Code completion 80
Using IDEA’s code-completion features to do your work for you 80
Completing brackets, braces, parentheses, and quotation marks with
smart completion 85 ■
Commenting out code 85
Reformatting code 86 ■
Customizing IDEA’s code
completion settings 87
CONTENTS xi
3.7 Using IDEA’s code-generation tools 89
Generating constructors 89 ■ Generating accessor and mutator
methods 90 ■ Generating hashCode and equals methods 91
Overriding methods in your superclass 94 ■ Implementing
methods of an interface 94 ■ Creating delegation methods 95
Enclosing a block of code 96 ■ Customizing code
generated by IDEA 96
3.8 Programming by intention 97
What are intention actions? 97 ■ Why and when IDEA suggests
intention actions 98 ■ Using intention actions to fix errors 98
Using intention actions for code completion 98
Choosing an intention action to execute 99
Disabling intention alerts 100 ■ Exploring some common
intention actions 100
3.9 Continuing the ACME project 103
3.10 Summary 105
4 Managing projects 107
4.1 Understanding IDEA’s project strategy 108
Examining the IDEA project hierarchy 108 ■ Selecting different
types of modules 109 ■ Selecting a project structure 110
4.2 Working with projects 111
Creating a new project 111 ■ Managing project settings 113
Working with project files 118
4.3 Working with modules 119
Managing project modules 119 ■ Creating a Java module with
the module wizard 121 ■ Managing Java module settings 124
4.4 Working with libraries 128
Understanding library basics 128 ■ Adding libraries to the
project 130 ■ Migrating projects from IDEA 3.x 132
Sharing projects with others 133 ■ Using path variables 133
4.5 Using the Project tool window 135
Understanding the Project and Packages views 135
Configuring the Project window 136
4.6 Summary 141
xii CONTENTS
5 Building and running applications 142
5.1 Building a project 143
How IDEA builds your project 143 ■ Setting up a
compiler 145 ■ Building an application under IDEA 149
Reviewing the results of the build 150
5.2 Extending IDEA’s build system with Ant 151
Introducing Ant 152 ■ Improving your build process with
Ant 155 ■ Working with Ant build files 156
Executing Ant targets 160 ■ Following Ant’s progress in the
Messages window 162 ■ Controlling Ant’s behavior 165
5.3 Running your project 171
Managing Run/Debug configuration profiles 172 ■ Executing a
Run configuration 177 ■ Using the Run window console 179
5.4 Expanding the ACME project 181
Adding a library to the ACME project 181
Improving and running the ACME project 182
5.5 Summary 184
6 Debugging applications 185
6.1 Introducing the debugging process 186
Finding and fixing bugs with a debugger 186 ■ Preparing your
code for debugging 188 ■ Debugging your source code 190
6.2 Working with breakpoints 191
Managing breakpoints 192 ■ Working with line number
breakpoints 195 ■ Working with method breakpoints 196
Working with exception breakpoints 196 ■ Working with field
watchpoints 197 ■ Setting conditional breakpoints 199
Configuring breakpoint actions 201
6.3 Debugging an application 202
Executing an application under the debugger 202
Debugging an application on a remote server 205
Stepping through the program 208
Working with threads 211
6.4 Viewing runtime data in the debugger 214
Understanding the Java call stack 214 ■
Inspecting a stack
frame 216 ■
Working with watches 221
Altering your program while debugging 222
CONTENTS xiii
6.5 Configuring the debugger 223
Managing display preferences 223 ■ Limiting the scope of
debugging 224 ■ Customizing the data display view 225
Improving the speed of the debugger 227
6.6 Improving the quality of the ACME project 229
6.7 Summary 230
7 Testing applications with JUnit 231
7.1 Testing applications with JUnit 232
Understanding the JUnit philosophy 232
Exploring the JUnit API 233
7.2 Adding test cases to your project 236
Creating a test case from a file template 237
Adding the JUnit library to your Classpath 237
7.3 Running test cases in IDEA 238
Creating a Run/Debug configuration for your test 238
Running your unit test configuration 241
7.4 Working with IDEA’s JUnit test runner 242
Exploring the JUnit tool window 243 ■ Monitoring testing
progress 245 ■ Managing the testing session 246
Analyzing test results 246
7.5 Improving the quality of the ACME project 252
7.6 Summary 253
8 Using version control 254
8.1 Configuring your project for version control 255
Understanding version control basics 255
Enabling version control support in IDEA 257
Configuring IDEA to use CVS 259
Configuring other types of version control systems 264
8.2 Working with files under CVS 267
Retrieving files from the repository 267 ■
Working with files
under CVS control 271 ■
Committing your changes 276
Working with branches and tags 279
Viewing change history 281
xiv CONTENTS
8.3 Using IDEA’s Local History 289
Understanding IDEA’s Local History 289 ■ How IDEA tracks
your changes 290 ■ Exploring your Local History 291
8.4 Summary 293
9 Analyzing and refactoring applications 295
9.1 Analyzing your code 296
Tracking down dependencies 296 ■
Exploring code with the
Structure view 298 ■
Exploring the code hierarchy 300
9.2 Locating potential problems
with the code inspector 303
Launching the inspector 304 ■ Specifying inspections to
perform 306 ■ Viewing the inspection results 308
9.3 Other advanced code analysis features 309
Using Structural Search and Replace 309 ■
Analyzing
dependencies 314 ■
Locating duplicate code 316
9.4 Improving code design through refactoring 317
Performing a refactoring 317 ■
Renaming code symbols to
improve readability 320 ■
Refactoring to improve class or
package organization 321 ■
Working with fields, variables,
and constants 325 ■
Refactoring method calls to improve
usability 328 ■
Restructuring class hierarchies 333
Migrating source code to new package or class names 338
9.5 Summary 339
10 Developing Swing applications 341
10.1 Understanding the GUI Designer 342
The GUI-building process 342
Working with the user interface 343
10.2 Working with forms 345
Creating a new form 345 ■ Placing components into
the workspace 345 ■ Setting component properties 347
Laying out a form 348
10.3 Designing an ACME GUI 351
Creating a new GUI form in IDEA 351 ■
Manually creating
the basic layout 351 ■
Applying the grid layout 352
Setting component properties 352
Touching up the final interface 352
CONTENTS xv
10.4 Understanding properties 353
Spanning rows and columns 354 ■ Setting an anchor point (cell
alignment) 354 ■ Using spacers to control layout 355
Controlling the grid spacing 356 ■ Setting container
margins 356 ■ Setting sizing policies 356
Setting fill policies 357 ■ Adding borders 357
10.5 Adding functionality to forms 357
Binding forms and their components 358 ■ Creating a
constructor 359 ■ Generating getter/setter methods for fields
bound to data 361 ■ Invoking your form 361
10.6 Adding functionality to the ACME GUI 362
Binding the ACME GUI to a form class 362 ■ Creating a
constructor 363 ■ Implementing the Convert functionality 364
Providing an entry point 365
10.7 Building and running your form 366
Generating the GUI to binary or source 367 ■
Including the
forms library 367 ■
Compiling with Ant 368
10.8 Summary 369
11 Developing J2EE applications 370
11.1 Working with web applications 371
Understanding web modules 371 ■ Creating a new web
module 372 ■ Configuring a web module 373
Using the J2EE tab of the Project tool window 377
Working with servlets and filters 379
Working with JavaServer Pages 380
Implementing an ACME web application 386
11.2 Working with EJBs 390
Working with EJB modules 391
Working with J2EE application modules 399
11.3 Understanding application server integration 402
Integrating IDEA with Tomcat 403
Integrating IDEA with WebLogic 404
Integrating IDEA with generic application servers 404
Installing Tomcat to support the ACME web application 405
xvi CONTENTS
11.4 Running and debugging web applications 406
Running your web application 408
Running the ACME web application on Tomcat 408
Debugging your web application 410
11.5 Working with web content (IDEA 5.0 and higher) 412
Supported file types and content 412 ■ Basic editor
features 415 ■ Coding assistance for web content 417
Navigating through web content files 421
Refactoring web content 422
11.6 Summary 423
12 Customizing IDEA 425
12.1 Configuring IDEA’s options and settings 426
Customizing the interface 429
12.2 Customizing your code style 430
How IDEA uses your code style 431 ■ Variable naming and
general formatting 432 ■ Controlling indentation and
braces 434 ■ Controlling whitespace 436
Customizing import statements 437 ■ Controlling line
wraps 439 ■ Adherence to a code standard—made easy 439
12.3 Customizing your color scheme 440
How IDEA uses color schemes 440 ■ Editor properties 440
Changing font settings 445
12.4 Customizing keyboard shortcuts 447
Using keyboard shortcuts 448 ■ Navigating the interface with
the keyboard 448 ■ Selecting a keymap 448
Creating a new keymap 450 ■ Defining keyboard
shortcuts 450 ■ Defining mouse shortcuts 452
Defining quick lists 452
12.5 Working with non-Java file types 453
Modifying file types settings 453 ■ Registering file
extensions 454 ■ Creating a custom file type 454
12.6 Using file templates 455
Creating a new file from a template 456
Working with template includes 459
CONTENTS xvii
12.7 Increasing the amount of memory
allocated to IDEA 459
12.8 Summary 460
13 Extending IDEA 461
13.1 Working with bookmarks 462
Placing and using numbered bookmarks 463
Placing and using anonymous bookmarks 463
Managing your bookmarks collection 464
13.2 Working with ToDo lists 465
Creating custom ToDo list items 467
Using ToDo filters 468
13.3 The IDEA Commander 468
Working with the IDEA Commander 469
File operations 471
13.4 Integrating external tools with IDEA 472
Managing the tool list 472 ■
Accessing external tools from within
IDEA 476 ■
Reacting to the results of external tools 478
13.5 Using IDEA’s open APIs 479
13.6 Summary 480
appendix Getting help with IDEA 481
index 487
IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders
xix
preface
It is often said that necessity is the mother of invention, and this was certainly
the case on the cold winter day in February 2000 when JetBrains was founded.
It had been nearly five years since the formal introduction of Java, and the
tools market was already crowded with a myriad of development environments,
all designed to provide a more convenient user interface for Java develop-
ment. Although these early IDEs made it easier for developers to create appli-
cations, they delivered little functionality to alleviate the time-consuming tasks
of coding or ensuring the consistency or excellence of design. As hard-core
developers ourselves, we felt that the market lacked a satisfying development
environment and we set out to create a tool that would assist professional
developers to build complex applications.
Originally, we focused our efforts on restructuring code. As luck, or des-
tiny, would have it, we were the first to make real progress in this area, and we
became the first company to introduce commercial support for refactoring.
The reigning IDE vendors took notice of us at this time, and soon afterward,
all the major players were attempting to implement the technologies we had
managed to bring to the industry forefront.
Later that same year, as the dot.com boom went bust and the overall quality
of development tools for developers steadily declined, we saw a lot of ways we
could improve on what others had failed to do. In January 2001, we introduced
Discovering Diverse Content Through
Random Scribd Documents
Colorado seemed only just to have begun their work. Frank watched,
fascinated, the tremendous energy of the mates, the desperate
efforts of the men, heard the ghastly chorus of profanity by which
the whole work was accompanied.
As I have said, the work on board the Sealark ceased at four o’clock,
the ship being made snug and harbour-worthy for the night; but on
board the Colorado there was not one moment’s respite from labour
until everything on board was as if she had been in harbour a month
—sails unbent and stowed away, running gear stopped up, cargo
gear prepared ready for the morning, and a host of other things,
leaving the hapless crew, when they entered the fo’c’sle at eight
o’clock, relieved at last, so weary as to be almost unable to crawl
when the relief came. I believe in work, and hard work, but a feeling
of utter disgust comes over me when I see how men are driven
under the flag of the great Republic. Nowhere in the world is the last
ounce so mercilessly extracted from poor flesh and blood as it is
there, or less concession made to human weakness or limitations.
I said that Frank was fascinated, and with reason, for he could
hardly tear himself away from the rail to his supper. But when the
second mate sauntered up to him and said, “That’s the way to get a
ship’s work done, my lad; no crawling there,” Frank looked quickly
round and said, “I see they’re smart, sir, but it isn’t necessary to
work them so long or curse them so hard. The work is not so
pressing as all that, surely.” The old black scowl came over the
second mate’s face as he muttered, “You so-and-so lime-juicers
don’t know what a man is,” and turned away.
For which sentiment I cannot help hating him and his like, while fully
appreciating their splendid seamanship. The sight not only held
Frank fascinated, as I have said, but it fired his blood; and he made
a mental vow that whatever happened he would, if ever he had the
power, treat his men as remembering that they were made of the
same material as himself.
He was drawn from the contemplation of brutality by one of the
small boys calling his attention to a sampan, or a Chinese boat,
which had stolen up alongside. It was not much bigger than a large
rowing-boat, but rising in a graceful curve at the bow, and
completely decked over except for a domed cabin aft. In this craft
there were obviously three generations—grandfather and
grandmother, father and mother, and a family of five children of
varying ages, the youngest being a toddles of about three, who
staggered about the deck with a big bladder attached to its waist by
a stout cord.
The use of this appendage bothered Frank very much, until he saw
the tiny creature stumble, and take an involuntary dive over the
unprotected side of the boat. As coolly as possible the mother, who
was standing at the big steer-oar, lifted a boat-hook from the deck,
and hooking the child by the bladder cord as it floated quite safely,
hauled it on board, and, giving it a shake, set it on deck to drain, at
the same time scolding it in what seemed a very discordant, loudly-
sung song.
Meanwhile all the other members of the family were begging with
eloquent gestures, pointing to their attenuated bodies and their
mouths alternately. Frank went and fetched some bread, and was
about to give it to them, when the mate espied him, and calling him
said, “Now remember, Frank, you must never give these people
anything; if you do, the ship will be surrounded with sampans from
morning till night, and there will not only be annoyance but danger
from them. There are 30,000 people like that living upon the waters
of this harbour, who do not know from whence their next meal will
come, and who are consequently pressed so much that they will
stick at nothing to get plunder of any kind. They must not go
ashore, and every boat is registered and numbered, as you see; so
that if a crime is committed they are easily traced, but that is like
locking the stable after the horse is gone. The only wise thing to do
is to keep them at a distance.”
And so saying he mounted the rail, and in a fierce voice with violent
gestures made the boat clear off, the head of the family looking at
mate and ship alternately with utterly expressionless face, as if
nothing in life interested him at all.
“I can’t understand,” said the mate, turning away, “why they don’t
make an organised raid some night upon a ship like this, and steal or
murder as they like. But I suppose they’ve got no power of
combining for a purpose of that sort, besides having, as a race, a
tremendous respect for the law. Hello, here comes the skipper.”
He went to the gangway to receive Captain Jenkins, who had been
ashore in the agent’s smart little launch, and was now returning with
a promising little bundle in his hand that said “Letters from home.”
In five minutes Frank was transported from all his surroundings by
the magic of the written word, was oblivious of strange sights and
sounds and smells, and actually listening to the well-remembered
tones of the dear ones at home.
There was quite an accumulation for him, for his people were wise,
and knew how eagerly prized were their letters; so they all wrote to
him once a month, and consequently, owing to their long long
passage, there were at least a dozen letters. No more getting a word
out of Frank that evening, or claiming his attention even for meals.
He was perfectly happy, for the letters breathed only love and the
calm, even flow of a prosperous life, which he could not help
mentally comparing, to its disadvantage, with the stirring times
through which he had just passed, or feeling that a special
Providence had watched over him in answer to his mother’s tender
prayers.
I am glad to say that he immediately set about writing a long letter
of reply, that is, as soon as he had mastered the contents of his
budget. It was boy-like, and glossed over many of the thrilling
incidents of the passage in curt, careless fashion; but it must always
be remembered to a young man’s credit who occupies a position like
Frank’s, that such letter-writing as he does is pursued under great
difficulties in the matter of position and light. There is no
comfortable table for him to spread his materials upon, and there
are usually many interruptions; so that, when the parents get a good
letter, they ought to bear in mind that it means much perseverance
against odds.
Next day they commenced to discharge, and this was also a
revelation to Frank. For the appliances were of the simplest—just
shallow, saucer-like baskets and spades, and a hundred or so sturdy
Chinese to handle them. A huge scow-like junk came alongside, a
tarpaulin was carefully stretched between her and the ship to catch
any falling lumps, and gangways were laid, along which, when once
the business was started, there went a never-ending procession of
naked men bearing baskets full of coal, which, as they reached the
side, they emptied over into the junk, and then returned by another
route to where they found full baskets awaiting them. The air was
full of coal-dust, the heat was melting, and the noise bewildering.
In the midst of it all stood a spectacled Chinese, a wadded teapot by
his side, from which he continually refreshed himself with tiny cups
of straw-coloured, tepid tea, as impervious apparently to the
discomfort and din of his surroundings, as if he were carved out of
wood. Overside the scene was stranger still. There were at least
twenty sampans, the occupants of which were diligently engaged in
dredging the bottom for such small fragments of coal as, in spite of
all care, would occasionally bounce overboard. And these energetic
snappers up of unconsidered trifles conducted all their operations
amid a deafening uproar of languages that sounded quite uncanny,
and made Frank wonder whether such a queer concatenation of
sounds could in any possible way serve to communicate thought. In
which he was only following a line of fancy trodden by very many
before him.
There was, however, one cry which, especially in the evenings and
early mornings, resounded over the waters of the harbour and
puzzled Frank a great deal. He had considerable difficulty in locating
its source, but did so at last. He found that it proceeded from the
solitary occupant of a small canoe-like boat that was apparently
drifting aimlessly about the bay doing nothing at all.
And then one night there suddenly broke out in the forecastle a
furious and exceedingly bloody fight, in which the good, peaceable
men who composed the crew were changed into devils incarnate,
with a mad lust to rend and tear each other to pieces. The skipper
and two mates rushed forward to quell the frightful outbreak, but
soon found that they were not dealing with sane men, but with
raving lunatics, and were bound to retire and leave them to fight it
out, since to persist in the endeavour to separate the warring fiends
was only to court destruction themselves. They waited outside,
though full of anxiety, and wondered mightily whatever could be the
meaning of it all. Drink, of course, but whence obtained, and what
kind of drink that could thus change this peaceable crew so entirely?
Neither the skipper nor second mate had ever been to China before,
and so they were inclined to believe that the bumboatman employed
to supply the crew with fresh fruit, bread, eggs, vegetables, &c. was
guilty. But Mr. Cope, who had made one visit to Hong-Kong before,
scouted the idea. He said that he had heard that the bumboatmen
were above suspicion in that direction, knowing that they would
certainly be found out, and when that happened they would forfeit
all the money due to them from the crew, for such was the law,
besides getting a long term of imprisonment. Mr. Cope, however,
could find no reasonable explanation of the source whence liquor
could have come.
Then it was that Frank bethought him of the weird cry and the
drifting canoe, and going up to the skipper he told him of what he
had seen, and suggested modestly that there might here be found
some explanation. At that very time, and just as Frank had finished
speaking, the cry was heard again, quite softly but clearly, close
under the bows. The skipper rushed forrard and nipped over the
bows, where he struck a match, held it blazing for a moment, and
then extinguished it. There was silence for a moment or two, and
then the grating of a boat against the cable below, while a soft voice
called up through the darkness, “Wanchee samshaw, Johnny?”
“Yes, yes,” hurriedly whispered the skipper, “What thing wanchee for
one bottle?”
“You no catchee dolla, my takee shirtee, Climean shirtee good one,
shabee?”
“All right, John, I catchee,” whispered the skipper, lowering the end
of the jib downhaul; “you makee fast one bottle, I bring shirtee chop
chop.”
And away he went, hurriedly explaining the situation to the two
officers, and telling them to get each as big a lump of coal as they
could handle and bring it forward to him when he had got a shirt
ready. Then the obtained shirt was exchanged for a bottle, but as
soon as the latter was safely hauled up the two masses of coal, each
weighing at least half a hundredweight, were hurled down through
the darkness on top of the purveyor of madness. There was an awful
crash and a yell, then all was silence, as the skipper said with a sigh
of relief, “I hope there is one villain less in the world.” Indeed it
seemed so, for their utmost peering through the gloom could not
descry a trace of anything, even wreckage.
The bottle was taken aft and opened. Its contents stunk of all the
foul things imaginable, while as for the taste, no description of it
would be adequate.
“And this was the stuff those unspeakable asses forward have been
poisoning themselves with after buying it at such a rate. Well, well!”
said the skipper, “the folly of sailors is surely without limit. But,
thank God, that infernal devil will never poison a poor fool of a sailor
any more.”
“Indeed I don’t know so much about that,” said Mr. Cope. “It’s
harder to kill a Chinaman than a cat, and I shouldn’t be a bit
surprised if that fellow isn’t about again plying his vile business in a
day or two. But at any rate we know now, thanks to Frank’s keeping
his weather eye lifting, and others are not likely to come along here
any more without getting their due.”
“Yes,” went on Mr. Jacks, “that boy gets smarter and better every
day. I never saw a more likely lad, or one that shaped for a first-
class seaman more steadily than he does.”
“I’ll have a talk to him presently,” said the skipper; “meanwhile let’s
go and have a look at those poor fools in the forecastle, they seem
to have quieted down a bit now.”
So they went forward to the forecastle, and hearing only groans and
heavy breathing went in, to find the place a very slaughter-house,
reminding one more of a Roman arena after a gladiatorial show than
anything else. Fortunately no knives had been used, so that
although blood had flowed in a ghastly manner the wounds were
only superficial. But the bodies were nearly all naked, the clothes
having been torn off them in shreds, beards and hair had been torn
out by handfuls, and—but you can imagine what would happen if a
dozen homicidal maniacs were suddenly turned loose upon one
another, and further attempts at description would be disgusting.
Captain Jenkins turned away from the miserable spectacle with a
sigh, feeling that he could do literally nothing at present until the
fumes of that horrible poison had died out of its victims. But he went
and found Frank and thanked him warmly for his help in locating the
source of the evil.
Then, as a sudden idea came to him, he led the young man forward
and showed him the forecastle, “Look at that, Frank,” he said, “and
remember it all your life. The poor sailor has many drawbacks to a
comfortable existence, but he has none greater than himself. And
yet he is much to be pitied. Don’t forget this when you come to be in
command, as I feel sure you will be; always remember that a sailor,
in a ship like this at any rate, needs to be protected against himself
in spite of himself, and, if you find a man who is all right, he
deserves and should get every encouragement that you can safely
give him, and you needn’t patronise him, which is of all things the
treatment which disgusts him. Now go and turn in, and don’t forget
that what you have done to-night has saved more trouble and
suffering than you have any idea of, to say nothing of the expense to
the ship.”
And so they parted for the night, Frank feeling at least an inch taller.
But when Johnson asked him what on earth the old man had been
gassing about for so long and he told him, Johnson replied
discontentedly, “Some people have all the blessed luck.” As if luck
could have anything to do with the matter.
Oh, but she was a sad ship the next day. The condition of the crew
was too pitiful for words. Their injuries, severe as they were in many
cases, were as nothing compared with the state of their brains and
stomachs from the poison. The doctor paid his usual visit in the
morning when the forecastle had been cleansed a little and the
sufferers had got into their bunks. He gave it as his opinion that,
despite the proverbial toughness of the sailor, it would be fully a
week before any of them were fit for work again.
The skipper asked if nothing could be done officially to prevent the
possibility of such horrors. The doctor shrugged his shoulders,
saying, “The policing of this great harbour with its 30,000 of a
floating population ready for any deed of darkness which they may
do with impunity is hard enough, especially when you remember
that one side of it is Chinese territory, and the only thing that can be
done is to keep a good look-out. But I admit that all captains that
are new-comers should be warned of the possibility of such an
occurrence as yours. Which you certainly were not.” And he went
away, leaving Captain Jenkins both angry and sorrowful, but, with all
a sailor’s cheery optimism, ready to admit that it might have been a
good deal worse.
Fortunately the ship was in very good order aloft, as the crew had
been employed there out of the way of the smother on deck since
she came in, and therefore the loss of their services was not so
much felt. The discharging went on steadily, and the ballast came in
natural sequence without any disturbance, so that by the time the
crew were all fit again the ship, except for the bending of her sails,
was ready for her passage across to Manila, where she was to load
hemp for New York.
But as soon as it was evident that she was ready for sea, those men,
only newly risen from their bunks of pain, came aft and demanded
the usual twenty-four hours’ liberty and a month’s wages. This
presented a cruel problem to Captain Jenkins. He was no admirer of
the system by which alone among workmen the sailor is kept out of
his money for a period sometimes of two years, and then, getting it
all in a lump, is liable to be robbed of it in a lump, but he saw a
great danger ahead now. These men were obviously unfit to be
trusted, for, if he was any judge, he felt sure they would not profit a
bit by the awful lesson they had received.
But he felt bound to make the attempt, so he said, “Now, men, I am
quite aware that a day’s liberty and some money to spend is due to
you by the usual custom, and if you are bent upon having it I don’t
feel justified in driving you into any foolishness by refusing it. But
you know very well how ill you have all been through that filthy
liquor you bought so dearly. Now the same kind of stuff is obtainable
ashore, and if it drives you mad as it did before, you’ll get locked up
and have a very bad time, while I shall lose the services of as good a
crew as I’ve ever had. Don’t you think you’d better wait until we get
to Manila and have your liberty there? You’ll have had more time to
get thoroughly well.”
The two Britons at once growled out a reply that they wanted their
liberty, and the skipper, looking round upon the rest of them, saw
only sullen insistence upon their right in every face, so, angrily, but
feeling deeply sorry for the foolish fellows at the same time, he said,
“Very well, then, the starboard watch can go ashore to-morrow, and
the port watch the day after, Saturday. Come to me in the morning,
you starboard watch men, and I’ll give you your liberty money.”
The only reply was a series of satisfied grunts, conveying the idea
that he had tried to bluff them out of their rights, but he had found
he couldn’t do as he liked with them, and so on. So they parted, and
the skipper returned to his cabin and held a consultation with his
officers on the immediate probability of their having to get a new
crew of such wastrels and loafers as Hong-Kong usually affords.
Nothing could be done, though, but hope that the men would come
aboard again not more than ordinarily drunk; in their then surly
condition of mind evidently too much to hope for.
Why prolong this pitiful part of my story, the starboard watch went
ashore the next morning in the best rig they had, and although they
certainly did drop a few of their hard-earned dollars in the curio-
shops, it was not long before they got to the bad end of the Queen’s
Road, and had commenced an orgie which finally landed them all in
the lock-up in a most deplorable condition, the more so because
their stamina was still very low.
The news was brought off to the skipper, who received it with an
outburst of keenest sorrow, and immediately called the port watch
aft to hear what had become of their shipmates. And so far from it
making any favourable impression upon them, it seemed as if it only
spurred their appetite for such fearful joys, and a spokesman
stepped forward saying, “I s’pose you ain’t goin’ to stop the port
watch’s liberty because the starboard watch ’as got into chokey, sir?”
“Since you ask me,” responded the skipper, “that is just what I am
going to do. As I told you yesterday, I don’t want to lose a good lot
of men like you by giving in to your foolishness, and until I see
whether I can get the starboard watch back there’s no beach for
you, make up your mind to that. You’re just a pack of fools and
idiots, and must be treated as such.”
“All right, sir,” answered Micky, “that’s what you say; what I say is
that I don’t do another hand’s turn aboard this hooker until I have
had my liberty, and my watchmates say the same; don’t ye, boys?”
A fierce growl of assent clinched this outburst, and, turning sharply
round, the watch went forrard into the fo’c’sle.
I must digress for a moment to point out that such an occurrence as
this was by no means uncommon in the days I am writing of, twenty
years ago, and is certainly not unknown to-day. It serves to show
the peculiar character of the “deep water” sailor, and the difficulty of
dealing with him. The Sealark was certainly not a bad ship, and the
crew were, as we have seen, very good men, but whether it is the
sight of land and the thought of its allurements, a sense of
irresponsibility, and an impatience of the long confinement, or some
such kindred feeling, I know not; I can only say that, incredible as it
must appear to landsfolk, men will and do act as I have described
without any provocation or other inducement than the prospect of a
debauch. And nothing is more likely to stir up this tendency to revolt
than the stoppage of liberty for any cause whatever.
The next morning the skipper went ashore, having first ascertained
definitely that the port watch were firm in their determination to do
nothing more unless they had their liberty, he being equally firm in
his refusal to grant it to them. He interviewed the authorities, who
informed him that his men had been so savage and had so severely
injured several Sikh policemen that fines would not satisfy justice,
and they must be imprisoned. Then he laid the case of his mutineers
on board before them, and it was decided that he must take a posse
of police on board and put the mutineers in irons if they still
persisted in their refusal and he was determined to take them to
sea. So he returned on board with the police, and the foolish men,
after being almost implored to be sensible for once, and being told
of the condition of their companions, and still remaining obstinate,
were ironed and placed in the after part of the ’tween decks with all
sorts of evil passions raging in their hearts at what they considered
the gross and shameful injustice of their treatment.
Then he had to go ashore again, taking with him the effects of the
men who were in prison, go through all the formality of paying them
off after duly deducting the charges he had been put to, and then go
and hunt up some more men. But here he found a difficulty, men
appeared to be very scarce, and in the end he was fain to be
content with eight Lascars, natives of India, who had been landed as
shipwrecked men from a sailing ship. He was distressed about this,
but his duty to his owners in the matter of getting the ship away
compelled him to leave no stone unturned for that purpose.
In the result he sailed on Monday morning with his swarthy recruits
doing very well, and the second mate was duly warned not to be too
severe in handling them, while the stubborn men down below aft,
with a spirit that nothing seemed able to quell, munched their bread
and drank their water of affliction and made no sign of being
discontented therewith. The ship, being in ballast, was fairly tender,
and so he (the captain) did not dare to carry a press of sail to the
strong breeze blowing, even had he been efficiently manned.
But a smart passage was quite out of the question anyhow, and he
felt a glow of satisfaction as he saw how capable were his Lascars
and how ardent his two senior apprentices. The two younger boys,
unhappily, were neither of them at all adapted for a sea life, and
regarded every opportunity afforded them for acquiring practical
knowledge as a hardship and an additional outrage upon their
already offended sensibilities. Which was a serious loss to them as
well as an annoyance to other people.
So the passage across progressed most favourably for the willing
workers, and Captain Jenkins’ hopes rose high that he should after
all be able to make so successful a voyage as would justify his
appointment, a matter that is usually, or was usually, a serious
consideration for every new-fledged skipper in those days. And to
crown his satisfaction, the day before they sighted Luzon the mate
came to him and said that the recalcitrant watch confined in the
’tween decks had at last weakened, and expressed a wish to see the
skipper.
He went down at once, and addressing them said, “Well, men, I
hear you have something to say to me. What is it you want to say?”
There was an uneasy movement among the pathetic little group,
and then the young Welshman, who had been the leader of the
party of revolt, said, “Beg ye pardon, cap’n, we’re ready to turn to.”
The skipper waited a few moments in case there should be anything
else, and then replied, “I’m glad to hear it. Don’t think I’ve had any
pleasure in seeing you suffer as you must have done, but if you had
gone ashore and behaved as the men of the starboard watch did
you’d be far worse off than you are. Now, I want to make a bargain
with you. If you’ll only go back to your work, and behave as you did
on the passage out, I promise you that neither my officers nor
myself will make any difference in our treatment of you from what
you received then, treatment that you said you were perfectly
satisfied with. More than that, although I have of course entered all
this affair up in my official log, I promise you it shan’t be mentioned
again or charged against you. But you must not think of going
ashore at Manila, and you must treat these Lascars properly whom I
have had to engage instead of the starboard watch, and who have
behaved splendidly. I’ve put them all on the starboard side of the
fo’c’sle so that you needn’t mix, but I will have them treated like
men, for they are quite worthy of it. Is it a bargain?”
“Yes, sir,” was the simultaneous answer. Whereupon the skipper,
raising his voice, shouted, “Mr. Cope, bring the key of these irons.
The port watch is resuming duty.”
So for once a difficult and dangerous situation was ended in a way
entirely satisfactory to all concerned. Alas! the causes where such
temporary aberrations of intellect on the part of our sailors have led
to widespread misery and awful crime have been only too common.
And most of their horrors might have been averted if only those in
command had been fully competent and firm. In such a case
weakness is a crime, but few there be among men who are judicially
convinced of this most fundamental fact or believe that justice
impartially administered is the truest mercy; or indeed know what
justice is. But I must not pursue this subject further. I would not
have trenched upon it now but to show how entirely good was the
schooling my hero was receiving thus early in his sea career, as I
hope I have shown how capable he was of acquiring the same.
Now all was peace and satisfaction on board the Sealark, for the
skipper gave orders that the released watch should be furnished
with an extra good meal before resuming duty—well he knew how
gratefully it would come to men who had been champing the dry
biscuit which used to be the sole bread of the sailor. And when they
came on deck in the afternoon, eager to take hold again, glad to feel
the fresh breeze blowing upon them, and glad also to sniff the briny
air, they were delighted to get the order from Mr. Jacks to make sail.
They sprang to his call, giving him as much pleasure as his saturnine
nature was capable of feeling, for he, like many others of his class,
had a positive hatred of niggers, as he called them all without
distinction, and preferred the rowdiest, most undisciplined crowd you
could find anywhere to a gang of willing, subservient dark men, who
had to be pushed and pulled and handled generally like a flock of
sheep by a shepherd without a dog. The chief officer, on the other
hand, was quite contented with his docile crowd, who not merely did
the best they were capable of, but were really good specimens of
the seafaring Indians, whose capacity is always highly spoken of by
those who have had the opportunity of commanding them.
Only twenty-four hours afterwards the good ship Sealark sailed into
the bay of Cavité with as favourable wind and weather as could
possibly be desired, and anchored off the old city of Manila amid a
goodly company of sailing ships of all nations, and one Spanish
steamer. Here she lay in the most comfortable quarters, except for
the fact that, with the well-known carelessness and freedom from
provision on the part of the Spanish authorities, she was left alone
for the remainder of the day, until her skipper had almost fretted
himself into a fever, knowing well that he dare not go ashore until
the authorities had given him permission. But some men are like
that, great emergencies find them prepared and able, little things
get on their nerves, irritating them almost beyond endurance.
I feel, however, that of late I have been letting my favourite slip into
the background too much. He has been accorded his proper place in
the scheme of things though, occupying as he does an entirely
subordinate position in the ship, having a minor part to play, and
although playing it extremely well, not being of any supreme
importance to any one except his own immediate family and himself.
Fortunately Frank was one of those well-balanced youths who was
not always dwelling upon his position and wondering whether other
people thought as well of him as he deserved. And this freedom
from introspection stood him in splendid stead both at this time and
afterwards, saving him much mental trouble.
As regards his actual duties, I doubt whether he had ever been so
happy in his life. For the skipper had rigged a boat with a suit of
sails with that loving care that only a good sailor bestows upon a pet
hobby. Having made her complete, he asked Frank and Johnson
whether either of them knew anything about handling a boat under
sail, and Frank, who had been taught at Lytham, after waiting for
Johnson’s denial, modestly said he thought he would be able to do
so now, having done it before he came to sea.
So the skipper, to his intense delight, gave him charge of the boat,
with the two junior apprentices to teach also, and set him free of all
ship work whatever. It is a good long distance from the anchorage
off Manila into the “Canash,” as sailors will persist in calling the
carenage, and sometimes there is a very strong breeze,
necessitating three reefs, but Frank rose to the occasion and, like a
veteran boatman, handled the craft of which he had suddenly been
made commander. Moreover he drilled those two slack youngsters
ruthlessly, making them dress neatly, keep themselves clean, and
practised them at rowing until they behaved themselves in the boat
as if they had an object in life.
Now there may be better ways of making a boy self-reliant and
resourceful than giving him a boat to handle under sail where he is
likely to meet with bad weather occasionally, but I do not know of
them. And if in addition the boy is passionately addicted to the
sport, the rapidity with which he will acquire those qualities to which
I have alluded, and others, is amazing. The beauty of boat-sailing is
that the novice there learns that difficult art of feeling the direction
of the wind, that impalpable force which means so much to the
sailing craft in proportion to her size.
Hitherto, of course, Frank had been obliged to gather what little
knowledge he possessed of how to trim the yards to the wind by
what the second mate did while he was at the wheel. Now he was
learning practically, finding out how when he jammed her up into the
wind she drifted crabwise to leeward, and how he who was not too
greedy of stealing to windward, and never let his craft shake a
stitch, was sure, so long as he was not lavish, and let her swagger
off the wind, to get to windward of those would-be smarties who
were always fancying they could reverse the laws of mechanics, and
imagining that they could outpoint the wind.
Nor was this all. He learned here by practice how the trim of a vessel
affects her sailing powers, a law which applies equally to the ship’s
boat under sail and the 3000-ton four-master; learned how to
dispose of his crew of two to the best advantage, and to study the
effect that even their slight weight had upon the weatherly qualities
of his boat or her speed with a free wind. Also he learned to
command; to give no unnecessary orders, but to have such orders
as he did give carried out instanter, or else to visit with condign
punishment the slack offender.
But there is no doubt that he was heavily handicapped by the
character of the two boys placed under his charge. They did nothing
willingly. The only thing that appealed to them was fear of a
punching from him, or of being reported to the skipper. Ideas of
honour, truth, or honesty they had none, and Frank, who could not
understand them at all, had to watch them like a warder watching
convicts, or, when the boat was waiting at the bund in the Canash
for the captain, to exercise constant vigilance lest they should run
away into some of the filthy native quarters and get into serious
trouble.
By all of which I do not mean to suggest that Frank was anything of
a prig or a prude. He was essentially a manly boy, with a high sense
of trustworthiness, and while, if he were on liberty with fellows of his
own class and age, he would doubtless kick up his heels like a young
colt in a meadow, yet when in a position of responsibility he was as
sternly bent upon doing his duty to the best of his ability as any man
old enough to be his father. Of course captain and officers noted
this, and enjoyed it quietly, but after the manner of their kind said
nothing, only occasionally showing by their actions how much they
trusted him. And this only on his second voyage. True they were
long voyages, and the circumstances highly educational, but still we
must recognise the rapidity with which a lad of Frank’s type will rise,
given fitting occasion.
The time spent by the Sealark in Manila was almost idyllic in its
peace and simplicity. The weather was all that could be desired, the
men were most tenderly handled by way of compensation for their
enforced abstinence from the dubious delights of what sailors always
term “the beach”; and owing to the complete division of the white
portion of the crew from the Lascars, there was no friction there
either. True, they had never yet been called to work side by side in a
position of danger or emergency, but in the daily work of the ship
harmony reigned. The ballast was discharged by native labourers,
and the hemp began to arrive all in most leisurely fashion, for when
did ever a Spaniard hurry except to fight.
But the chief thing was that no trouble ensued from either end of
the ship; and when at last the flag was run up to show that the last
bale of hemp was rammed into its place, and all that now remained
was to carry it to New York, although some of the white men
forward did certainly look longingly at the shore, there was no word
of grumbling at the inevitable decision of the skipper that no leave
should be granted. Johnson growled consumedly, telling Frank what
a shame he thought it that his junior should be so privileged, just
because he possessed a little knowledge of boat-sailing; but Frank
speedily appeased him by repeating his asseverations of the
absolute unattractiveness of the place, as far as he had been able to
see it. Besides, the cholera was raging, and it would have been
constructive murder to send fellows ashore on liberty in such a
reeking hole.
Therefore, without any difficulty whatever, behold the Sealark at
daybreak on a lovely Monday morning getting under weigh for her
long long passage, her crew singing lustily at the windlass brakes,
but without much concord, because the Lascars could not savvy
English singing, and yet would try to assist, with the strangest and
most unmusical results. The wind blew fair for the passage down the
bay, and the men, if not exactly satisfied, were at least resigned to
what they considered their loss of the pleasures (?) that Manila
could afford. And such good progress did they make that before
dusk they had passed out between the heads of the great bay, and
saw the island of Luzon fade away like a huge blue-black cloud in
the dim and indefinite distance. They got a fine offing, then the wind
faltered and died away to a dead calm. The vessel lay listlessly
rolling upon the black expanse of waters under a sky of deepest
violet, while the stars shone down upon the unreflecting waters like
pin-points of white-hot metal without a twinkle.
Then a strange transformation took place in that dark, placid sea. It
began to be streaked with greenish lambent light in ridges, and little
pools of glare appeared to rise from the inscrutable depths, so
uncanny that it seemed impossible to give them the name of light.
There was also a faint suggestion of rippling sound, as if the silken
surface of the ocean were being disturbed by sudden currents. This
extraordinary glare grew in intensity, until the awed observers
noticed that the lustre of the stars paled to a dead white, and the
beautiful violet of the sky, with its soft suggestions of after-glow,
became of a velvety blackness, such as those who sail in far
northern seas are wont to associate with the middle of the auroral
arch.
Then through and through the growing whiteness of the sea there
began to run bands of brighter light, that marked the passage of the
sea creatures as they came and went in their never-ending quest for
food. And occasionally a series of ripples, untraceable to any cause,
would break against the vessel’s side, lighting it up with a ghostly
glare, and reflecting upon the faces of the onlookers with something
of the same effect which may be observed in a darkened room from
the flare of burning spirit in a dish. This wonderful appearance of the
ocean, which is known by the entirely inadequate name among
sailors of a “milk sea,” lasted about four hours, and then passed
away as suddenly as it had come, with no atmospheric disturbance
following it except that there was a gentle breeze sprang up from
the northward, which gradually freshened into a wind that carried
the good ship along at the rate of five knots an hour directly on her
homeward course.
And now, as I have the interests of my young readers at heart, I
must pass very rapidly over the easy, eventless course of the next
fifty days. They were easy days, for the winds blew generally fair if
light, and the passage through the Sunda Straits, except for one
terrific thunderstorm, was unmarked by any difficulty. The crew were
contented, not too hard worked, but still kept fully employed during
the watch on deck in the daytime, and the upper gear of the ship
was put in as good repair as was possible to conceive of, the white
men doing all the sailorising, sail-mending, &c., and the Lascars
doing all the cleaning, scraping, &c., which demands not so much
manual skill as patience and a complete indifference as to the nature
of the work the man is engaged upon, an indifference which it is
hard to find among men who put their brains into their work, as
good sailors should.
So that there was absolutely nothing worth chronicling throughout
the passage of the Indian Ocean, and even getting round the Cape
was unattended by anything more exciting than a strong wind, not
amounting to a gale. The only fact that I am obliged to record is that
Captain Jenkins took it into his head to invite Frank and Johnson into
the saloon in the second dog-watch to study navigation, and was
immeasurably surprised to find that they knew the theory of it
almost as well as he did. So he set them to practise with the sextant
and chronometer, until, as he declared, they were as well able to
navigate a vessel as he was.
CHAPTER XII
FRANK GETS HIS OPPORTUNITY
I hope I have made it clear to my readers that Frank, although now
barely seventeen, was a fine specimen of a young man both in
physique and in morale or mind. For sheer love of his profession he
had learned all that there was to learn about it as far as his
opportunities went, and above all he had acquired the habit of self-
reliance, which is a mighty factor in advancement at sea. For no
matter how clever the man is in theory, if, when the time comes to
act, he is ever looking round for some one else to rely upon, has a
certain and deep-rooted distrust of himself, that man is debarred
from obtaining an early command, or if he does obtain it, he
generally loses it painfully soon, because he cannot trust himself.
Of course practice is essential to prove theory, however certain we
may be of the theory, and Frank as yet had only been able to prove
his learning in minor things, such as his boat-handling, his steering,
his watching the trimming of the sails, and comparing his working of
the ship’s position with the skipper’s when he and Johnson had been
allowed to take and work up observations of the sun, moon, and
stars. But in spite of his limitations he was far above the average of
his years; he already had that steadfast outlook upon the world of
his profession, that fearless grasp of its details that go to make up
the complete seaman even in these so-called degenerate days, when
conditions have so changed that we may, and do, find men of the
highest education and refinement in charge of our merchant ships,
and especially steamships.
However, I must not now spend more space in describing Frank’s
mental and physical condition, as I need to get on with the
consequences of their high development. The Sealark rolled
comfortably along up the pleasant stretches of the south-east
Trades, with all hands busily engaged in the commonplace duties of
painters and house-decorators.
It was an easy, happy time. Captain Jenkins was far too genuine a
man, and also far too just, to keep his men out of their honest watch
and watch in the senseless Yankee custom. He hated the sight of
those dazzlingly white bulwarks, shining black topsides, and
glistening spars, knowing how much human agony it represented of
absolutely useless and grotesque brutality practised by armed, well-
fed officers, upon cowed, bruised, and demoralised men, such as
was the rule in the “smart Yankee fliers.” So all hands were happy,
cleansed and painted the white work, scraped and varnished the
bright work, and did all those minor things that go to make a ship
look beautiful, with a meticulous care and pride in her appearance
that was quite absurd when you come to look at it, since probably
not one of those poor sailors would be in her again either next
voyage or afterwards.
She glided by St. Helena with its many memories; by Ascension, that
naval rock which is borne upon the books of the Admiralty as if it
were a man-of-war; on, on, gently, certainly, and almost
unknowingly across the line until, in 7° N., the faithful south-east
wind faltered at last and left them to wallow in calms for a day or
two, watching the dank sea-grass on her bottom spread like a dead
woman’s hair as she rolled listlessly on the oily swell. There was little
really left to do by this time in the decoration and smartening of the
ship internally—that is to say, on deck and aloft, but outside she
looked rusty and unkempt, and Mr. Cope cast longing eyes upon his
pots of black paint, imagining how splendid a thing it would be if he
could only complete his work by spreading them upon her outside.
For although it may sound trivial to the ordinary reader, the
appearance of his ship to others is a very serious, and, in fact, an
all-important matter in the eyes of a good seaman. And when you
come to consider it, rightly so, for it reveals the character of those
who have had charge of her.
But before anything could be done in the matter of external painting,
the pleasant north-easterly breeze, the first breath of the Trades,
came down upon them, freshened, and in three or four hours from
their first feeling it they were bowling merrily along on the starboard
tack “full and bye” for New York. The easy home stretch of their
voyage, unless indeed they met with abnormal weather in the Gulf
Stream, had begun. Frank was already looking forward with
pleasurable anticipation to his visit to America’s greatest city, the
second greatest in the world, and half wondering to himself how it
was that he did not feel annoyance at the thought that he was not
bound home direct, as Johnson did.
The latter young man was dragged on by the sheer force of Frank’s
example, but, as he often said, he had no real love for the
profession, and if a chance offered as soon as he was out of his
time, he would be content with a very subordinate position ashore
rather than ever go to sea as a sailor again. He, like so many others,
had discovered too late that he had made a leap in the dark, had
mistaken his vocation, could take no pride in his calling despite its
many disabilities, difficulties, and dangers, and consequently would
never make a good sailor, and would only swell the ranks of the
passable and disappointed ones.
The days now sped rapidly on as the ship, with every stitch set and
drawing, made splendid progress across the Trades, with the wind
steadily strengthening as she made northing. But she was barely
clear of the tropics when the weight of the wind increased so much
that they were fain to reduce sail, much to Captain Jenkins’ disgust,
the wind being nearly due east, and consequently allowing him to
make his course good going free. He hung on as long as he could,
but was gradually compelled to shorten down until the Sealark was
tumbling about in a most tremendous sea, hove to under a patch of
tarpaulin in the mizzen rigging; and Frank, vivid as were his
recollections of the cyclone, felt as if he had never till now realised
the deep, steadfast malignity of wind at the height of its power. For
it was not squally, its force was persistent, massive, terrible, having
in its roar a note of doom.
But yet there was an amelioration of the conditions as compared
with the lurid horrors of the cyclone. It was light, and often the sky
was quite clear until, with a speed that was appalling to witness, a
mass of cumulous cloud would hurtle across the ether, torn into a
thousand fantastic shapes in its passage. And rage the gale never so
furiously, rise the sea never so high, the tiny pretty petrels, Mother
Carey’s chickens, still flitted unconcernedly over the mighty
corrugations of the deep, even nestling to all appearance in the most
perfect confidence under the over-curling head of some awful billow
as if it were a shelter from the fury of the storm. And though I
suppose he should by this time have lost such a boyish illusion (alas
that we should ever lose them), he could not help feeling a renewed
confidence in the successful issue of the great fight between ship
and sea on witnessing the easeful security manifested by those wee
birds.
Three days that gale blew, then died away to a gentle series of “cat’s
paws,” which failed to steady the ship in the still gigantic upheavals
of the so lately tormented deep. One other vessel was in company
with them some five miles distant, and as she was behaving
strangely to a seaman’s eye, backing and filling and manifesting all
the motions of an unmanageable vessel, Captain Jenkins used all his
endeavours to get nearer to her. But owing to the lightness and
variableness of the wind he was only able to approach sufficiently
close by nightfall to make sure that from some cause or another she
was really at the mercy of wind and wave. Her masts were intact,
and so were the yards, but from them there dangled long streamers
as of sails blown away and running gear flying adrift. She was a
barque of apparently the same size as themselves, and setting fairly
deep in the water, in great contrast to the Sealark, which being
loaded with hemp was in excellent trim, not down to her marks by a
long way.
A very careful watch was kept on her all night, during which the
weather was almost perfectly calm. But now and then a light air
would come along, which was utilised immediately to get nearer to
this mysterious ship, and with such good effect that about two hours
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com

More Related Content

PDF
[FREE PDF sample] Object Oriented Programming and Java Second Edition Danny P...
PDF
Services, tools & practices for a software house
PPT
2) java development
PDF
Objectoriented Programming And Java 2nd Ed Danny C C Poo Derek Beng Kee Kiong...
PDF
Java Complete Reference Fifth Edition
PDF
Java programming-language-handbook
PDF
From Renamer Plugin to Polyglot IDE
PDF
(eBook PDF) Java How to Program, Late Objects Global Edition 11th Edition
[FREE PDF sample] Object Oriented Programming and Java Second Edition Danny P...
Services, tools & practices for a software house
2) java development
Objectoriented Programming And Java 2nd Ed Danny C C Poo Derek Beng Kee Kiong...
Java Complete Reference Fifth Edition
Java programming-language-handbook
From Renamer Plugin to Polyglot IDE
(eBook PDF) Java How to Program, Late Objects Global Edition 11th Edition

Similar to IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders (20)

PDF
Java How To Program Early Objects Eleventh Edition Deitel Harvey M Deitel
PDF
Download full ebook of Java Cookbook Ian F Darwin Darwin Ian F instant downlo...
PPTX
Java and the JVM
PDF
Supplement2d netbeans6
PDF
Supplement2d netbeans6
PPTX
Writing better code: How the Netbeans IDE Helps you Write, Test and Debug Java
PDF
Java The Complete Reference Ninth Edition Herbert Schildt
PPT
General introduction to intellij idea
PDF
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
PDF
Part 2 java development
PDF
Rich client programming plugging into the NetBeans Platform 1. print Edition ...
PDF
ABSE and AtomWeaver : A Quantum Leap in Software Development
PPT
Eclipse
PDF
TOP 10 WEB APP TOOLS FOR EFFICIENT DEVELOPMENT.pdf
PDF
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
PDF
Learning Java An Introduction to Real World Programming with Java Marc Loy
PPTX
Fundamentals of java --- version 2
PPTX
Java For beginners and CSIT and IT students
PPT
Idea7 Jug
DOCX
JAVA First Day
Java How To Program Early Objects Eleventh Edition Deitel Harvey M Deitel
Download full ebook of Java Cookbook Ian F Darwin Darwin Ian F instant downlo...
Java and the JVM
Supplement2d netbeans6
Supplement2d netbeans6
Writing better code: How the Netbeans IDE Helps you Write, Test and Debug Java
Java The Complete Reference Ninth Edition Herbert Schildt
General introduction to intellij idea
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
Part 2 java development
Rich client programming plugging into the NetBeans Platform 1. print Edition ...
ABSE and AtomWeaver : A Quantum Leap in Software Development
Eclipse
TOP 10 WEB APP TOOLS FOR EFFICIENT DEVELOPMENT.pdf
(eBook PDF) Introduction to Programming with Java: A Problem Solving Approach...
Learning Java An Introduction to Real World Programming with Java Marc Loy
Fundamentals of java --- version 2
Java For beginners and CSIT and IT students
Idea7 Jug
JAVA First Day
Ad

Recently uploaded (20)

PDF
Complications of Minimal Access Surgery at WLH
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
RMMM.pdf make it easy to upload and study
PDF
Classroom Observation Tools for Teachers
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Computing-Curriculum for Schools in Ghana
PPTX
Presentation on HIE in infants and its manifestations
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Complications of Minimal Access Surgery at WLH
O5-L3 Freight Transport Ops (International) V1.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
01-Introduction-to-Information-Management.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Anesthesia in Laparoscopic Surgery in India
RMMM.pdf make it easy to upload and study
Classroom Observation Tools for Teachers
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Computing-Curriculum for Schools in Ghana
Presentation on HIE in infants and its manifestations
Microbial disease of the cardiovascular and lymphatic systems
Abdominal Access Techniques with Prof. Dr. R K Mishra
Chinmaya Tiranga quiz Grand Finale.pdf
Cell Structure & Organelles in detailed.
Module 4: Burden of Disease Tutorial Slides S2 2025
Final Presentation General Medicine 03-08-2024.pptx
Ad

IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders

  • 1. IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders pdf download https://ebookfinal.com/download/intellij-idea-in-action-in- action-series-1st-edition-stephen-saunders/ Explore and download more ebooks or textbooks at ebookfinal.com
  • 2. We have selected some products that you may be interested in Click the link to download now or visit ebookfinal.com for more options!. WebWork in Action In Action First Edition Patrick Lightbody https://ebookfinal.com/download/webwork-in-action-in-action-first- edition-patrick-lightbody/ Business Studies in Action 4th edition. Edition Stephen John Chapman https://ebookfinal.com/download/business-studies-in-action-4th- edition-edition-stephen-john-chapman/ Performance Projections Film and the Body in Action 1st Edition Stephen Barber https://ebookfinal.com/download/performance-projections-film-and-the- body-in-action-1st-edition-stephen-barber/ Scala in Action Nilanjan Raychaudhuri https://ebookfinal.com/download/scala-in-action-nilanjan-raychaudhuri/
  • 3. DSLs in Action Debasish Ghosh https://ebookfinal.com/download/dsls-in-action-debasish-ghosh/ Camel in Action Claus Ibsen https://ebookfinal.com/download/camel-in-action-claus-ibsen/ Grails in Action 1st Edition Glen Smith https://ebookfinal.com/download/grails-in-action-1st-edition-glen- smith/ Kafka in Action 1st Edition Dylan Scott https://ebookfinal.com/download/kafka-in-action-1st-edition-dylan- scott/ Netty in Action 1st Edition Norman Maurer https://ebookfinal.com/download/netty-in-action-1st-edition-norman- maurer/
  • 5. IntelliJ IDEA in Action In Action series 1st Edition Stephen Saunders Digital Instant Download Author(s): Stephen Saunders, Duane K. Fields, Eugene Belayev ISBN(s): 1932394443 Edition: 1 File Details: PDF, 12.57 MB Year: 2006 Language: english
  • 9. IntelliJ IDEA in Action DUANE K. FIELDS STEPHEN SAUNDERS EUGENE BELYAEV WITH ARRON BATES M A N N I N G Greenwich (74° w. long.)
  • 10. For online information and ordering of this and other Manning books, please go to www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact: Special Sales Department Manning Publications Co. 209 Bruce Park Avenue Fax: (203) 661-9018 Greenwich, CT 06830 email: orders@manning.com ©2006 by Manning Publications Co. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps. Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books they publish printed on acid-free paper, and we exert our best efforts to that end. Manning Publications Co. Copyeditor: Tiffany Taylor 209 Bruce Park Avenue Typesetter: Denis Dalinnik Greenwich, CT 06830 Cover designer: Leslie Haimes ISBN 1-932394-44-3 Printed in the United States of America 1 2 3 4 5 6 7 8 9 10 – VHG – 10 09 08 07 06
  • 11. To my son Jake, who while too young to read this book, will certainly enjoying coloring in it. —D.F. To my wife Michelle, whose support and understanding never cease to astound me. —S.S.
  • 13. vii 1 ■ Getting started with IDEA 1 2 ■ Introducing the IDEA editor 22 3 ■ Using the IDEA editor 63 4 ■ Managing projects 107 5 ■ Building and running applications 142 6 ■ Debugging applications 185 7 ■ Testing applications with JUnit 231 8 ■ Using version control 254 9 ■ Analyzing and refactoring applications 295 10 ■ Developing Swing applications 341 11 ■ Developing J2EE applications 370 12 ■ Customizing IDEA 425 13 ■ Extending IDEA 461 Appendix ■ Getting help with IDEA 481 brief contents
  • 15. ix preface xix acknowledgments xxi about this book xxiii 1 Getting started with IDEA 1 1.1 Installing and running IDEA 2 Downloading the latest version 2 ■ Installing IDEA 4 Running IDEA for the first time 6 1.2 Reviewing the IDEA interface 7 The main IDEA workspace 7 ■ The main menu bar 8 The IDEA toolbar 8 ■ The source code editor 9 The tool windows 9 1.3 Implementing “Hello, World” 10 Creating a project 10 ■ Making a Java class 15 Building the project 17 ■ Running the project 17 1.4 The plot thickens 19 Welcome to ACME Incorporated 19 Starting the ACME project 19 1.5 Summary 20 contents
  • 16. x CONTENTS 2 Introducing the IDEA editor 22 2.1 Exploring the IDEA interface 23 Hanging out in the gutter 24 ■ Using the marker bar 24 Using the editor tabs 25 ■ Exploring the status bar 30 Exploring the tool windows 32 2.2 Using the IDEA editor 40 Writing the first ACME classes and interfaces 40 ■ Opening files into the editor 42 ■ Saving your work 45 Printing your file 47 ■ Navigating in the editor 48 Making text selections 50 ■ Using IDEA’s undo and redo mechanism 52 ■ Cutting, copying, and pasting 53 Searching for and replacing text 55 2.3 Summary 61 3 Using the IDEA editor 63 3.1 What makes IDEA the intelligent editor? 64 3.2 Using code folding 64 3.3 Navigating through your Java code 66 Navigating between methods 67 ■ Navigating to a symbol’s declaration 67 ■ Navigating to a symbol by name 69 Navigating with the structure view pop-up 70 Navigating to an overridden/implemented or overriding/ implementing method 71 3.4 Analyzing your Java code in real-time 72 How IDEA alerts you to problems in your code 73 ■ Monitoring the status of the current document 73 ■ Navigating between problems in the current file 74 ■ Controlling the reparse delay 74 ■ Configuring IDEA’s warning levels 74 3.5 Getting help from the JavaDoc and API references 76 Viewing method parameters 76 ■ Viewing the JavaDoc 77 Creating JavaDoc comments 78 ■ Generating your project’s JavaDoc reference 79 3.6 Code completion 80 Using IDEA’s code-completion features to do your work for you 80 Completing brackets, braces, parentheses, and quotation marks with smart completion 85 ■ Commenting out code 85 Reformatting code 86 ■ Customizing IDEA’s code completion settings 87
  • 17. CONTENTS xi 3.7 Using IDEA’s code-generation tools 89 Generating constructors 89 ■ Generating accessor and mutator methods 90 ■ Generating hashCode and equals methods 91 Overriding methods in your superclass 94 ■ Implementing methods of an interface 94 ■ Creating delegation methods 95 Enclosing a block of code 96 ■ Customizing code generated by IDEA 96 3.8 Programming by intention 97 What are intention actions? 97 ■ Why and when IDEA suggests intention actions 98 ■ Using intention actions to fix errors 98 Using intention actions for code completion 98 Choosing an intention action to execute 99 Disabling intention alerts 100 ■ Exploring some common intention actions 100 3.9 Continuing the ACME project 103 3.10 Summary 105 4 Managing projects 107 4.1 Understanding IDEA’s project strategy 108 Examining the IDEA project hierarchy 108 ■ Selecting different types of modules 109 ■ Selecting a project structure 110 4.2 Working with projects 111 Creating a new project 111 ■ Managing project settings 113 Working with project files 118 4.3 Working with modules 119 Managing project modules 119 ■ Creating a Java module with the module wizard 121 ■ Managing Java module settings 124 4.4 Working with libraries 128 Understanding library basics 128 ■ Adding libraries to the project 130 ■ Migrating projects from IDEA 3.x 132 Sharing projects with others 133 ■ Using path variables 133 4.5 Using the Project tool window 135 Understanding the Project and Packages views 135 Configuring the Project window 136 4.6 Summary 141
  • 18. xii CONTENTS 5 Building and running applications 142 5.1 Building a project 143 How IDEA builds your project 143 ■ Setting up a compiler 145 ■ Building an application under IDEA 149 Reviewing the results of the build 150 5.2 Extending IDEA’s build system with Ant 151 Introducing Ant 152 ■ Improving your build process with Ant 155 ■ Working with Ant build files 156 Executing Ant targets 160 ■ Following Ant’s progress in the Messages window 162 ■ Controlling Ant’s behavior 165 5.3 Running your project 171 Managing Run/Debug configuration profiles 172 ■ Executing a Run configuration 177 ■ Using the Run window console 179 5.4 Expanding the ACME project 181 Adding a library to the ACME project 181 Improving and running the ACME project 182 5.5 Summary 184 6 Debugging applications 185 6.1 Introducing the debugging process 186 Finding and fixing bugs with a debugger 186 ■ Preparing your code for debugging 188 ■ Debugging your source code 190 6.2 Working with breakpoints 191 Managing breakpoints 192 ■ Working with line number breakpoints 195 ■ Working with method breakpoints 196 Working with exception breakpoints 196 ■ Working with field watchpoints 197 ■ Setting conditional breakpoints 199 Configuring breakpoint actions 201 6.3 Debugging an application 202 Executing an application under the debugger 202 Debugging an application on a remote server 205 Stepping through the program 208 Working with threads 211 6.4 Viewing runtime data in the debugger 214 Understanding the Java call stack 214 ■ Inspecting a stack frame 216 ■ Working with watches 221 Altering your program while debugging 222
  • 19. CONTENTS xiii 6.5 Configuring the debugger 223 Managing display preferences 223 ■ Limiting the scope of debugging 224 ■ Customizing the data display view 225 Improving the speed of the debugger 227 6.6 Improving the quality of the ACME project 229 6.7 Summary 230 7 Testing applications with JUnit 231 7.1 Testing applications with JUnit 232 Understanding the JUnit philosophy 232 Exploring the JUnit API 233 7.2 Adding test cases to your project 236 Creating a test case from a file template 237 Adding the JUnit library to your Classpath 237 7.3 Running test cases in IDEA 238 Creating a Run/Debug configuration for your test 238 Running your unit test configuration 241 7.4 Working with IDEA’s JUnit test runner 242 Exploring the JUnit tool window 243 ■ Monitoring testing progress 245 ■ Managing the testing session 246 Analyzing test results 246 7.5 Improving the quality of the ACME project 252 7.6 Summary 253 8 Using version control 254 8.1 Configuring your project for version control 255 Understanding version control basics 255 Enabling version control support in IDEA 257 Configuring IDEA to use CVS 259 Configuring other types of version control systems 264 8.2 Working with files under CVS 267 Retrieving files from the repository 267 ■ Working with files under CVS control 271 ■ Committing your changes 276 Working with branches and tags 279 Viewing change history 281
  • 20. xiv CONTENTS 8.3 Using IDEA’s Local History 289 Understanding IDEA’s Local History 289 ■ How IDEA tracks your changes 290 ■ Exploring your Local History 291 8.4 Summary 293 9 Analyzing and refactoring applications 295 9.1 Analyzing your code 296 Tracking down dependencies 296 ■ Exploring code with the Structure view 298 ■ Exploring the code hierarchy 300 9.2 Locating potential problems with the code inspector 303 Launching the inspector 304 ■ Specifying inspections to perform 306 ■ Viewing the inspection results 308 9.3 Other advanced code analysis features 309 Using Structural Search and Replace 309 ■ Analyzing dependencies 314 ■ Locating duplicate code 316 9.4 Improving code design through refactoring 317 Performing a refactoring 317 ■ Renaming code symbols to improve readability 320 ■ Refactoring to improve class or package organization 321 ■ Working with fields, variables, and constants 325 ■ Refactoring method calls to improve usability 328 ■ Restructuring class hierarchies 333 Migrating source code to new package or class names 338 9.5 Summary 339 10 Developing Swing applications 341 10.1 Understanding the GUI Designer 342 The GUI-building process 342 Working with the user interface 343 10.2 Working with forms 345 Creating a new form 345 ■ Placing components into the workspace 345 ■ Setting component properties 347 Laying out a form 348 10.3 Designing an ACME GUI 351 Creating a new GUI form in IDEA 351 ■ Manually creating the basic layout 351 ■ Applying the grid layout 352 Setting component properties 352 Touching up the final interface 352
  • 21. CONTENTS xv 10.4 Understanding properties 353 Spanning rows and columns 354 ■ Setting an anchor point (cell alignment) 354 ■ Using spacers to control layout 355 Controlling the grid spacing 356 ■ Setting container margins 356 ■ Setting sizing policies 356 Setting fill policies 357 ■ Adding borders 357 10.5 Adding functionality to forms 357 Binding forms and their components 358 ■ Creating a constructor 359 ■ Generating getter/setter methods for fields bound to data 361 ■ Invoking your form 361 10.6 Adding functionality to the ACME GUI 362 Binding the ACME GUI to a form class 362 ■ Creating a constructor 363 ■ Implementing the Convert functionality 364 Providing an entry point 365 10.7 Building and running your form 366 Generating the GUI to binary or source 367 ■ Including the forms library 367 ■ Compiling with Ant 368 10.8 Summary 369 11 Developing J2EE applications 370 11.1 Working with web applications 371 Understanding web modules 371 ■ Creating a new web module 372 ■ Configuring a web module 373 Using the J2EE tab of the Project tool window 377 Working with servlets and filters 379 Working with JavaServer Pages 380 Implementing an ACME web application 386 11.2 Working with EJBs 390 Working with EJB modules 391 Working with J2EE application modules 399 11.3 Understanding application server integration 402 Integrating IDEA with Tomcat 403 Integrating IDEA with WebLogic 404 Integrating IDEA with generic application servers 404 Installing Tomcat to support the ACME web application 405
  • 22. xvi CONTENTS 11.4 Running and debugging web applications 406 Running your web application 408 Running the ACME web application on Tomcat 408 Debugging your web application 410 11.5 Working with web content (IDEA 5.0 and higher) 412 Supported file types and content 412 ■ Basic editor features 415 ■ Coding assistance for web content 417 Navigating through web content files 421 Refactoring web content 422 11.6 Summary 423 12 Customizing IDEA 425 12.1 Configuring IDEA’s options and settings 426 Customizing the interface 429 12.2 Customizing your code style 430 How IDEA uses your code style 431 ■ Variable naming and general formatting 432 ■ Controlling indentation and braces 434 ■ Controlling whitespace 436 Customizing import statements 437 ■ Controlling line wraps 439 ■ Adherence to a code standard—made easy 439 12.3 Customizing your color scheme 440 How IDEA uses color schemes 440 ■ Editor properties 440 Changing font settings 445 12.4 Customizing keyboard shortcuts 447 Using keyboard shortcuts 448 ■ Navigating the interface with the keyboard 448 ■ Selecting a keymap 448 Creating a new keymap 450 ■ Defining keyboard shortcuts 450 ■ Defining mouse shortcuts 452 Defining quick lists 452 12.5 Working with non-Java file types 453 Modifying file types settings 453 ■ Registering file extensions 454 ■ Creating a custom file type 454 12.6 Using file templates 455 Creating a new file from a template 456 Working with template includes 459
  • 23. CONTENTS xvii 12.7 Increasing the amount of memory allocated to IDEA 459 12.8 Summary 460 13 Extending IDEA 461 13.1 Working with bookmarks 462 Placing and using numbered bookmarks 463 Placing and using anonymous bookmarks 463 Managing your bookmarks collection 464 13.2 Working with ToDo lists 465 Creating custom ToDo list items 467 Using ToDo filters 468 13.3 The IDEA Commander 468 Working with the IDEA Commander 469 File operations 471 13.4 Integrating external tools with IDEA 472 Managing the tool list 472 ■ Accessing external tools from within IDEA 476 ■ Reacting to the results of external tools 478 13.5 Using IDEA’s open APIs 479 13.6 Summary 480 appendix Getting help with IDEA 481 index 487
  • 25. xix preface It is often said that necessity is the mother of invention, and this was certainly the case on the cold winter day in February 2000 when JetBrains was founded. It had been nearly five years since the formal introduction of Java, and the tools market was already crowded with a myriad of development environments, all designed to provide a more convenient user interface for Java develop- ment. Although these early IDEs made it easier for developers to create appli- cations, they delivered little functionality to alleviate the time-consuming tasks of coding or ensuring the consistency or excellence of design. As hard-core developers ourselves, we felt that the market lacked a satisfying development environment and we set out to create a tool that would assist professional developers to build complex applications. Originally, we focused our efforts on restructuring code. As luck, or des- tiny, would have it, we were the first to make real progress in this area, and we became the first company to introduce commercial support for refactoring. The reigning IDE vendors took notice of us at this time, and soon afterward, all the major players were attempting to implement the technologies we had managed to bring to the industry forefront. Later that same year, as the dot.com boom went bust and the overall quality of development tools for developers steadily declined, we saw a lot of ways we could improve on what others had failed to do. In January 2001, we introduced
  • 26. Discovering Diverse Content Through Random Scribd Documents
  • 27. Colorado seemed only just to have begun their work. Frank watched, fascinated, the tremendous energy of the mates, the desperate efforts of the men, heard the ghastly chorus of profanity by which the whole work was accompanied. As I have said, the work on board the Sealark ceased at four o’clock, the ship being made snug and harbour-worthy for the night; but on board the Colorado there was not one moment’s respite from labour until everything on board was as if she had been in harbour a month —sails unbent and stowed away, running gear stopped up, cargo gear prepared ready for the morning, and a host of other things, leaving the hapless crew, when they entered the fo’c’sle at eight o’clock, relieved at last, so weary as to be almost unable to crawl when the relief came. I believe in work, and hard work, but a feeling of utter disgust comes over me when I see how men are driven under the flag of the great Republic. Nowhere in the world is the last ounce so mercilessly extracted from poor flesh and blood as it is there, or less concession made to human weakness or limitations. I said that Frank was fascinated, and with reason, for he could hardly tear himself away from the rail to his supper. But when the second mate sauntered up to him and said, “That’s the way to get a ship’s work done, my lad; no crawling there,” Frank looked quickly round and said, “I see they’re smart, sir, but it isn’t necessary to work them so long or curse them so hard. The work is not so pressing as all that, surely.” The old black scowl came over the second mate’s face as he muttered, “You so-and-so lime-juicers don’t know what a man is,” and turned away. For which sentiment I cannot help hating him and his like, while fully appreciating their splendid seamanship. The sight not only held Frank fascinated, as I have said, but it fired his blood; and he made a mental vow that whatever happened he would, if ever he had the power, treat his men as remembering that they were made of the same material as himself. He was drawn from the contemplation of brutality by one of the small boys calling his attention to a sampan, or a Chinese boat,
  • 28. which had stolen up alongside. It was not much bigger than a large rowing-boat, but rising in a graceful curve at the bow, and completely decked over except for a domed cabin aft. In this craft there were obviously three generations—grandfather and grandmother, father and mother, and a family of five children of varying ages, the youngest being a toddles of about three, who staggered about the deck with a big bladder attached to its waist by a stout cord. The use of this appendage bothered Frank very much, until he saw the tiny creature stumble, and take an involuntary dive over the unprotected side of the boat. As coolly as possible the mother, who was standing at the big steer-oar, lifted a boat-hook from the deck, and hooking the child by the bladder cord as it floated quite safely, hauled it on board, and, giving it a shake, set it on deck to drain, at the same time scolding it in what seemed a very discordant, loudly- sung song. Meanwhile all the other members of the family were begging with eloquent gestures, pointing to their attenuated bodies and their mouths alternately. Frank went and fetched some bread, and was about to give it to them, when the mate espied him, and calling him said, “Now remember, Frank, you must never give these people anything; if you do, the ship will be surrounded with sampans from morning till night, and there will not only be annoyance but danger from them. There are 30,000 people like that living upon the waters of this harbour, who do not know from whence their next meal will come, and who are consequently pressed so much that they will stick at nothing to get plunder of any kind. They must not go ashore, and every boat is registered and numbered, as you see; so that if a crime is committed they are easily traced, but that is like locking the stable after the horse is gone. The only wise thing to do is to keep them at a distance.” And so saying he mounted the rail, and in a fierce voice with violent gestures made the boat clear off, the head of the family looking at
  • 29. mate and ship alternately with utterly expressionless face, as if nothing in life interested him at all. “I can’t understand,” said the mate, turning away, “why they don’t make an organised raid some night upon a ship like this, and steal or murder as they like. But I suppose they’ve got no power of combining for a purpose of that sort, besides having, as a race, a tremendous respect for the law. Hello, here comes the skipper.” He went to the gangway to receive Captain Jenkins, who had been ashore in the agent’s smart little launch, and was now returning with a promising little bundle in his hand that said “Letters from home.” In five minutes Frank was transported from all his surroundings by the magic of the written word, was oblivious of strange sights and sounds and smells, and actually listening to the well-remembered tones of the dear ones at home. There was quite an accumulation for him, for his people were wise, and knew how eagerly prized were their letters; so they all wrote to him once a month, and consequently, owing to their long long passage, there were at least a dozen letters. No more getting a word out of Frank that evening, or claiming his attention even for meals. He was perfectly happy, for the letters breathed only love and the calm, even flow of a prosperous life, which he could not help mentally comparing, to its disadvantage, with the stirring times through which he had just passed, or feeling that a special Providence had watched over him in answer to his mother’s tender prayers. I am glad to say that he immediately set about writing a long letter of reply, that is, as soon as he had mastered the contents of his budget. It was boy-like, and glossed over many of the thrilling incidents of the passage in curt, careless fashion; but it must always be remembered to a young man’s credit who occupies a position like Frank’s, that such letter-writing as he does is pursued under great difficulties in the matter of position and light. There is no comfortable table for him to spread his materials upon, and there are usually many interruptions; so that, when the parents get a good
  • 30. letter, they ought to bear in mind that it means much perseverance against odds. Next day they commenced to discharge, and this was also a revelation to Frank. For the appliances were of the simplest—just shallow, saucer-like baskets and spades, and a hundred or so sturdy Chinese to handle them. A huge scow-like junk came alongside, a tarpaulin was carefully stretched between her and the ship to catch any falling lumps, and gangways were laid, along which, when once the business was started, there went a never-ending procession of naked men bearing baskets full of coal, which, as they reached the side, they emptied over into the junk, and then returned by another route to where they found full baskets awaiting them. The air was full of coal-dust, the heat was melting, and the noise bewildering. In the midst of it all stood a spectacled Chinese, a wadded teapot by his side, from which he continually refreshed himself with tiny cups of straw-coloured, tepid tea, as impervious apparently to the discomfort and din of his surroundings, as if he were carved out of wood. Overside the scene was stranger still. There were at least twenty sampans, the occupants of which were diligently engaged in dredging the bottom for such small fragments of coal as, in spite of all care, would occasionally bounce overboard. And these energetic snappers up of unconsidered trifles conducted all their operations amid a deafening uproar of languages that sounded quite uncanny, and made Frank wonder whether such a queer concatenation of sounds could in any possible way serve to communicate thought. In which he was only following a line of fancy trodden by very many before him. There was, however, one cry which, especially in the evenings and early mornings, resounded over the waters of the harbour and puzzled Frank a great deal. He had considerable difficulty in locating its source, but did so at last. He found that it proceeded from the solitary occupant of a small canoe-like boat that was apparently drifting aimlessly about the bay doing nothing at all.
  • 31. And then one night there suddenly broke out in the forecastle a furious and exceedingly bloody fight, in which the good, peaceable men who composed the crew were changed into devils incarnate, with a mad lust to rend and tear each other to pieces. The skipper and two mates rushed forward to quell the frightful outbreak, but soon found that they were not dealing with sane men, but with raving lunatics, and were bound to retire and leave them to fight it out, since to persist in the endeavour to separate the warring fiends was only to court destruction themselves. They waited outside, though full of anxiety, and wondered mightily whatever could be the meaning of it all. Drink, of course, but whence obtained, and what kind of drink that could thus change this peaceable crew so entirely? Neither the skipper nor second mate had ever been to China before, and so they were inclined to believe that the bumboatman employed to supply the crew with fresh fruit, bread, eggs, vegetables, &c. was guilty. But Mr. Cope, who had made one visit to Hong-Kong before, scouted the idea. He said that he had heard that the bumboatmen were above suspicion in that direction, knowing that they would certainly be found out, and when that happened they would forfeit all the money due to them from the crew, for such was the law, besides getting a long term of imprisonment. Mr. Cope, however, could find no reasonable explanation of the source whence liquor could have come. Then it was that Frank bethought him of the weird cry and the drifting canoe, and going up to the skipper he told him of what he had seen, and suggested modestly that there might here be found some explanation. At that very time, and just as Frank had finished speaking, the cry was heard again, quite softly but clearly, close under the bows. The skipper rushed forrard and nipped over the bows, where he struck a match, held it blazing for a moment, and then extinguished it. There was silence for a moment or two, and then the grating of a boat against the cable below, while a soft voice called up through the darkness, “Wanchee samshaw, Johnny?”
  • 32. “Yes, yes,” hurriedly whispered the skipper, “What thing wanchee for one bottle?” “You no catchee dolla, my takee shirtee, Climean shirtee good one, shabee?” “All right, John, I catchee,” whispered the skipper, lowering the end of the jib downhaul; “you makee fast one bottle, I bring shirtee chop chop.” And away he went, hurriedly explaining the situation to the two officers, and telling them to get each as big a lump of coal as they could handle and bring it forward to him when he had got a shirt ready. Then the obtained shirt was exchanged for a bottle, but as soon as the latter was safely hauled up the two masses of coal, each weighing at least half a hundredweight, were hurled down through the darkness on top of the purveyor of madness. There was an awful crash and a yell, then all was silence, as the skipper said with a sigh of relief, “I hope there is one villain less in the world.” Indeed it seemed so, for their utmost peering through the gloom could not descry a trace of anything, even wreckage. The bottle was taken aft and opened. Its contents stunk of all the foul things imaginable, while as for the taste, no description of it would be adequate. “And this was the stuff those unspeakable asses forward have been poisoning themselves with after buying it at such a rate. Well, well!” said the skipper, “the folly of sailors is surely without limit. But, thank God, that infernal devil will never poison a poor fool of a sailor any more.” “Indeed I don’t know so much about that,” said Mr. Cope. “It’s harder to kill a Chinaman than a cat, and I shouldn’t be a bit surprised if that fellow isn’t about again plying his vile business in a day or two. But at any rate we know now, thanks to Frank’s keeping his weather eye lifting, and others are not likely to come along here any more without getting their due.”
  • 33. “Yes,” went on Mr. Jacks, “that boy gets smarter and better every day. I never saw a more likely lad, or one that shaped for a first- class seaman more steadily than he does.” “I’ll have a talk to him presently,” said the skipper; “meanwhile let’s go and have a look at those poor fools in the forecastle, they seem to have quieted down a bit now.” So they went forward to the forecastle, and hearing only groans and heavy breathing went in, to find the place a very slaughter-house, reminding one more of a Roman arena after a gladiatorial show than anything else. Fortunately no knives had been used, so that although blood had flowed in a ghastly manner the wounds were only superficial. But the bodies were nearly all naked, the clothes having been torn off them in shreds, beards and hair had been torn out by handfuls, and—but you can imagine what would happen if a dozen homicidal maniacs were suddenly turned loose upon one another, and further attempts at description would be disgusting. Captain Jenkins turned away from the miserable spectacle with a sigh, feeling that he could do literally nothing at present until the fumes of that horrible poison had died out of its victims. But he went and found Frank and thanked him warmly for his help in locating the source of the evil. Then, as a sudden idea came to him, he led the young man forward and showed him the forecastle, “Look at that, Frank,” he said, “and remember it all your life. The poor sailor has many drawbacks to a comfortable existence, but he has none greater than himself. And yet he is much to be pitied. Don’t forget this when you come to be in command, as I feel sure you will be; always remember that a sailor, in a ship like this at any rate, needs to be protected against himself in spite of himself, and, if you find a man who is all right, he deserves and should get every encouragement that you can safely give him, and you needn’t patronise him, which is of all things the treatment which disgusts him. Now go and turn in, and don’t forget that what you have done to-night has saved more trouble and
  • 34. suffering than you have any idea of, to say nothing of the expense to the ship.” And so they parted for the night, Frank feeling at least an inch taller. But when Johnson asked him what on earth the old man had been gassing about for so long and he told him, Johnson replied discontentedly, “Some people have all the blessed luck.” As if luck could have anything to do with the matter. Oh, but she was a sad ship the next day. The condition of the crew was too pitiful for words. Their injuries, severe as they were in many cases, were as nothing compared with the state of their brains and stomachs from the poison. The doctor paid his usual visit in the morning when the forecastle had been cleansed a little and the sufferers had got into their bunks. He gave it as his opinion that, despite the proverbial toughness of the sailor, it would be fully a week before any of them were fit for work again. The skipper asked if nothing could be done officially to prevent the possibility of such horrors. The doctor shrugged his shoulders, saying, “The policing of this great harbour with its 30,000 of a floating population ready for any deed of darkness which they may do with impunity is hard enough, especially when you remember that one side of it is Chinese territory, and the only thing that can be done is to keep a good look-out. But I admit that all captains that are new-comers should be warned of the possibility of such an occurrence as yours. Which you certainly were not.” And he went away, leaving Captain Jenkins both angry and sorrowful, but, with all a sailor’s cheery optimism, ready to admit that it might have been a good deal worse. Fortunately the ship was in very good order aloft, as the crew had been employed there out of the way of the smother on deck since she came in, and therefore the loss of their services was not so much felt. The discharging went on steadily, and the ballast came in natural sequence without any disturbance, so that by the time the crew were all fit again the ship, except for the bending of her sails,
  • 35. was ready for her passage across to Manila, where she was to load hemp for New York. But as soon as it was evident that she was ready for sea, those men, only newly risen from their bunks of pain, came aft and demanded the usual twenty-four hours’ liberty and a month’s wages. This presented a cruel problem to Captain Jenkins. He was no admirer of the system by which alone among workmen the sailor is kept out of his money for a period sometimes of two years, and then, getting it all in a lump, is liable to be robbed of it in a lump, but he saw a great danger ahead now. These men were obviously unfit to be trusted, for, if he was any judge, he felt sure they would not profit a bit by the awful lesson they had received. But he felt bound to make the attempt, so he said, “Now, men, I am quite aware that a day’s liberty and some money to spend is due to you by the usual custom, and if you are bent upon having it I don’t feel justified in driving you into any foolishness by refusing it. But you know very well how ill you have all been through that filthy liquor you bought so dearly. Now the same kind of stuff is obtainable ashore, and if it drives you mad as it did before, you’ll get locked up and have a very bad time, while I shall lose the services of as good a crew as I’ve ever had. Don’t you think you’d better wait until we get to Manila and have your liberty there? You’ll have had more time to get thoroughly well.” The two Britons at once growled out a reply that they wanted their liberty, and the skipper, looking round upon the rest of them, saw only sullen insistence upon their right in every face, so, angrily, but feeling deeply sorry for the foolish fellows at the same time, he said, “Very well, then, the starboard watch can go ashore to-morrow, and the port watch the day after, Saturday. Come to me in the morning, you starboard watch men, and I’ll give you your liberty money.” The only reply was a series of satisfied grunts, conveying the idea that he had tried to bluff them out of their rights, but he had found he couldn’t do as he liked with them, and so on. So they parted, and the skipper returned to his cabin and held a consultation with his
  • 36. officers on the immediate probability of their having to get a new crew of such wastrels and loafers as Hong-Kong usually affords. Nothing could be done, though, but hope that the men would come aboard again not more than ordinarily drunk; in their then surly condition of mind evidently too much to hope for. Why prolong this pitiful part of my story, the starboard watch went ashore the next morning in the best rig they had, and although they certainly did drop a few of their hard-earned dollars in the curio- shops, it was not long before they got to the bad end of the Queen’s Road, and had commenced an orgie which finally landed them all in the lock-up in a most deplorable condition, the more so because their stamina was still very low. The news was brought off to the skipper, who received it with an outburst of keenest sorrow, and immediately called the port watch aft to hear what had become of their shipmates. And so far from it making any favourable impression upon them, it seemed as if it only spurred their appetite for such fearful joys, and a spokesman stepped forward saying, “I s’pose you ain’t goin’ to stop the port watch’s liberty because the starboard watch ’as got into chokey, sir?” “Since you ask me,” responded the skipper, “that is just what I am going to do. As I told you yesterday, I don’t want to lose a good lot of men like you by giving in to your foolishness, and until I see whether I can get the starboard watch back there’s no beach for you, make up your mind to that. You’re just a pack of fools and idiots, and must be treated as such.” “All right, sir,” answered Micky, “that’s what you say; what I say is that I don’t do another hand’s turn aboard this hooker until I have had my liberty, and my watchmates say the same; don’t ye, boys?” A fierce growl of assent clinched this outburst, and, turning sharply round, the watch went forrard into the fo’c’sle. I must digress for a moment to point out that such an occurrence as this was by no means uncommon in the days I am writing of, twenty years ago, and is certainly not unknown to-day. It serves to show
  • 37. the peculiar character of the “deep water” sailor, and the difficulty of dealing with him. The Sealark was certainly not a bad ship, and the crew were, as we have seen, very good men, but whether it is the sight of land and the thought of its allurements, a sense of irresponsibility, and an impatience of the long confinement, or some such kindred feeling, I know not; I can only say that, incredible as it must appear to landsfolk, men will and do act as I have described without any provocation or other inducement than the prospect of a debauch. And nothing is more likely to stir up this tendency to revolt than the stoppage of liberty for any cause whatever. The next morning the skipper went ashore, having first ascertained definitely that the port watch were firm in their determination to do nothing more unless they had their liberty, he being equally firm in his refusal to grant it to them. He interviewed the authorities, who informed him that his men had been so savage and had so severely injured several Sikh policemen that fines would not satisfy justice, and they must be imprisoned. Then he laid the case of his mutineers on board before them, and it was decided that he must take a posse of police on board and put the mutineers in irons if they still persisted in their refusal and he was determined to take them to sea. So he returned on board with the police, and the foolish men, after being almost implored to be sensible for once, and being told of the condition of their companions, and still remaining obstinate, were ironed and placed in the after part of the ’tween decks with all sorts of evil passions raging in their hearts at what they considered the gross and shameful injustice of their treatment. Then he had to go ashore again, taking with him the effects of the men who were in prison, go through all the formality of paying them off after duly deducting the charges he had been put to, and then go and hunt up some more men. But here he found a difficulty, men appeared to be very scarce, and in the end he was fain to be content with eight Lascars, natives of India, who had been landed as shipwrecked men from a sailing ship. He was distressed about this, but his duty to his owners in the matter of getting the ship away compelled him to leave no stone unturned for that purpose.
  • 38. In the result he sailed on Monday morning with his swarthy recruits doing very well, and the second mate was duly warned not to be too severe in handling them, while the stubborn men down below aft, with a spirit that nothing seemed able to quell, munched their bread and drank their water of affliction and made no sign of being discontented therewith. The ship, being in ballast, was fairly tender, and so he (the captain) did not dare to carry a press of sail to the strong breeze blowing, even had he been efficiently manned. But a smart passage was quite out of the question anyhow, and he felt a glow of satisfaction as he saw how capable were his Lascars and how ardent his two senior apprentices. The two younger boys, unhappily, were neither of them at all adapted for a sea life, and regarded every opportunity afforded them for acquiring practical knowledge as a hardship and an additional outrage upon their already offended sensibilities. Which was a serious loss to them as well as an annoyance to other people. So the passage across progressed most favourably for the willing workers, and Captain Jenkins’ hopes rose high that he should after all be able to make so successful a voyage as would justify his appointment, a matter that is usually, or was usually, a serious consideration for every new-fledged skipper in those days. And to crown his satisfaction, the day before they sighted Luzon the mate came to him and said that the recalcitrant watch confined in the ’tween decks had at last weakened, and expressed a wish to see the skipper. He went down at once, and addressing them said, “Well, men, I hear you have something to say to me. What is it you want to say?” There was an uneasy movement among the pathetic little group, and then the young Welshman, who had been the leader of the party of revolt, said, “Beg ye pardon, cap’n, we’re ready to turn to.” The skipper waited a few moments in case there should be anything else, and then replied, “I’m glad to hear it. Don’t think I’ve had any pleasure in seeing you suffer as you must have done, but if you had
  • 39. gone ashore and behaved as the men of the starboard watch did you’d be far worse off than you are. Now, I want to make a bargain with you. If you’ll only go back to your work, and behave as you did on the passage out, I promise you that neither my officers nor myself will make any difference in our treatment of you from what you received then, treatment that you said you were perfectly satisfied with. More than that, although I have of course entered all this affair up in my official log, I promise you it shan’t be mentioned again or charged against you. But you must not think of going ashore at Manila, and you must treat these Lascars properly whom I have had to engage instead of the starboard watch, and who have behaved splendidly. I’ve put them all on the starboard side of the fo’c’sle so that you needn’t mix, but I will have them treated like men, for they are quite worthy of it. Is it a bargain?” “Yes, sir,” was the simultaneous answer. Whereupon the skipper, raising his voice, shouted, “Mr. Cope, bring the key of these irons. The port watch is resuming duty.” So for once a difficult and dangerous situation was ended in a way entirely satisfactory to all concerned. Alas! the causes where such temporary aberrations of intellect on the part of our sailors have led to widespread misery and awful crime have been only too common. And most of their horrors might have been averted if only those in command had been fully competent and firm. In such a case weakness is a crime, but few there be among men who are judicially convinced of this most fundamental fact or believe that justice impartially administered is the truest mercy; or indeed know what justice is. But I must not pursue this subject further. I would not have trenched upon it now but to show how entirely good was the schooling my hero was receiving thus early in his sea career, as I hope I have shown how capable he was of acquiring the same. Now all was peace and satisfaction on board the Sealark, for the skipper gave orders that the released watch should be furnished with an extra good meal before resuming duty—well he knew how gratefully it would come to men who had been champing the dry
  • 40. biscuit which used to be the sole bread of the sailor. And when they came on deck in the afternoon, eager to take hold again, glad to feel the fresh breeze blowing upon them, and glad also to sniff the briny air, they were delighted to get the order from Mr. Jacks to make sail. They sprang to his call, giving him as much pleasure as his saturnine nature was capable of feeling, for he, like many others of his class, had a positive hatred of niggers, as he called them all without distinction, and preferred the rowdiest, most undisciplined crowd you could find anywhere to a gang of willing, subservient dark men, who had to be pushed and pulled and handled generally like a flock of sheep by a shepherd without a dog. The chief officer, on the other hand, was quite contented with his docile crowd, who not merely did the best they were capable of, but were really good specimens of the seafaring Indians, whose capacity is always highly spoken of by those who have had the opportunity of commanding them. Only twenty-four hours afterwards the good ship Sealark sailed into the bay of Cavité with as favourable wind and weather as could possibly be desired, and anchored off the old city of Manila amid a goodly company of sailing ships of all nations, and one Spanish steamer. Here she lay in the most comfortable quarters, except for the fact that, with the well-known carelessness and freedom from provision on the part of the Spanish authorities, she was left alone for the remainder of the day, until her skipper had almost fretted himself into a fever, knowing well that he dare not go ashore until the authorities had given him permission. But some men are like that, great emergencies find them prepared and able, little things get on their nerves, irritating them almost beyond endurance. I feel, however, that of late I have been letting my favourite slip into the background too much. He has been accorded his proper place in the scheme of things though, occupying as he does an entirely subordinate position in the ship, having a minor part to play, and although playing it extremely well, not being of any supreme importance to any one except his own immediate family and himself. Fortunately Frank was one of those well-balanced youths who was
  • 41. not always dwelling upon his position and wondering whether other people thought as well of him as he deserved. And this freedom from introspection stood him in splendid stead both at this time and afterwards, saving him much mental trouble. As regards his actual duties, I doubt whether he had ever been so happy in his life. For the skipper had rigged a boat with a suit of sails with that loving care that only a good sailor bestows upon a pet hobby. Having made her complete, he asked Frank and Johnson whether either of them knew anything about handling a boat under sail, and Frank, who had been taught at Lytham, after waiting for Johnson’s denial, modestly said he thought he would be able to do so now, having done it before he came to sea. So the skipper, to his intense delight, gave him charge of the boat, with the two junior apprentices to teach also, and set him free of all ship work whatever. It is a good long distance from the anchorage off Manila into the “Canash,” as sailors will persist in calling the carenage, and sometimes there is a very strong breeze, necessitating three reefs, but Frank rose to the occasion and, like a veteran boatman, handled the craft of which he had suddenly been made commander. Moreover he drilled those two slack youngsters ruthlessly, making them dress neatly, keep themselves clean, and practised them at rowing until they behaved themselves in the boat as if they had an object in life. Now there may be better ways of making a boy self-reliant and resourceful than giving him a boat to handle under sail where he is likely to meet with bad weather occasionally, but I do not know of them. And if in addition the boy is passionately addicted to the sport, the rapidity with which he will acquire those qualities to which I have alluded, and others, is amazing. The beauty of boat-sailing is that the novice there learns that difficult art of feeling the direction of the wind, that impalpable force which means so much to the sailing craft in proportion to her size. Hitherto, of course, Frank had been obliged to gather what little knowledge he possessed of how to trim the yards to the wind by
  • 42. what the second mate did while he was at the wheel. Now he was learning practically, finding out how when he jammed her up into the wind she drifted crabwise to leeward, and how he who was not too greedy of stealing to windward, and never let his craft shake a stitch, was sure, so long as he was not lavish, and let her swagger off the wind, to get to windward of those would-be smarties who were always fancying they could reverse the laws of mechanics, and imagining that they could outpoint the wind. Nor was this all. He learned here by practice how the trim of a vessel affects her sailing powers, a law which applies equally to the ship’s boat under sail and the 3000-ton four-master; learned how to dispose of his crew of two to the best advantage, and to study the effect that even their slight weight had upon the weatherly qualities of his boat or her speed with a free wind. Also he learned to command; to give no unnecessary orders, but to have such orders as he did give carried out instanter, or else to visit with condign punishment the slack offender. But there is no doubt that he was heavily handicapped by the character of the two boys placed under his charge. They did nothing willingly. The only thing that appealed to them was fear of a punching from him, or of being reported to the skipper. Ideas of honour, truth, or honesty they had none, and Frank, who could not understand them at all, had to watch them like a warder watching convicts, or, when the boat was waiting at the bund in the Canash for the captain, to exercise constant vigilance lest they should run away into some of the filthy native quarters and get into serious trouble. By all of which I do not mean to suggest that Frank was anything of a prig or a prude. He was essentially a manly boy, with a high sense of trustworthiness, and while, if he were on liberty with fellows of his own class and age, he would doubtless kick up his heels like a young colt in a meadow, yet when in a position of responsibility he was as sternly bent upon doing his duty to the best of his ability as any man old enough to be his father. Of course captain and officers noted
  • 43. this, and enjoyed it quietly, but after the manner of their kind said nothing, only occasionally showing by their actions how much they trusted him. And this only on his second voyage. True they were long voyages, and the circumstances highly educational, but still we must recognise the rapidity with which a lad of Frank’s type will rise, given fitting occasion. The time spent by the Sealark in Manila was almost idyllic in its peace and simplicity. The weather was all that could be desired, the men were most tenderly handled by way of compensation for their enforced abstinence from the dubious delights of what sailors always term “the beach”; and owing to the complete division of the white portion of the crew from the Lascars, there was no friction there either. True, they had never yet been called to work side by side in a position of danger or emergency, but in the daily work of the ship harmony reigned. The ballast was discharged by native labourers, and the hemp began to arrive all in most leisurely fashion, for when did ever a Spaniard hurry except to fight. But the chief thing was that no trouble ensued from either end of the ship; and when at last the flag was run up to show that the last bale of hemp was rammed into its place, and all that now remained was to carry it to New York, although some of the white men forward did certainly look longingly at the shore, there was no word of grumbling at the inevitable decision of the skipper that no leave should be granted. Johnson growled consumedly, telling Frank what a shame he thought it that his junior should be so privileged, just because he possessed a little knowledge of boat-sailing; but Frank speedily appeased him by repeating his asseverations of the absolute unattractiveness of the place, as far as he had been able to see it. Besides, the cholera was raging, and it would have been constructive murder to send fellows ashore on liberty in such a reeking hole. Therefore, without any difficulty whatever, behold the Sealark at daybreak on a lovely Monday morning getting under weigh for her long long passage, her crew singing lustily at the windlass brakes,
  • 44. but without much concord, because the Lascars could not savvy English singing, and yet would try to assist, with the strangest and most unmusical results. The wind blew fair for the passage down the bay, and the men, if not exactly satisfied, were at least resigned to what they considered their loss of the pleasures (?) that Manila could afford. And such good progress did they make that before dusk they had passed out between the heads of the great bay, and saw the island of Luzon fade away like a huge blue-black cloud in the dim and indefinite distance. They got a fine offing, then the wind faltered and died away to a dead calm. The vessel lay listlessly rolling upon the black expanse of waters under a sky of deepest violet, while the stars shone down upon the unreflecting waters like pin-points of white-hot metal without a twinkle. Then a strange transformation took place in that dark, placid sea. It began to be streaked with greenish lambent light in ridges, and little pools of glare appeared to rise from the inscrutable depths, so uncanny that it seemed impossible to give them the name of light. There was also a faint suggestion of rippling sound, as if the silken surface of the ocean were being disturbed by sudden currents. This extraordinary glare grew in intensity, until the awed observers noticed that the lustre of the stars paled to a dead white, and the beautiful violet of the sky, with its soft suggestions of after-glow, became of a velvety blackness, such as those who sail in far northern seas are wont to associate with the middle of the auroral arch. Then through and through the growing whiteness of the sea there began to run bands of brighter light, that marked the passage of the sea creatures as they came and went in their never-ending quest for food. And occasionally a series of ripples, untraceable to any cause, would break against the vessel’s side, lighting it up with a ghostly glare, and reflecting upon the faces of the onlookers with something of the same effect which may be observed in a darkened room from the flare of burning spirit in a dish. This wonderful appearance of the ocean, which is known by the entirely inadequate name among sailors of a “milk sea,” lasted about four hours, and then passed
  • 45. away as suddenly as it had come, with no atmospheric disturbance following it except that there was a gentle breeze sprang up from the northward, which gradually freshened into a wind that carried the good ship along at the rate of five knots an hour directly on her homeward course. And now, as I have the interests of my young readers at heart, I must pass very rapidly over the easy, eventless course of the next fifty days. They were easy days, for the winds blew generally fair if light, and the passage through the Sunda Straits, except for one terrific thunderstorm, was unmarked by any difficulty. The crew were contented, not too hard worked, but still kept fully employed during the watch on deck in the daytime, and the upper gear of the ship was put in as good repair as was possible to conceive of, the white men doing all the sailorising, sail-mending, &c., and the Lascars doing all the cleaning, scraping, &c., which demands not so much manual skill as patience and a complete indifference as to the nature of the work the man is engaged upon, an indifference which it is hard to find among men who put their brains into their work, as good sailors should. So that there was absolutely nothing worth chronicling throughout the passage of the Indian Ocean, and even getting round the Cape was unattended by anything more exciting than a strong wind, not amounting to a gale. The only fact that I am obliged to record is that Captain Jenkins took it into his head to invite Frank and Johnson into the saloon in the second dog-watch to study navigation, and was immeasurably surprised to find that they knew the theory of it almost as well as he did. So he set them to practise with the sextant and chronometer, until, as he declared, they were as well able to navigate a vessel as he was.
  • 46. CHAPTER XII FRANK GETS HIS OPPORTUNITY I hope I have made it clear to my readers that Frank, although now barely seventeen, was a fine specimen of a young man both in physique and in morale or mind. For sheer love of his profession he had learned all that there was to learn about it as far as his opportunities went, and above all he had acquired the habit of self- reliance, which is a mighty factor in advancement at sea. For no matter how clever the man is in theory, if, when the time comes to act, he is ever looking round for some one else to rely upon, has a certain and deep-rooted distrust of himself, that man is debarred from obtaining an early command, or if he does obtain it, he generally loses it painfully soon, because he cannot trust himself. Of course practice is essential to prove theory, however certain we may be of the theory, and Frank as yet had only been able to prove his learning in minor things, such as his boat-handling, his steering, his watching the trimming of the sails, and comparing his working of the ship’s position with the skipper’s when he and Johnson had been allowed to take and work up observations of the sun, moon, and stars. But in spite of his limitations he was far above the average of his years; he already had that steadfast outlook upon the world of his profession, that fearless grasp of its details that go to make up the complete seaman even in these so-called degenerate days, when conditions have so changed that we may, and do, find men of the highest education and refinement in charge of our merchant ships, and especially steamships. However, I must not now spend more space in describing Frank’s mental and physical condition, as I need to get on with the consequences of their high development. The Sealark rolled comfortably along up the pleasant stretches of the south-east
  • 47. Trades, with all hands busily engaged in the commonplace duties of painters and house-decorators. It was an easy, happy time. Captain Jenkins was far too genuine a man, and also far too just, to keep his men out of their honest watch and watch in the senseless Yankee custom. He hated the sight of those dazzlingly white bulwarks, shining black topsides, and glistening spars, knowing how much human agony it represented of absolutely useless and grotesque brutality practised by armed, well- fed officers, upon cowed, bruised, and demoralised men, such as was the rule in the “smart Yankee fliers.” So all hands were happy, cleansed and painted the white work, scraped and varnished the bright work, and did all those minor things that go to make a ship look beautiful, with a meticulous care and pride in her appearance that was quite absurd when you come to look at it, since probably not one of those poor sailors would be in her again either next voyage or afterwards. She glided by St. Helena with its many memories; by Ascension, that naval rock which is borne upon the books of the Admiralty as if it were a man-of-war; on, on, gently, certainly, and almost unknowingly across the line until, in 7° N., the faithful south-east wind faltered at last and left them to wallow in calms for a day or two, watching the dank sea-grass on her bottom spread like a dead woman’s hair as she rolled listlessly on the oily swell. There was little really left to do by this time in the decoration and smartening of the ship internally—that is to say, on deck and aloft, but outside she looked rusty and unkempt, and Mr. Cope cast longing eyes upon his pots of black paint, imagining how splendid a thing it would be if he could only complete his work by spreading them upon her outside. For although it may sound trivial to the ordinary reader, the appearance of his ship to others is a very serious, and, in fact, an all-important matter in the eyes of a good seaman. And when you come to consider it, rightly so, for it reveals the character of those who have had charge of her.
  • 48. But before anything could be done in the matter of external painting, the pleasant north-easterly breeze, the first breath of the Trades, came down upon them, freshened, and in three or four hours from their first feeling it they were bowling merrily along on the starboard tack “full and bye” for New York. The easy home stretch of their voyage, unless indeed they met with abnormal weather in the Gulf Stream, had begun. Frank was already looking forward with pleasurable anticipation to his visit to America’s greatest city, the second greatest in the world, and half wondering to himself how it was that he did not feel annoyance at the thought that he was not bound home direct, as Johnson did. The latter young man was dragged on by the sheer force of Frank’s example, but, as he often said, he had no real love for the profession, and if a chance offered as soon as he was out of his time, he would be content with a very subordinate position ashore rather than ever go to sea as a sailor again. He, like so many others, had discovered too late that he had made a leap in the dark, had mistaken his vocation, could take no pride in his calling despite its many disabilities, difficulties, and dangers, and consequently would never make a good sailor, and would only swell the ranks of the passable and disappointed ones. The days now sped rapidly on as the ship, with every stitch set and drawing, made splendid progress across the Trades, with the wind steadily strengthening as she made northing. But she was barely clear of the tropics when the weight of the wind increased so much that they were fain to reduce sail, much to Captain Jenkins’ disgust, the wind being nearly due east, and consequently allowing him to make his course good going free. He hung on as long as he could, but was gradually compelled to shorten down until the Sealark was tumbling about in a most tremendous sea, hove to under a patch of tarpaulin in the mizzen rigging; and Frank, vivid as were his recollections of the cyclone, felt as if he had never till now realised the deep, steadfast malignity of wind at the height of its power. For it was not squally, its force was persistent, massive, terrible, having in its roar a note of doom.
  • 49. But yet there was an amelioration of the conditions as compared with the lurid horrors of the cyclone. It was light, and often the sky was quite clear until, with a speed that was appalling to witness, a mass of cumulous cloud would hurtle across the ether, torn into a thousand fantastic shapes in its passage. And rage the gale never so furiously, rise the sea never so high, the tiny pretty petrels, Mother Carey’s chickens, still flitted unconcernedly over the mighty corrugations of the deep, even nestling to all appearance in the most perfect confidence under the over-curling head of some awful billow as if it were a shelter from the fury of the storm. And though I suppose he should by this time have lost such a boyish illusion (alas that we should ever lose them), he could not help feeling a renewed confidence in the successful issue of the great fight between ship and sea on witnessing the easeful security manifested by those wee birds. Three days that gale blew, then died away to a gentle series of “cat’s paws,” which failed to steady the ship in the still gigantic upheavals of the so lately tormented deep. One other vessel was in company with them some five miles distant, and as she was behaving strangely to a seaman’s eye, backing and filling and manifesting all the motions of an unmanageable vessel, Captain Jenkins used all his endeavours to get nearer to her. But owing to the lightness and variableness of the wind he was only able to approach sufficiently close by nightfall to make sure that from some cause or another she was really at the mercy of wind and wave. Her masts were intact, and so were the yards, but from them there dangled long streamers as of sails blown away and running gear flying adrift. She was a barque of apparently the same size as themselves, and setting fairly deep in the water, in great contrast to the Sealark, which being loaded with hemp was in excellent trim, not down to her marks by a long way. A very careful watch was kept on her all night, during which the weather was almost perfectly calm. But now and then a light air would come along, which was utilised immediately to get nearer to this mysterious ship, and with such good effect that about two hours
  • 50. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com