Автор: David J. Eck
Издательство: Hobart and William Smith Colleges
Год: May, 2022
Страниц: 790
Язык: английский
Формат: pdf (true), epub + code
Размер: 10.5 MB
Welcome to Version 9.0 of Introduction to Programming Using Java, a free, on-line textbook for introductory programming that uses Java as the language of instruction. This book is directed mainly towards beginning programmers, although it might also be useful for experienced programmers who want to learn something about Java.
Version 9 covers Java 17. It updates the previous version mostly by moving definitively to Java 17 and by adding a new Swing edition. Java currently has two major approaches to Graphical User Interface programming: JavaFX and Swing. This edition of the textbook uses Swing, but there is an alternative edition that uses JavaFX.
Swing is a standard part of Java. JavaFX was introduced as a more modern approach to GUI programming, but it must be downloaded and installed separately from Java itself, which makes it more complicated to use. Swing and JavaFX can both be used to write complex, fully functional GUI programs, and either one is a reasonable choice. Version 8 of this textbook used JavaFX. The alternative edition that uses Swing has been added for Version 9.
GUI programming was never included in the textbook as an end in itself, and it would take another textbook to cover the topic in its entirety. I cover GUI because it is a great example of object-oriented programming, it lets me introduce event-driven programs, and it lets students literally see the effect of the code that they write. JavaFX and Swing both offer good support for all of those purposes.
Computer users today expect to interact with their computers using a graphical user interface (GUI). Java can be used to write sophisticated GUI programs. GUI programs differ from traditional "straight-through" programs that you have encountered in the first few chapters of this book. One big difference is that GUI programs are event-driven. That is, user actions such as clicking on a button or pressing a key on the keyboard generate events, and the program must respond to these events as they occur.
A GUI program still has a main() subroutine, but in general, the main routine in a Swing application generally just creates one or more GUI components and displays them on the computer screen. Once the GUI components have been created, they follow their own programming—programming that tells them how to draw themselves on the screen and how to respond to events such as being clicked on by the user.
Скачать Introduction to Programming Using Java, Version 9, Swing Edition