Abstract Windowing Toolkit (AWT), 413
Accelerator() method, 562
AcceptChanges() ActionPerformed() method, 688
Android
application components, 729–730
application events and activity changes
activity class, 724
activity process life cycle, 726–727
android:onClick attribute, 726
DisplayInformation activity, 727
displayInformation.xml, 728
onClick(View) method, 726
OnClickListener method, 726
performAction() method, 724–726
putExtra() method, 727
startActivity(Intent) method, 727
swing-like action listeners, 725
XML tag attributes, 726
application-specific privileges, 743–744
basic application
android.app.Activity, 712
dialog box, 711
doWork() method, 713
Hello World view, 712
java.util.Date object, 713
layout folder, 712
LinearLayout, 712
main.xml file, 712
res folder, 712
Swing development, 712
todaysDate.java code, 710
compiling and testing, 713–714
development environment
add-ons repository, 709
android development toolkit, 707
android repository option, 709
documentation, 709
download and installation, 707
IDE and ADT, 708
plug-in installation, 708
update manager feature, 708
incoming call events
android.content.BroadcastReceiver class, 732
android:name attribute, 733
AndroidManifest.xml file, 731
AndroidManifext.xml file, 733
getExtras() method, 732
normal broadcasts, 732
onReceive method, 732
ordered broadcasts, 732
SMS, 732
tabbed user interface, 737android.app.TabActivity class, 733
android:configChanges attribute, 739
android:drawable attributes, 738
android:launchMode attribute, 739
EnterInformation activity, 738
enterinformation.XML file, 735
FrameLayout> tag, 739
<LinearLayout> tags, 739onCreate(Bundle) method, 738
setIndicator(CharSequence, Drawable) method, 738
setupTabs() method, 738
state-list drawable, 737
TabContainer.java file, 734–735
TabController activity, 739
<TabHost> container, 739TabHost instance, 738
tabs.xml file, 735
user interface construction, without XML file
android.app.Activity, 723
edittext widget, 723
Java Swing user interface, 722
onCreate(Bundle) method, 723
setContentView() method, 723
Spinner widget, 723
user interface construction, XML file, 715–716activity class, 714, 719
android.app.Activity, 716
android.widget.spinner widget, 718
android:id attribute, 719
android:layout_height attribute, 719
android:layout_width attribute, 719
android:onClick attribute, 720
android:text attribute, 719
AndroidManifest.xml, 720
application resources, 717–718
application screens, 716
<Button> tag, 719drop-down list, 718
EnterInformation, 716
findViewById(int) method, 718
initialization code, 717
LinearLayout tag, 719
onCreate(Bundle) method, 716
onPause() method, 716
R class, 717
R.id.spinner static integer, 718
R.layout.enterinformation file, 717
setContentView(int) method, 717
<Spinner> tag, 719
strings.xml file, 720
templates, 719
user interface screen, 720
web pages
getSettings() method, 741
onReceivedError method, 742
setJavaScriptEnabled() method, 741
ViewSite, 741
WebChromeClient subclass, 742
Window.FEATURE_PROGRESS feature, 741
Antialiasing technique, 335
Applets, 651
ActionListener interface, 688
actionPerformed() method, 688
AWT layout manager, 688
draggable applets creation, 693, 694
FirstApplet subclass, 687
init() method, 687
JApplet, 687
packaging and web page embedding
<applet> tag, 692
CLASSPATH, 691
deployJava.js file, 691
FirstApplet.jar file, 689, 690
HTML page creation, 689
Invoke Deployment Toolkit, 689
JNLP files, 692
name/value pairs, 691
setVisible() method, 689
swing components, 704
invokeAndWait method, 705
javax.swing.JApplet class, 699–702
mailapplet, 699
Runnable() method, 705
SwingUtilities.invokeAndWait method, 704–705
text button and label, 685–686
Application.launch() method, 523
AuthorWorkCachedRowSet, 300
Automatic resource management (ARM), 136
Binary large objects (BLOBs), 311
Bind() method, 540
BookAuthorsCachedRowSet, 300
Branch group nodes, 400
Build() method, 531
Builder class, 531
CachedRowSet
acceptChanges() method, 294
connection properties, 293
CreateConnection class, 293
execute() method, 293
executeQuery() method, 293
fetching methods, 294
insertRow() method, 294
main() method, 289
moveToCurrentRow() method, 294
moveToInsertRow() method, 294
output, 292
RowSetFactory, 293
setCommand() method, 293
setKeys() method, 293
SyncResolver object, 294
updateRow() method, 294
calculateDaysPlayed() abstract method, 178
cancel() method, 559
ChangeListener, 559
Character large object (CLOB)
BLOBs, 311
ClobgetString() method, 311
ConnectioncreateClob() method, 311
executeUpdate() method, 311
getAsciiStream() method, 311
loadClob() method, 311
loading and querying code, 308–310
PreparedStatement setClob() method, 311
setString() method, 311
VARCHAR fields, 311
Character streams and buffers conversion
arbitrary byte-oriented encoding, 255
CharBuffer instance, 257
Charset argument, 256
CharsetEncoder and CharsetDecoder class, 257
IANA Charset Registry, 257
InputStreamReader method, 255
newEncoder() and newDecoder() method, 256
OutputStreamWriter method, 255
CheckMenuItem, 540
ClobgetString() method, 311
close() method, 320
ComputeValue() method, 546, 550
Concurrency
collections helper class, 191
CopyOnWriteArrayList, 190
different collections coordination
atomic operation, 194
fulfillorder() method, 192, 193
inventoryLock.lock() method, 193
inventoryLock.unlock() method, 193–194
lock.unlock() method, 195
locking, 195
ReentrantLock object, 195
setFair property, 195
run() method, 186
runnable interface, 185
startUpdatingThread() method, 190
synchronizedList() method, 191
threads, 186
await() method, 203
awaitTermination() method, 196
blockingQueue queue, 201
CorePoolSize, 197
inventoryThread.join() method, 200, 203
JVM's thread scheduler, 201
KeepAliveTime, 197
MaximumPoolSize, 197
objectToSync, 202
prestartAllCoreThreads() method, 197
processOrder() method, 198, 199
Queue, 197
shutdown() method, 197
ThreadpoolExecutor instance, 196
TimeUnit, 197
wait() method, 202
WorkQueue, 197
threadsafe sbjects
user and daemon user thread, 186
Connection management
Connection object, 271
CreateConnection class, 271–74
CreateConnection.java, 271
DataSource, 275
db_props.properties, 274
strategic connection methodology, 274
ConnectioncreateClob() method, 311
CreatePlayer(String) method, 151
cs.getString(1) method, 319
Data manipulation language (DML), 270
Data structures
code execution
control flow statement, 84
isValidSwitchType() method, 83–84
private static void playHands, 82
private static void printWinner, 82
public class, 81
public static void main, 82
RockPaperScissors class method, 85
switch statement, 81
SwitchTypeCheckerisValidSwitchType() method, 85
dynamic arrays
arrayList, 98
List<String> method, 98
output, 97
public static boolean screen, 96
public static void screen, 96
StockScreener class method, 96
StockScreener main() method, 98
void main, public static, 96
fixed set constant
abstract and finaljava.lang.Enum class, 76
compiler error or warning, 75
encapsulate constants, 75
enum type, 74
equals() method, 76
FieldType.EMAIL_ADDRESS coding, 74–75
name() method, 76
ordinal() method, 76
values() and valueOf(String) method, 76
fix-sized arrays
Arrays.toString(int[]) method, 90
GradeAnalyzer main() method, 90
initGrades1() method, 90
initGrades2() method, 90
initGrades3() method, 90
min and max grade, 89
object type array, 88
output,GradeAnalyzer class, 87
steps, defining array, 88
generic types
aList.add((Integer)aNum) method, 92
collection interfaces and classes, 91
Collection removeAll() method, 94
compile-time feature, 91
diamond, 94
LinkedList<Double> method, 93
LinkedList<Integer>, 93
List<String>>bMap method, 95
Listadd(E e)method, 92
ListrawList, 92
public interface List, 91
wildcard, 93
intelligent constants design
email address, 77
FieldType enum method, 77
FieldType instances, 80
main() method, 80
password, 77
phone number, 78
validate() method, 80
iterable objects
add(List<Stock>) method, 101
collection-based class, 99
main() method, 100
Mapvalues() method, 101
remove() method, 101
StockPortfolio method, 99, 100
UnmodifiableIterator class, 101
Databases, 259
array value retrieval
BigDecimal type, 317
data structures, 315
getArray() method, 317
java.sql.Array object, 315, 317
NUMBER data type, 315
PreparedStatement getArray() method, 317
results, 316
array value storage
ArrayDescriptor, 314
AUTHOR_RECIPES table, 312, 314
CHAP_LIST_TYPE, 312
chapterArray, 314
executeUpdate() method, 314
java.sql.Array, 312
storeArray() method, 314
automatic resource handling, 319–20
connection
CLASSPATH, 261
connection object, 262
datasource registration, 262
DriverManager object, 261
getConnection() method, 259–60
InitialContext, 262
java.naming.NamingException exception, 262
java.sql.Connection object, 261
java.sql.SQLException, 262
JDBC Connection object, 259
management. See Connection management
ojdbc6.jar JAR file, 261
create_database.sql script, 259
create_user.sql script, 259
CRUD operations
vs. DML, 270
executeQuery() method, 270
executeUpdate() method, 270
format, 270
performCreate() method, 270
performDelete() method, 271
performRead() method, 270
performUpdate() method, 270
result, 270
statement executeQuery() method, 270
data caching, disconnected state. See CachedRowSet
FilteredRowSet
evaluate() methods, 306
executeQuery() method, 307
FilteredRowSetImpl, 307
implementFilteredRowSet() method, 303, 307
main() method, 303
RowSet, 306
setCommand() method, 307
setFilter() method, 307
JoinRowSet
addRowSet() method, 300
AUTHOR_WORK table, 299
BOOK_AUTHOR table, 299
foreign key, 295
getInt() method, 300
getString() method, 300
joinRowQuery() method, 300
main() method, 299
output, 299
primary key, 295
queryAuthorBook() method, 300
queryBookAuthor() method, 300
RowSet, 295
SQL JOIN query, 299
large object query and storage. See Character large object
query and result retrieval
connection object, 265
executeQuery() method, 265
java.sql.Connection object, 264
java.sql.SQLException, 266
next() method, 265
ResultSet getInt() method, 265
ResultSet getString() method, 265
ResultSet object, 264
rs.next(), 265
statement object, 264
System.out() method, 265
scrollable ResultSet
constants, 286
createStatement() method, 285
forward and backward traverse, 284
PreparedStatement object, 286
prepareStatement() method, 285
record retrieval code, 286
SQL injection protection. See PreparedStatements
stored procedure invoking, 317–319
transaction
autoCommit() preference, 280
commit() method, 280, 283, 284
insertRecord() method, 284
main() method, 283
sequential processing, 280
setAutoCommit() method, 283–284
TransactionExample class, 280, 283
updatable ResultSet
code, 287
concurrency, 288
createStatement() method, 288
PreparedStatement method, 288
prepareStatement() method, 288
ResultSet.CONCUR_UPDATABLE constant, 288
Statement object, 288
TYPE_SCROLL_SENSITIVE, 288
updateRow() method, 289
updateString() method, 288
updateXXX() methods, 288
Date
Calendar add() method, 62
Calendar.getInstance() method, 60
compareTo() method, 60
days, months, and years, 61–63
formatting
calendar object, compare results, 69
java.text.SimpleDateFormat class, 66
pattern characters, 67
getDay() method, 60
getHours() method, 60
getMinutes() method, 60
getMonth() method, 60
getSeconds() method, 60
getTimeInMillis() method, 64
getTimezoneOffset() method, 60
getYear() method, 60
java.util.Calendar class, 58
java.util.concurrent.TimeUnit enum, 63
java.util.Date class, 58
setTime() method, 60
static int calendar fields, 63
TimeUnit enum, 64
TimeUnit.MILLISECONDS, 65
toHours() method, 65
Debugging and unit testing, 213
classes, lock down, 216
annotation, definition, 216
Assert.assertEquals method, 216
JUnit, 214
Emma code coverage
.class files, 222
definition, 222
instrumentation, 222
Exception's StackTrace() method, 213
memory leak spots
class breakdown, VisualVM, 231
createdWindows Set, 233
heap dump, 229
int[] array, 232
JFrames, 232
memory consumption, 229
memory dump, 229
scripting
Apache Ant program, 219
build.path, 219
build.xml file, 218
JAVA_HOME environment variable, 217
JDK installation, 217
JUnit + Ant configuration, 216
StackTrace() output, 214
Document object model (DOM), 618
doFilter() method, 673
DoubleBinding class, 546
DriverManager.getConnection() method, 261
DropShadow object, 532
DUMMY_FUNC, 319
DUMMY_PROC, 318
authenticator object, 781
getPasswordAuthentication() method, 781
javax.mail.Session, 781
mail.smtp.host property, 781
MessageAuthenticator, 781
Properties object, 781
standard Map object, 781
Transport() methods, 780
Transport.send() static method, 781
Event dispatching thread (EDT), 385, 558
Event driven architecture (EDA), 644
EventHandler class, 554
execute() method, 293
executeQuery() method, 265, 270, 279, 293, 319
executeUpdate() method, 270, 271, 279, 311
FXCollections class, 553
getAsciiStream() method, 311
getConnection() method, 261
getCurrencyInstance() method, 251, 252
getItems() method, 540
GridPane class, 542
handle() method, 554
Heap dump, 229
HelloWorld application
command-line prompt
compilation and running, 522
directory structure, 522
Group class, 523
javac -d . HelloWorldMain.java, 522
JavaFX application package and deployment, 522
javafx.application.Application class, 523
main() method, 523
node, 523
Scene object, 523
Shape objects, 523
show() method, 523
Stage object, 523
start() method, 523
NetBeans IDE
Group class, 523
JavaFX project creation wizard, 522
javafx.application.Application class, 523
main() method, 523
node, 523
Run Main Project menu option, 522
runtime libraries, 522
Scene object, 523
Shape objects, 523
show() method, 523
source/binary format, 522
Stage object, 523
start() method, 523
initModality() method, 578
initOwner() method, 578
insertRecord() method, 284
insertRow() method, 294
Java 2D graphics
complex shapes, 352
control point, 353
cubic curve, 353
CubicCurve2D.Float constructor, 353
ice cream cone, 353
Path2D, 350
QuadCurve2D, 350
quadratic Bézier curve, 350
quadratic parametric curve, 354
subtract() method, 354
displayGUI(), 323
filling shapes, 340
fill() method, 338
rectangle shape, 342
round rectangle, 342
setPaint() method, 338
shape stroke, 341
smooth rendering, 340
image drawing and loading
diamond operator notation, 386
doInBackground() method, 386
done() method, 386
drawImage() methods, 387
EDT, 385
ImageIO.read() method, 386
javax.imageio.ImageIO, 382
javax.swing.SwingWorker, 382
publish() and process() methods, 386
SwingWorker class, 386
interactive shapes
instance variables, 362
java.awt.geom.QuadCurve2D object, 355
mouseDragged() method, 361
mouseMoved() method, 361
mousePressed() method, 361
paintComponent() method, 362
QuadCurve2D, positioning handles, 360
quadratic curve shape, 361
javax.swing.JComponent component, 323
javax.swing.JFrame, 323
lines drawing, 328
80/20 rule, 328
background color, 329
basic steps, 328
basicssstroke constructor parameters, 330
clearRect() method, 329
draw() methods, 331
drawing, 328
java.awt.BasicStroke, 326, 330
java.awt.Color, 326
JComponent class, 328
Line2D.Double class, 330
paint color setting, 329
paintComponent() method, 328
painting, 328
Pareto principle, 328
super.paintComponent(g), 328, 329
main() method, 323
paintComponent() method, 323
shape drawing
antialiasing technique, 335
arc, ellipse, rectangle, and rounded rectangle, 332–333
Arc2D Double classes, 335
Arc2D float constructors, 336
Arc2D.Float instance, 337
bounding box, 336
code snippet, 335
code statements, 338
default rendering algorithms, 335
DrawShapes recipe, 334
Ellipse2D class, 338
java.awt.Color.Black, 335
java.awt.Shape, 331
open, chord, and pie arc types, 337
rendering hint, 335
setRenderingHints() method, 335
transforms, 335
translate, 335
translate() method, 337
SimpleAppLauncher.java, 321–323
SimpleAppLauncher.launch() method, 323
SwingUtilities.invokeLater() method, 323
text, multiple line display, 372–375
Java 7
addNumbers() method, 17
arguments and returning values, 19–21
downloading and installing, 1–3
multiplyNumbers() method, 17, 19
private modifier, 18
public modifier, 18
Java exceptions
AutoCloseable interface, 136
error class, 127
FileHandler pattern, 143
hierarchy, 128
IllegalArgumentException class, 138
InvalidUsernameException, 128
java.util.logging.LogManager(), 140
loadLogConfiguration() function, 140
Log0.log file code, 142
Logger.isDebugEnabled(), 143
logging Levels, 141
recipeLogger event, 139
rethrowing, 138
RuntimeException class, 128, 137–138
SocketHandler, 142
try-with-resources block, 136
Java networking, 805
accept() method, 810
communicateWithClient() method, 811
createConnection() method, 807
DatagramChannel class, 813–815
DatagramChannelconfigureBlocking(boolean) method, 817
flip() method, 817
in.readLine() method, 808
InetSocketAddress instance, 816–817
infiniBand, gain performance boosts, 811–813
InputStreamReader instance, 811
java.net.ServerSocket, 808–809
MulticastChannel interface, 816
NetworkInterface, 816
PrintWriter object, 811
run() method, 817
send() method, 818
server-side application, 808
TCP/IP layer, 807
testConnection() method, 808
UDP, 816
URL. see URL
Java Platform Manager, 518, 519
Java virtual machine (JVM), 1
java.io.Closeable interface, 320
java.lang.Autocloseable API, 320
java.sql.Connection object, 263
java.sql.PreparedStatement object, 275
java.sql.SQLException, 261
java.util.ArrayLists, 553
Java3D, 397
3D object creation
color cube object, 398
nodes types, 400
platform view, 399
SimpleUniverse, 399
universe hierarchy, 399–401installation, 397–398
appearance class, 410
influencing bounds, 412
shade model, 411
space game, 412
object transformation, 402–403
animating shapes
anchorPt variable, 601
Java classes, 598
javafx.scene.shape.Path object, 601
mouse-pressed event, 602
mouse-released event, 602
onFinished property, 601
onMouseXXXProperty methods, 602
PathTransitionBuilder class, 601
RadialGradient, 601
scene graph, 601
animation generation
API, 589
compound transition, 593
cycle count and auto-reverse attributes, 594
EventHandler<ActionEvent> object, 596
fade in and out button controls, 589, 592
fade transitions, 593, 596–597
fade-in effect, 597
getChildren().add() method, 595
getKeyFrames().add() method, 594
gotoImageIndex() method, 596
handle() method, 597
Javadoc, 594
javafx.animation.Interpolator, 596
javafx.util.Duration, 594
KeyFrame, 594
KeyValue, 594
node's property, 594
picture, fade in and out, 591–592
play() method, 596
previous and next buttons, 593
RectangleBuilder, 595
SequentialTransition, 596
setClip method, 595
setFromValue() and setToValue() methods, 597
setOnFinished() method, 596
standard attributes, 594
ticker control, 589–591, 593–595
timeline, 594
transitionByFading() method, 596
TranslateTransitionBuilder, 595
translating and fading, 593
translation transition, 593
background process
classes, 554
controls, 558
createWorker() method, 558
EDT, 558
queue up, 558
SwingWorker object, 558
binding expressions
computeValue() method, 546, 550
console application code, 546–549
javafx.beans.binding.* and javafx.beans.property.* packages, 546
javafx.beans.Observable class, 549
multiply() method, 550
output, 549
strategies, 546
borders generation, 545
imageView object, 545
ImageView object, 545
style selectors, 545
change password dialog box, 578
initModality() method, 578
initOwner() method, 578
javafx.scene.Scene API, 573
javafx.stage.Stage API, 573
javafx.stage.Stage class, 578
JDialog class, 578
JFrame, 578
start() method, 578
changing text fonts, 526
DropShadow object, 527
javafx.scene.effect.DropShadow, 525
javafx.scene.effect.Reflection, 525
javafx.scene.text.Font, 525
reflection, 527
vector-based graphics, 527
colors assignment
classes, 533
color shapes, 535
cycle method, 537
eclipse shape, radial gradient, 535
LinearGradient properties, 536–537
RadialGradient properties, 535–536
rectangle, semitransparent linear gradient, 535
rounded rectangle, reflective linear gradient, 535
components addition, layout, 541–542
CSS styling
Caspian theme, 618
createMenuItem() method, 619
DOM, 618
JavaFX Caspian Look 'n' Feel theme, 617
javafx.scene.control.Buttons, 620
javafx.scene.control.Labels, 620
loadSkin(), 619
selectors, 619
setStyle() method, 619
skinForm() method, 619
grid layout
cell constraint settings, 613
EventHandler<ActionEvent>, 613
form designer application, 603–604
grid-like form class code, 604–605
GridPaneControlPanel, 611
javafx.scene.layout.GridPane, 603
JavaFXjavafx.beans.value.ChangeListeners, 612
ManipulatingLayoutViaGrids, 611
MyForm creation, 611
padding and slider control, 613
property control panel, 605–610
setOnAction() method, 613
split pane creation, 611
ToggleButton selected property, 612
image creation
ButtonMove.PREV and ButtonMove.NEXT, 588
currentIndex variable, 586
drag-and-drop operation, 584
drag-and-drop support, 586
event.consume() method, 586
EventHandler objects, 586
getDragboard() method, 586
gotoImageIndex() method, 588
handle() method, 586
HBox instance, 586
image aspect ratio, 586
imageFiles variable, 586
instance variables, 585
java classes, 580
javafx.scene.shape.Arc, 588
OnDragDropped attribute, 587
OnDragOver attribute, 586
setOnDragOver() method, 586
setPreserveRatio() method, 586
translateXProperty(), 588
vs. Java2D, 527
keyboard sequences, 561
accelerator() method, 562
classes, 559
inner shadow effect, 561
setAccelerator() method, 562
media-rich API, 621
menus creation, 539
classes, 538
hot keys/keyboard functionality, 539
menu bar, 540
menu items, 540
menu objects, 540
MenuBar, 540
MP3 player, 622
application instance variables, 629
drag-and-drop desktop metaphor, 629
java.lang.Runnable method, 632
MediaPlayer object, 631
mouse-dragged event handler, 630
phaseNodes (Group) variable, 630
previousLocation variable, 630
randomly colored circle nodes, 631–632
setOnMousePress() method, 632
spectrumDataUpdate() method, 631
StageStyle.TRANSPARENT, 629
with visualizations, 628
ObservableList
java swing components, 553
java.util.ArrayList class, 553
javafx.collections.ObservableList and javafx.scene.control.ListView classes, 551
MVC mechanism, 551
scene graph, 513
shapes creation, 530
cubic curve, 531
donut shape, 532
equivalent shapes and drawing primitives, 531
javafx.builders.* package, 528
javafx.scene.shape.* package, 528
software installation
CLASSPATH variable, 517
completion, 516
JavaFX 2.0 and NetBeans IDE 7.1.x, 514
JavaFX 2.0 SDK Setup Wizard, 515
JavaFX SDK home directory, 515, 516
NetBeans IDE, 517
Swiss Army Knife, 513
tables
ChangeListener, 567
getPeople() method code, 565–566
javafx.scene.control.TableView class, 562
JTable component, 562
ListViewer, 567
ObservableList, 567
person class source code, 562–564
setProperty() method, 567
TableView control, 562, 566–567
teamMembers (ObservableList) variable, 567
updateItem() method, 567
tabs addition
javafx.scene.control.Tab class, 570
javafx.scene.control.TabPane class, 570
tree-like data structure, 513
UI with split views, 569
dividers position, 570
javafx.scene.control.SplitPane class, 567–568
SplitPane control, 570
VBox layout control, 570
vertical split, 570
user experience, 513
user interface creation. See HelloWorld application
video media player
animation and media synchronization, 647–648
attachMouseEvents() method, 637
ChangeListener's changed() method, 640
createBackground() method, 639
createSlider() method, 639
drag-dropped EventHandler, 640
JavaFX basic video player code, 633–636
media actions and events control, 642–644
MediaView object, 641
pauseButton and playButton, 641
Runnable instance, 641
setFullScreen() method, 639
with slider control, 637
UI code, 638
VP6, 638
visual cues, 579
JavaFX applications
database
alert() function, 778
createStatement().executeQuery, 774
DBUtils.java, 773
display contents, 768
doc.getElementsByTagName, 772
EventHandler<DragEvent>(), 770
getLoadWorker().stateProperty() method, 769
JDBC database, 777
list of feeds, 777
OnAlert web event, 778
public String toString(), 773
RSS feed location, 767
RSS icon, 776
RSS reader, 775
scene.setOnDragDropped(), 771
setOnAlert(), 770
State.SUCCEEDED, 777
three frame readers, 775
webEngine addListener(), 769
HTML5 content
alert() function, 767
Calm Down button, 766
clock application, 753
code,SVG analog clock, 754–755
DisplayHtml5Content.class file, 756
executeScript() method, 763
forecast, Yahoo! Weather, 761
getDocument() method, 764
getEngine().load() method, 756
JavaFX Scene graph, 753
Javafx.scene.web.WebEngine, 762
JavaScript updateTime() function, 757
JavaScript/SVG code, 756
loadContent() method, 763
ManipulatingHtmlContent class, 762
OnAlert property, 765
panic button,e-mail notification, 764
start() method,warning message, 764
start() method,weather message, 765
SVG analog clock, 756
SVG generation, 754
TimeLine to update, 763
warning message,panic button, 765–766
weather forecasts, 762
Yahoo weather service, coding, 757–760
web page
class check box, 752
click OK to close, 753
creation, 746
dialog box, 748
Hello World application, 750, 751
HTML web page, 751
MyJavaFXApp dialog, 749
NetBeans IDE 7.1, 745
new project dialog box, 747
Select New Project, file menu, 746
setting,run option, 750
source/binary format option, 748
sources and run, 752
Javafx.beans.Observable class, 549
Javafx.concurrent.Service class, 559
Javafx.concurrent.Task class, 554
Javafx.scene.control.ProgressBar class, 554
Javafx.scene.control.ProgressIndicator class, 554
Javafx.scene.input.KeyCode class, 559, 561
Javafx.scene.input.KeyCombination class, 559, 561
Javafx.scene.layout.GridPane class, 541
Javafx.scene.Node class, 531
Javafx.scene.paint.Color class, 533
Javafx.scene.paint.LinearGradient class, 533
Javafx.scene.paint.RadialGradient class, 533
Javafx.scene.paint.Stop class, 533
Javafx.scene.shape.CubicCurve class, 531
javafx.scene.shape.Path class, 531
javafx.scene.shape.PathElement, 528, 531
Javafx.scene.shape.Shape class, 525
Javafx.scene.text.Text class, 523
javafx.scene.text.Text node, 524
javafx.stage.Stage object, 523
JoinRowSetImpl() object, 300
MenuItem, 540
Model View Controller (MVC), 413, 551
MoveToCurrentRow() method, 294
MoveToInsertRow() method, 294
Multiply() method, 550
NumberBinding class, 546
NumberExpressionBase class, 550
NumberFormat instance, 251
Numbers
comparison operators, 47
complex numbers
isNaN() method, 53
Javadoc JAR file, 51
real and imaginary, 51
standard mathematics methods, 52
trigonometic methods, 52
decimalformat class, 44
decimalformat pattern characters, 46
formatDouble() method, 45
int values, 46
Integer.compare(int,int) method, 47
Integer.MAX_VALUE/Integer.MIN_VALUE, 44
java.lang.Math round() method, 43, 44
java.util.Random class, 56
Math.random() method, 57
NumberFormat class, 45
Random setSeed() method, 57
roundDoubleToLong() method, 44
roundFloatToInt() method, 44
Object-oriented Java, 145booleantrue and booleanfalse result, 173
ByteArrayOutputStream and ByteArrayInputStream, 168
class encapsulation
constructPlayer() method, 182–183
class interaction via interface, 162–163
class template definition, 176–178
deep copies, 168
equals() and hashCode() method, 169–172
instance contruction, same class with different values
builder pattern, 158
buildNewTeam() method, 162
buildPlayerList() method, 162
designateTeamCity() method, 162
Roster class, 161
Team object, 160
TeamBuilder interface, 160
TeamType interface, 158–159, 161–162
Lisp language, 145
one instance class
enum function, 149
getInstance() accessor method, 149–150
INSTANCE element, 150
privatestaticfinal field, 150
Statistics class, 150
== and != operators, 169overridden equals() method, 173
reusable objects creation, 153–155
shallowCopyClone() method, 166–167
string's hashCode() method, 174
super.clone() method, 168
ObservableList, 566
Ojdbc6.jar JDBC driver, 288
PaintComponent() method, 323, 328
Pareto principle, 328
Path.subtract() method, 532
PerformCreate() method, 270
PerformRead() method, 270
PerformUpdate() method, 270
PreparedStatement getArray() method, 317
PreparedStatement setArray() method, 314
PreparedStatement setClob() method, 311
PreparedStatements
CLOB, 311
close() method, 279
executeQuery() method, 279
finally block, 279
pstmt, 279
recipeNumber String, 279
recipeNumber variable, 278
record deletion, 277
record insertion, 276
setInt(position, variable) method, 278
SQL control, 275
substitution variable, 277, 278
try-catch block, 278
updatable ResultSet, 288
prepareStatement() method, 285
QuadCurveBuilder, 532
Quadratic Bézier curve, 350
RadioMenuItem, 540
readClob() method, 311
registerOutParameter() method, 318
ResultSet getInt() method, 265
ResultSet getString() method, 265
Rich Internet applications (RIAs), 513
Scalable Vector Graphics (SVG), 745
SDP protocol transport, 812
selectionItemProperty() method, 567
Serializing Java objects
convert and traverse, 108
directory creation, 117
directory monitoring
built-in poll mechanism, 122
ENTRY_DELETE, 121
types,watchEvents, 122
Watch Event, 121
watchKey.pollEvents() method, 122
WatchService.poll, 122
externalizable interface, 110
file moving, 116
Files.createDirectory() method, 118
marker interface, 107
ObjectOutput methods, 110
ObjectOutputStream class, 106
path execution, 115
readExternal(ObjectInput in), 110
readExternal/writeExternal methods, 109
serialization/deserialization mechanism, 109
socket connection
channels.newInputStream(socket) method, 114
Channels.newOutputStream() method, 114
IP address and port, 113
isDone(),isCancelled() method, 114
ObjectOutputStream.reset() method, 115
ObjectOutputStream.writeUnshared() method, 115
send/receive objects, 112
serverSocketChannel.accept() method, 114
socketChannel.connect() method, 114
speed vs. size vs. ease of use, 107
string class, 107
transient properties, 108
uncompressing compressed files, 124–126
writeExternal(ObjectOutput out), 110
Servlets, 651
Apache Tomcat, 651
application-wide parameters
<context-param> XML tag, 671–672
ServletContext object, 667
user feedback form, 671
attribute changes
addListener() method, 680
attributeAdded() method, 680
attributeRemoved() method, 680
attributeReplaced() method, 680
HttpSessionAttributeListener, 677–679
HttpSessionBindingEvent method, 680
configuration and mapping, 654
destroy() method, 655
doGet() method, 655
GenericServlet type, 654
HttpServletRequest and HttpServletResponse object, 656
HttpServletResponsesendRedirect() method, 675
IDE installation, 652
Java SE 7, 651
Java servlet API, 651
packaging, compiling and deployment, 656–658
parameters initialization, 661–664
registration without WEB-XML, 659–661
request and response function
getParameter() method, 666
HTML-based web form, 664
HttpServlet object, 666
servlet-based web frameworks, 667
sendRedirect() method, 674–675
service() method, 655
servlet init() method, 655
ServletConfig interface, 656
session information management, 681–684
SimpleServlet.java file, 654
startup.sh/startup.bat file, 652
tomcat-users.xml configuration file, 652
setAccelerator() method, 562
setAutoCommit() method, 283
setCommand() method, 293
setEffect() method, 532
setKeys() method, 293
setOffsetX() method, 532
setOffsetY() method, 532
setPassword() method, 293
setProperty() method, 567
setSide() method, 573
setString() method, 311
setStyle() method, 545
setTransformBounds property, 406
setUrl() method, 293
setUsername() method, 293
Shape node, 531
SimpleAppLauncher.launch() method, 323
SimpleStringProperty, 549
Static Code Analyzer (SCA), 226
Stream Unique Identifier (SUID), 108
Strings
case changing
case-sensitive string, 30
class, 247
demoComplex() method, 249
demoSimple() method, 249
enRegEx and jaRegEx variables, 247
java.util.regex class, 250
methods, 249
replaceAll() method, 248
replaceFirst() method, 248
split() method, 248
comparing
built-in equals()method, 26
compareTo()and compareToIgnoreCase() methods, 29
compareTo()method, 26
compareToIgnoreCase() method, 26
comparison operator (==), 28
equalsIgnoreCase() method, 26, 29
Java String equals() method, 28
concatenating
built-in String, 33
combining, 31
concatenation operator, 32
helper method, 33
StringBuffer class, 33
StringBuilder/StringBuffer, 32
datat type,programming language, 25
file name end string
filename variable, 42
helper methods, 26
iterating character string
length() methods, 37
numeric conversion
autoboxing, 34
Integer.parseInt()method, 34
Integer.valueOf()method, 34
integers, 33
NumberFormatExeption, 34
parseInt() method, 35
unboxing, 34
valueOf()and parseInt() methods, 34
replacing text
Pattern.compile() method, 41
replaceAll() method, 40
retrieval problem, 25
startingindex and endingindex, 26
substring() method,solution, 25
text matches
code and pattern, 38
Matcher find() method, 40
Matcher lookingAt() method, 40
Matcher matches() method, 40
matches() method, 39
Pattern.compile() method, 39
Pattern.matches() method, 40
regular expressions, 39
String helper matches(), 37
three-step process, 38
trimming whitespace
pattern-searching program, 30
String trim() method, 30
Swing API
animation
actionPerformed() method, 503
creation, 504
effect button, 502
mimic animation, 505
mouseExited () method, 504
stop() method, 505
timer, 503
application
com.acme.myapp.Main, 502
executable jar file, 500
manifest.mf file, 501
web start, 500
associating listeners
DefaultListModel class, 493
document, 493
Document API, 491
insertUpdate() method, 493
JList listBox, 492
MyDocumentListener class, 493
removeAllElements() method, 493
removeUpdate() method, 493
searchDictionary() method, 493
borders designing and manipulation
BorderDesigner() method, 466
BorderFactory swing, 465
borderTypeList, 466
ColorComboBox, 467
createColorComboBox() method, 469
createDashedBorder, 467
createStrokeBorder, 467
DashedBorder class, 469
designing, 468
JComponent's setBorder() method, 469
JTabbedPane, 465
LineBorder, 467
map and array variables, 469
StrokeBorder class, 469
canvas drawing
anchorPt, 461
drawings, 461
Graphics2D class, 458
mouseClicked, 460
mouseDragged() function, 462
MouseListener class, 458
MouseMotionListener class, 458
mousePress() function, 461
mouseRelease() function, 462
oneDrawing, 461
paintComponent() method, 462
database
DBUtils.saveContact() method, 448
derby.jar and derbytools.jar, 445
doInBackground() method, 448
executeUpdate() method, 449
InterruptedException and ExecutionException, 448
Java Database Connectivity, 443
JDBC, 443
saveContact() method, 449
submitting form values, 448
SubmittingFormValuestoDatabase class, 448
dialog box
ActionListener() method, 487
apply() method, 490
ButtonGroup() method, 487
CustomGridLayout () method, 488
development, 489
JDialog class, 486
JDialog's setModal() method, 490
JFrame class, 490
setVisible() method, 490
document
FontFamilyAction, 485
JTextPane class, 485
keyboard shortcuts, 485
StyledDocument, 482
StyledEditorKit, 485
TextPane class, 482
editing commands
AbstractAction class, 475
action, 477
actionPerformed() method, 478
ActionWithEditCommand, 477
JTextAreas getDocument() method, 477
MyUndoableEditListener class, 478
MyUndoableEditListener() method, 474
putValue() method, 478
RedoAction redoAction class, 475
StyledDocument class, 473
undoableEditHappened() method, 478
UndoManager undo class, 476
events generation
ActionListener, 435
addActionListener() method, 436
events, 436
JButton, 435
JPanel, 435
GUI applications
CellConstraint() method, 495
CustomGridLayout, 495
HTML, 496
JButton class, 496
JLabel class, 496
label and button, 494
GUI components
adding, 421
addLayoutComponent, 426
AppSetup interface, 420
BorderLayout manager, 431
BorderLayout.Center, 423
DesignGridLayout, 435
FlowLayout manager, 431
form interfaces, 432
getLayoutAlignmentX, 429
getLayoutAlignmentY, 429
getScreenSize() method, 423
GridBagConstraints class, 432
GridBagLayout class, 432
GroupLayout, 435
implements,MyCustomGridLayout, 426
JGoodies, 435
JLabel class, 421
JPanel class, 421
LayingOutComponentsOnGui class, 424
LayingOutComponentsOnGui.java, 424
LayingOutComponentsOnGui.java file, 424
layoutContainer() method, 434
LayoutManager2 methods, 434
list, 418
MigLayout, 435
MyCellConstraint setAlign, 430
MyCellConstraint.java, 424, 430
MyCustomGridLayout class, 426, 433
MyCustomGridLayout.java, 424
preferredLayoutSize, 427
removeLayoutComponent, 426
setDefaultCloseOperation() method, 422
SimpleAppLauncher class, 420
SimpleAppLauncher.displayGUI() method, 422
SimpleAppLauncher.java code, 419
SimpleAppLauncher.launch() method, 421
Toolkit.getDefaultToolkit() method, 423
updateMaxColWidthAndHeight, 429
GUI creation
displayGUI() method, 416
EDT, 416
javax.swing.JComponent, 413
javax.swing.SwingUtilities, 414
JFrame's setVisible() method, 417
SwingUtilities.invokeLater() method, 416
UI and graphics, 415
GUI look and feel
JScrollPane() method, 497
JTree() method, 498
Nimbus, 499
UIManager.getInstalledLookAndFeels() method, 499
UIManager.setLookAndFeel() method, 496
icons
createImageIcon() method, 464
generating and laying, 464
getClass() method, 465
getResource() method, 465
JPanel class, 462
JLayer component
e-mail format, error, 508
EmailValidationLayerUI ()method, 509
ImageIO.read() method, 508
invalid e-mail address, 508
JLayer.getView() method, 509
paint() method, 509
UsingJXLayer class, 508
UsingJXLayer() method, 506
keyboard shortcuts
AbstractAction class, 479
accelerator, 481
creation, 481
KeyEvent class, 479
KeyStroke class, 479
new JMenuBar() method, 479
putValue() method, 481
menu
adding, 455
AppSetup interface, 455
CheckBoxMenuItem class, 453
JCheckBoxMenuItem class, 453, 456
JRadioButtonMenuItem class, 453–455
multi-window program
internal windows, 451
JDesktopPane, 452
JDesktopPane class, 449
JInternalFrame class, 449
newWindowMenu method, 452
pop up internal windows, 449–451
setDragMode() method, 452
SimpleAppLauncher.launch() method, 452
printing support
actionPerformed() method, 512
components application, 511
dialog box, 512
java.awt.print.Printable API class, 512
java.awt.print.PrinterJob class, 512
JTable print() method, 510
timesheet application, 511
swing application
jar executable, 417
jar file, 417
Java app, 417
Java web start, 417
web page, 417
tabs
adding, 458
JTabbedPane class, 456
SCROLL_TAB_LAYOUT policy, 458
setTabPlacement() method, 458
TabPlacementAction implements, 457
text components
AbstractAction class, 473
ActionListener class, 473
actionPerformed() method, 473
CustomGridLayout, 470
events with buttons, 472
getSystemLookAndFeelClassName() methid, 471
JButton, 473
JPasswordField class, 469, 472
JScrollPane class, 469
JTextPane class, 472
login application, 472
user interface
createWorker() method, 442
doInBackground() method, 442
done() method, 442
GUI, 441
JTextArea, 441
process() method, 442
publish() method, 442
setIndeterminate(false) method, 441
setStringPainted() method, 441
Swing GUI applications, 385
SwingUtilities.invokeLater() method, 323
SwingWorker class, 558
SyncProviderException, 294
System.out() method, 265
Text nodes
keyboard sequences, 561
ToggleGroup class, 540
TransactionExample class, 280
Transformation nodes, 400
Transmission Control Protocol/Internet Protocol (TCP/IP) layer, 807
Unicode, internationalization and currency codes, 237
byte array conversion, 253–254
character streams and buffers conversion. see Character streams and buffers conversion
default Locale setting
locale.category enumeration, 246
Locale.FRANCE method, 246
Locale.setDefault() method, 244
ResourceBundle text, DISPLAY locale, 244–246
ResourceBundle.getBundle() method, 246
Locales creation
BCP 47 document and standards, 243
Java 7 Locale.Builder class, 240
java.util.Locale class, 240
Locale.Builder instance, 243
Locale.forLanguageTag() method, 241
locale-sensitive class, 242
NumberFormat and DateFormat classes, 240
static instances, 242
regular expression syntax. see also String class
backslash character, 250
Java regular expressions, 250
non-ASCII characters, 250
Unicode digit character conversion, 237
Character class Java API documentation, 239
Character.digit() static method, 239
isDigit property, 239
java.lang.Character, 237
updateItem() method, 567
updateMessage() method, 558
updateProgress() method, 558
updateString() method, 288
updateXXX() methods, 288
URL
parsing
accessor methods, 821
getFile() method, 822
getPath() method, 822
getQuery() and getRef() method, 822
User Datagram Protocol (UDP), 816
VARRAY columns
array value retrieval, 315–317
VisualVM, 228
writeAttribute() method, 790
writeCharacters() method, 790
writeEndElement() method, 790
writeStartDocumentMethod() method, 790
writeStartElement() method, 790
XML processing, 787
file reading
hasNext() method, 794
javax.xml.stream.XMLStreamReader interface, 791, 792
nextEvent() method, 794
StAX, 794
file writing, 787
java.io.FileOutputStream class, 789
javax.xml.stream.XMLStreamWriter class, 788–789
StAX, 789
XMLStreamWriter instance, 790
Java binding creation, 800–801
transformation
file requirements, 795
HTML table, 797
javax.xml.transform package, 795
patients.xml file, 796
XRender, 321