Frontend Development with JavaFX and Kotlin: Build State-of-the-Art Kotlin GUI Applications Peter Späth pdf download
Frontend Development with JavaFX and Kotlin: Build State-of-the-Art Kotlin GUI Applications Peter Späth pdf download
https://ebookmeta.com/product/frontend-development-with-javafx-
and-kotlin-build-state-of-the-art-kotlin-gui-applications-peter-
spath/
https://ebookmeta.com/product/pro-android-with-kotlin-developing-
modern-mobile-apps-with-kotlin-and-jetpack-2nd-edition-peter-
spath/
https://ebookmeta.com/product/beginning-kotlin-build-
applications-with-better-code-productivity-and-performance-1st-
edition-ted-hagos/
https://ebookmeta.com/product/pro-spring-6-with-kotlin-an-in-
depth-guide-to-using-kotlin-apis-in-spring-framework-6-1st-
edition-peter-spath/
https://ebookmeta.com/product/her-bare-alien-alien-mating-agency-
book-3-1st-edition-lacey-carter-andersen/
Explainable Artificial Intelligence for Cyber Security
Mohiuddin Ahmed
https://ebookmeta.com/product/explainable-artificial-
intelligence-for-cyber-security-mohiuddin-ahmed/
https://ebookmeta.com/product/adventures-in-improv-quilts-5th-
edition-cindy-grisdela/
https://ebookmeta.com/product/the-gospel-of-juas-iscariot-and-
other-sacred-gospels-2023rd-edition-judas-iscariot/
https://ebookmeta.com/product/organizing-solutions-for-people-
with-adhd-tips-and-tools-to-help-you-take-charge-of-your-
life-3rd-edition-susan-c-pinsky/
https://ebookmeta.com/product/the-materiality-of-magic-an-
artifactual-investigation-into-ritual-practices-and-popular-
beliefs-ceri-houlbrook-editor/
Supramolecular Chemistry on Surfaces 2D Networks and 2D
Structures 1st Edition Neil R. Champness (Editor)
https://ebookmeta.com/product/supramolecular-chemistry-on-
surfaces-2d-networks-and-2d-structures-1st-edition-neil-r-
champness-editor/
Frontend
Development with
JavaFX and Kotlin
Build State-of-the-Art Kotlin
GUI Applications
—
Peter Späth
Frontend Development with JavaFX and Kotlin
Peter Späth
Frontend Development
with JavaFX and Kotlin
Build State-of-the-Art Kotlin GUI Applications
Peter Späth
Leipzig, Sachsen, Germany
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004, U.S.A. Phone 1-
800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media,
LLC is a California LLC, and the sole member (owner) is Springer Science + Business Media Finance Inc. (SSBM Finance
Inc). SSBM Finance Inc. is a Delaware corporation.
For information on translations, please e-mail [email protected]; for reprint, paperback, or audio rights,
please e-mail [email protected].
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also
available for most titles. For more information, reference our Print and eBook Bulk Sales web page at http://www.apress.com/
bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub (https://
github.com/Apress). For more detailed information, please visit https://www.apress.com/gp/services/source-code.
1 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Gradle for JavaFX and Kotlin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
A HelloWorld Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Setting Up for Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Setting Up for IntelliJ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Kotlin and Java Interoperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
A Note About Kotlin Utilities for JavaFX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
A Note About FXML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
A Note About Downloading JavaFX Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Build Setup for This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Why you Should use Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
One-Way and Two-Way Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Custom Bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
About Observable Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3 Stages and Scenes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
About Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Using Stages and the Application Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Dialog-Like Stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
The JavaFX Application Thread . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
About Scenes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Position and Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Cursor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Mnemonic and Accelerators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Node Lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Fill and Other Styles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Mouse Event Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
v
vi Contents
7 Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
What Events Are and Event Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Event Handlers and Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Drag and Drop Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
8 Effects and Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
About Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Animating Your Scenes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Timeline Animations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
9 Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
The JavaFX Concurrency Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
About Kotlin Coroutines for JavaFX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
About the Author
Peter Späth graduated in 2002 as a physicist and soon afterward became an IT consultant, mainly for
Java-related projects. In 2016, he decided to concentrate on writing books on various aspects, but with
a main focus on software development. With two books about graphics and sound processing, three
books on Android app development, and a couple of books about Java, Jakarta EE, and Kotlin, Peter
continues his effort in writing software development-related literature.
ix
About the Technical Reviewer
xi
Introduction
Building elegant and highly responsible, responsive, and stable Java client applications (fat clients)
is a highly acceptable approach if security considerations or network availability speaks against
web applications, or maintaining servers and server applications lies out of scope for your project.
Additionally, using Kotlin as a programming language boosts code expressiveness and maintainability,
allowing for a development yielding a clean code approach.
The book introduces JavaFX as a frontend technology and from the very beginning focuses
on using Kotlin instead of Java for coding the program artifacts. Many listings and code snippets
accompany the text, readily allowing for a hands-on learning style.
The book is for low- to mid-level Java or Kotlin developers with or without JavaFX experience,
wishing to learn how to build JavaFX applications with Kotlin.
The readers will in the end be able to use Kotlin as a language for building basic to moderately
advanced and elaborated apps targeting JavaFX.
Any experience in using JavaFX and frontend coding is not a requirement for reading the book.
Being a Kotlin expert is not necessary either, but having read introductory-level books or studied
online resources is surely helpful. The online documentation of Kotlin and JavaFX also provides
valuable resources you can use as a reference while reading this book.
Source Code
All source code shown or referred to in this book can be found at github.com/apress/frontend-
development-javafx-kotlin.
This book should be read sequentially to get the most benefit from it. Of course, you can skip one
or the other chapter if you already gained knowledge elsewhere. Taking its introductory nature, the
book is not meant to present a reference fully covering each and every aspect of Kotlin frontend
programming or JavaFX, so also consulting the online documentation at
https://openjfx.io/
https://openjfx.io/javadoc/19/
https://kotlinlang.org/docs/home.html
xiii
xiv Introduction
while you are reading the book certainly is not a bad idea.
The book is split up into nine chapters. Chapter 1 gives a general introduction and presents hello
world-style programs for Gradle, Eclipse, and IntelliJ.
Chapter 2 talks about using properties as data holders and addresses one- and two-way binding
techniques for connecting controls and data in your program.
Chapter 3 introduces stages and scenes, which serve as primordial containers for visual artifacts.
Chapter 4 talks about containers and ways to lay out and style your scenes.
Chapter 5 handles nodes and controls including styling. These aspects usually constitute the biggest
part of your project work speaking of time budget.
Chapter 6 presents lists and tables, which are particularly important for enterprise-level projects.
Chapter 7 is for summarizing and deepening our knowledge about event handling in JavaFX. This
also includes drag and drop procedures.
Chapter 8 introduces effects and animation, improving user experience and giving your programs
some eye candies.
As a prospect, Chapter 9 briefly introduces concurrency techniques, giving you a starting point for
handling background processing needs.
Getting Started
1
In this chapter, we give a brief introduction to using JavaFX and Kotlin together, and we create “Hello
World”–style projects for the command line, for Eclipse, and for IntelliJ IDEA.
Introduction
JavaFX is the dedicated fat client (desktop application) GUI toolkit for current Java releases. It is
the replacement and successor of the venerable Java Swing technology. This switch happened around
2010, and since then JavaFX has been constantly improved and extended. With JREs up to version
JDK 9, JavaFX was part of the Java distribution—with JDK 11 and later, it has to be installed
separately.
The following features describe JavaFX:
. Built-in controls: Labels, editable text fields, buttons, combo boxes, checkboxes, radio buttons,
menu bars, scrollbars, accordion, tabs, canvas (for drawing shapes and figures), color picker, pag-
ination, 3D graphics (games, science, product presentation), WebView (presenting and interacting
with web contents), dialogs, sliders, spinners, progress bars
. Lists, tables, trees
. Built-in layouts: AnchorPane (anchoring nodes to one of the edges or to the center point),
BorderPane (placing nodes at bottom, top, right, left, center), FlowPane (placing nodes consec-
utively and wrapping at the boundaries), TilePane (same as FlowPane, but with all cells the same
size), GridPane (placing nodes in a grid with cell sizes dynamically calculated and on demand
spanning several rows and columns), VBox (placing nodes in columns), HBox (placing nodes in
rows), StackPane (placing nodes in an overlay fashion)
. Animation (fade, fill, stroke, translate, rotate, scale, . . . ), effects (glow, blend, bloom, blur,
reflection, sepia, shadow, lighting)
. Nodes stylable via CSS
. Some built-in chart widgets
. Flexible and concise data binding via observable properties
. Descriptive layouting via FXML
. Module support (for JDK 9+)
© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023 1
P. Späth, Frontend Development with JavaFX and Kotlin,
https://doi.org/10.1007/978-1-4842-9717-9_1
2 1 Getting Started
In this book, we describe a subset of these features, giving you a starting point for your own
projects.
Using Kotlin as a programming language instead of Java gives a boost to your coding experience.
Just to give you an example, consider a button with a click handler. In Java, you’d write
Button btn = new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
With 142 characters, this is more than 40% shorter than the Java variant! And besides being shorter,
it is also more expressive and by that easier to understand and easier to maintain.
Using some sufficiently nonobtrusive utility functions, this can even be further reduced to 81
characters in size:
val btn = Button("Say 'Hello World'") {
println("Hello World!")
}
As a build tool, we use Gradle from https://gradle.org/. It is highly flexible, works on any operating
system that provides a Java installation, and by means of plugins or preinstalled components can be
operated from many IDEs.
I first describe the CLI mode for running Gradle builds. This is how you would use it in a server
environment, but it also serves as a good starting point if you want to learn how to use Gradle inside
an IDE workflow.
If not already present, get and install a version 17 JDK. Throughout the book, we will be using
OpenJDK 17, but if chances are good you can also take Oracle’s supported JDK 17 or a higher version
from either Oracle or https://openjdk.org/ without any problems possibly coming up.
Gradle for JavaFX and Kotlin 3
Note Using Oracle’s JDK 17 or higher requires buying a license if you plan to use it for a longer
term; see www.oracle.com/java/.
As a next step, fetch Gradle from https://gradle.org. In this book, we use version 7.6 from https://
gradle.org/next-steps/?version=7.6&format=bin. In order to announce Java to Gradle, either make
sure java and javac (with .bat extension on Windows) are in your PATH, or you have the
environment variable JAVA_HOME point to your JDK installation folder (recommended). To simplify
using Gradle, you can also put GRADLE-INST-DIR/bin (with GRADLE-INST-DIR pointing to your
Gradle folder), or GRADLE-INST-DIR\bin for Windows, on the path.
Note In Linux, environment variables like PATH or JAVA_HOME get set via
export PATH=/bin:/usr/bin:/path/to/my/gradle/bin.
In Windows, you must use the system settings dialog.
Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on
July 10 2021
JVM: 17.0.1 (Oracle Corporation 17.0.1+12-39)
OS: Linux 5.15.0-56-generic amd64
Important is the “JVM:” line. The Kotlin version shown does not mean you would not be able to build
applications running under a different Kotlin version—it just tells it is using Kotlin 1.7.10 for its own
purposes.
Next, create a project folder anywhere on your system. For our example project, we call it
HelloWorld. Change into that folder:
cd /path/to/HelloWorld (Linux)
chdir C:\path\to\HelloWorld (Windows)
You can also enter just gradle init, but then you will subsequently be asked for project
coordinates inside the terminal.
4 1 Getting Started
The “init” task creates a simple scaffold project which consists of a main project described by
file settings.gradle and a subproject called “app” in the accordingly named subfolder. The
application can be run by just entering either of
gradle app:run
gradle run
The second variant is possible, because there is just one subproject. By the way, you can list all
possible tasks via gradle tasks or gradle tasks --all, and entering gradle help shows
more info.
Did you notice that two executable files gradlew and gradlew.bat and a folder gradle were
created? This is the Gradle Wrapper, and it is a Gradle installation on its own, and you can henceforth
use it to build the project. Just use gradlew from the wrapper instead of gradle from the Gradle
distribution. You can even delete the main Gradle installation folder at this time, if you like.
It is now time to add JavaFX to the project. In Gradle, the build.gradle file is the main
configuration file for the build process. You can find it inside the app subproject inside the app folder.
Open the file inside a text editor, and inside the plugins { . . . } section, add
plugins {
...
id 'org.openjfx.javafxplugin' version '0.0.13'
}
This plugin adds almost all that is necessary to add JavaFX to a Java or Kotlin project. Kotlin
capabilities were already added during gradle init. We however still need to make sure that
Kotlin compiles for JDK 17 and that JavaFX uses version 19 and allows for using the modules
“javafx.controls” and “javafx.graphics”. For that aim, add at the end of build.gradle
compileKotlin {
kotlinOptions {
suppressWarnings = true
jvmTarget = "17"
}
}
javafx {
version = "19"
modules("javafx.controls", "javafx.graphics")
}
Note JavaFX is separated into different modules. The modules “javafx.base”, “javafx.controls”, and
“javafx.graphics” are essential to almost any JavaFX application. Because both the controls and the
graphics module require the base module, the latter gets implicitly included in any build and can be
omitted from the modules list. For more details, see https://openjfx.io/javadoc/19/
In the next section, we code our little “Hello World” JavaFX with Kotlin application.
A HelloWorld Project
The scaffold project built via gradle init just prints “Hello World!” on the console if run. As a
starter JavaFX project, we instead want to show a little window with a button on it reacting to press
events. To do so, replace the contents of
app/src/main/kotlin/book/kotlinfx/App.kt
Exploring the Variety of Random
Documents with Different Content
elbows resting upon her knees, and her chin upon her thumbs. The
Baron started: the remembrance of his interview with a similar
personage in the same place some three years since, flashed upon
his recollection. He rushed towards the spot, but the form was gone;
—nothing remained but the seat it had appeared to occupy. This, on
examination, turned out to be no stone, but the whitened skull of a
dead horse!—A tender remembrance of the deceased Grey Dolphin
shot a momentary pang into the Baron's bosom; he drew the back
of his hand across his face; the thought of the hag's prediction in an
instant rose, and banished all softer emotions. In utter contempt of
his own weakness, yet with a tremor that deprived his redoubtable
kick of half its wonted force, he spurned the relic with his foot. One
word alone issued from his lips, elucidatory of what was passing in
his mind,—it long remained imprinted on the memory of his faithful
followers,—that word was "Gammon!" The skull bounded across the
beach till it reached the very margin of the stream;—one instant
more, and it would be engulfed for ever. At that moment a loud "Ha!
ha! ha!" was distinctly heard by the whole train to issue from its
bleached and toothless jaws; it sank beneath the flood in a horse
laugh!
Meanwhile Sir Robert de Shurland felt an odd sort of sensation in his
right foot. His boots had suffered in the wars. Great pains had been
taken for their preservation. They had been "soled" and "heeled"
more than once;—had they been "goloshed," their owner might have
defied Fate! Well has it been said that "there is no such thing as a
trifle." A nobleman's life depended upon a question of ninepence.
The Baron marched on; the uneasiness in his foot increased. He
plucked off his boot;—a horse's tooth was sticking in his great toe!
The result may be anticipated. Lame as he was, his lordship, with
characteristic decision, would hobble on to Shurland; his walk
increased the inflammation; a flagon of aqua vitæ did not mend
matters. He was in a high fever; he took to his bed. Next morning
the toe presented the appearance of a Bedfordshire carrot; by
dinner-time it had deepened to beet-root; and when Bargrave, the
leech, at last sliced it off, the gangrene was too confirmed to admit
of remedy. Dame Martin thought it high time to send for Miss
Margaret, who, ever since her mother's death, had been living with
her maternal aunt, the abbess, in the Ursuline convent at Greenwich.
The young lady came, and with her came one Master Ingoldsby, her
cousin-german by the mother's side; but the Baron was too far gone
in the dead-thraw to recognise either. He died as he lived,
unconquered and unconquerable. His last words were—"Tell the old
hag she may go to——." Whither remains a secret. He expired
without fully articulating the place of her destination.
But who and what was the crone who prophesied the catastrophe?
Ay, "that is the mystery of this wonderful history."—Some say it was
Dame Fothergill, the late confessor's mamma; others, St. Bridget
herself; others thought it was nobody at all, but only a phantom
conjured up by conscience. As we do not know, we decline giving an
opinion.
And what became of the Clerk of Chatham?—Mr. Simpkinson avers
that he lived to a good old age, and was at last hanged by Jack
Cade, with his inkhorn about his neck, for "setting boys copies." In
support of this he adduces his name "Emmanuel," and refers to the
historian Shakspear. Mr. Peters, on the contrary, considers this to be
what he calls one of Mr. Simpkinson's "Anacreonisms," inasmuch as,
at the introduction of Mr. Cade's reform measure, the Clerk, if alive,
would have been hard upon two hundred years old. The probability
is, that the unfortunate alluded to was his great-grandson.
Margaret Shurland in due course became Margaret Ingoldsby, her
portrait still hangs in the gallery at Tappington. The features are
handsome, but shrewish, betraying, as it were, a touch of the old
Baron's temperament; but we never could learn that she actually
kicked her husband. She brought him a very pretty fortune in chains,
owches, and Saracen ear-rings; the barony, being a male fief,
reverted to the Crown.
In the abbey-church at Minster may yet be seen the tomb of a
recumbent warrior, clad in the chain-mail of the 13th century.[5] His
hands are clasped in prayer; his legs, crossed in that position so
prized by Templars in ancient, and tailors in modern days, bespeak
him a soldier of the faith in Palestine. Close behind his dexter calf
lies sculptured in bold relief a horse's head; and a respectable
elderly lady, as she shows the monument, fails not to read her
auditors a fine moral lesson on the sin of ingratitude, or to claim a
sympathising tear to the memory of poor "Grey Dolphin!"
FOOTNOTES:
[2] I-run, is a town said to have been so named from something of this sort.
[3] One of the uses to which this mystic chandelier was put, was the protection of
secreted treasure. Blow out all the fingers at one puff and you had the money.
[4] Since the appearance of the first edition of this Legend "the guns" have been
dismounted. Rumour hints at some alarm on the part of the Town Council.
[5] Subsequent to the first appearance of the foregoing narrative, the tomb
alluded to has been opened during the course of certain repairs which the church
has undergone. Mr. Simpkinson, who was present at the exhumation of the body
within, and has enriched his collection with three of its grinders, says the bones of
one of the great toes were wanting. He speaks in terms of great admiration at the
thickness of the skull, and is of opinion that the skeleton is that of a great patriot
much addicted to Lundy-foot.
It is on my own personal reminiscences that I draw for the following
story; the scene of its leading event was most familiar to me in early
life. If the principal actor in it be yet living, he must have reached a
very advanced age. He was often at the Hall, in my infancy, on
professional visits. It is, however, only from those who "prated of his
whereabouts" that I learned the history of his adventure with
THE GHOST.
There stands a City,—neither large nor
small,
Its air and situation sweet and pretty;
It matters very little—if at all—
Whether its denizens are dull or witty,
Whether the ladies there are short or
tall,
Brunettes or blondes, only, there
stands a city!—
Perhaps 'tis also requisite to minute
That there's a Castle and a Cobbler in it.