ebook img

Learn Java GUI Applications: A JFC Swing Tutorial PDF

1285 Pages·2017·12.03 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learn Java GUI Applications: A JFC Swing Tutorial

Learn Java™ GUI Applications A JFC Swing NetBeans Tutorial 8th Edition Philip Conrod & Lou Tylee KIDWARE SOFTWARE, LLC PO Box 701 Maple Valley, WA 98038 www.computerscienceforkids.com www.kidwaresoftware.com Copyright © 2015 by Kidware Software LLC. All rights reserved Published by: Kidware Software, LLC PO Box 701 Maple Valley, Washington 98038 1.425.413.1185 www.kidwaresoftware.com www.computerscienceforkids.com All Rights Reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Printed in the United States of America ISBN-13 978-1-937161-13-2 (Print Edition) ISBN-13 978-1- 937161-26-2 (Electronic Edition) Cover Illustration by Kevin Brockschmidt Copy Editors: Stephanie Conrod & Jessica Conrod Compositor: Michael Rogers Previous edition published as “Learn Java GUI Applications – 7th Edition” by Kidware Software LLC This copy of the Learn Java GUI Applications Tutorial and the associated software is licensed to a single user. Copies of the course are not to be distributed or provided to any other user. Multiple copy licenses are available for educational institutions. Please contact Kidware Software for school site license information. This guide was developed for the course, “Learn Java GUI Applications,” produced by Kidware Software LLC, Maple Valley, Washington. It is not intended to be a complete reference to the Java language. Please consult the Oracle website for detailed reference information. This guide refers to several software and hardware products by their trade names. These references are for informational purposes only and all trademarks are the property of their respective companies and owners. Oracle and Java are registered trademarks of Oracle Corporation and/or its affiliates. JCreator is a trademark product of XINOX Software. Microsoft Word, Excel, and Windows are all trademark products of the Microsoft Corporation. All other trademarks are the property of their respective owners, and Kidware Software makes no claim of ownership by the mention of products that contain these marks. Kidware Software is not associated with any products or vendors mentioned in this book. Kidware Software cannot guarantee the accuracy of this information. The example companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. This book expresses the author’s views and opinions. The information in this book is distributed on an "as is" basis, without and expresses, statutory, or implied warranties. Neither the author(s) nor Kidware Software LLC shall have any liability to any person or entity with respect to any loss nor damage caused or alleged to be caused directly or indirectly by the information contained in this book. This eBook was posted by AlenMiler! Many Interesting eBooks You can also Download from my Blog: Click Here! Mirror: Click Here! About The Authors Philip Conrod holds a BS in Computer Information Systems and a Master's certificate in the Essentials of Business Development from Regis University. Philip has been programming computers since 1978. He has authored, coauthored and edited numerous beginning computer programming books for kids, teens and adults. Philip has also held various Information Technology leadership roles in companies like Sundstrand Aerospace, Safeco Insurance Companies, FamilyLife, Kenworth Truck Company, and PACCAR. Today, Philip serves as the Chief Information Officer for a large manufacturing company based in Seattle, Washington. In his spare time, Philip serves as the President of Kidware Software LLC. He makes his home with his lovely family in Maple Valley, Washington. Lou Tylee holds BS and MS degrees in Mechanical Engineering and a PhD in Electrical Engineering. Lou has been programming computers since 1969 when he took his first Fortran course in college. He has written software to control suspensions for high speed ground vehicles, monitor nuclear power plants, lower noise levels in commercial jetliners, compute takeoff speeds for jetliners, locate and identify air and ground traffic and to let kids count bunnies, learn how to spell and do math problems. He has written several online texts teaching Visual Basic, Visual C# and Java to thousands of people. He taught a beginning Visual Basic course for over 15 years at a major university. Currently, Lou works as an engineer at a major Seattle aerospace firm. He is the proud father of five children and proud husband of his special wife. Lou and his family live in Seattle, Washington. Acknowledgements I want to thank my three wonderful daughters - Stephanie, Jessica and Chloe, who helped with various aspects of the book publishing process including software testing, book editing, creative design and many other more tedious tasks like finding all our typos. I could not have accomplished this without all your hard work, love and support. I also want to thank by best friend Jesus who is always stands by my side. Last but definitely not least, I want to thank my multi-talented co-author, Lou Tylee, for doing all the real hard work necessary to develop, test, debug, and keep current all the ‘kid-friendly’ applications, games and base tutorial text found in this book. Lou has tirelessly poured his heart and soul into so many previous versions of this tutorial and there are so many beginners who have benefited from his work over the years. Lou is by far one of the best application developers and tutorial writers I have ever worked with. Thanks Lou for collaborating with me on this book project. Table of Contents Course Description Course Prerequisites System Requirements Installing and Using the Downloadable Solution Files Installing Learn Java How To Take the Course Forward by Alan Payne, A Computer Science Teacher 1. Introduction to Java Preview Course Objectives What is Java? What is a GUI Application? A Brief Look at Object-Oriented Programming (OOP) Downloading and Installing Java and NetBeans Testing the Installation Getting Help with a Java Program Structure of a Java Program Structure of a Java GUI Application Swing Controls Creating a Java Project with Netbeans Create a Frame Saving Java Projects with Netbeans Netbeans and Java Files Create the User Interface Example 1-1: Stopwatch Application - Adding Controls Adding Event Methods Variables Java Data Types Variable Declaration Arrays Constants Variable Initialization Example 1-2: Stopwatch Application - Writing Code Class Review Practice Problems 1 Problem 1-1. Beep Problem Problem 1-2. Caption Problem Problem 1-3. Enabled Problem Problem 1-4. Date Problem Exercise 1: Calendar/Time Display 2. The Java Language Review and Preview A Brief History of Java Rules of Java Programming Java Statements and Expressions Type Casting Java Arithmetic Operators Comparison and Logical Operators Concatenation Operators Strings to Numbers to Strings Java String Methods Dates and Times Random Number Generator Math Functions Example 2-1: Savings Account Focus Traversal Example 2-2: Savings Accounts – Setting Focus Improving a Java Application Java Decisions - if Statements Switch Statement - Another Way to Branch Control Focus Input Validation Example 2-3: Savings Account – Input Validation Java Looping Java Counting Example 2-4: Savings Account - Decisions Class Review Practice Problems 2 Problem 2-1. Random Number Problem Problem 2-2. Price Problem Problem 2-3. Odd Integers Problem Problem 2-4. Pennies Problem Problem 2-5. Code Problem Exercise 2-1: Computing a Mean and Standard Deviation Exercise 2-2: Flash Card Addition Problems 3. Java Swing Controls Review and Preview Function Overloading Confirm Dialog (JOptionPane) Font Object Color Object JFrame Object Frame Layout and Centering JButton Control JLabel Control JTextField Control JTextArea Control Example 3-1: Password Validation JCheckBox Control JRadioButton Control JPanel Control Handling Multiple Events in a Single Procedure Control Arrays Example 3-2: Pizza Order JList Control JScrollPane Control JComboBox Control Example 3-3: Flight Planner Class Review Practice Problems 3 Problem 3-1. Message Box Problem Problem 3-2. Tray Problem Problem 3-3. List Box Problem Problem 3-4. Combo Box Problem Exercise 3: Customer Database Input Screen 4. More Java Swing Controls Review and Preview JSpinner Control Example 4-1: Date Input Device JScrollBar Control JSlider Control Example 4-2: Temperature Conversion JLabel Control (Revisited) Example 4-3: “Find the Burger” Game JFileChooser Control (Open Files) Example 4-4: Image Viewer Class Review Practice Problems 4 Problem 4-1. Number Guess Problem Problem 4-2. RGB Color Problem Problem 4-3. Tic-Tac-Toe Problem Problem 4-4. File Times Problem Exercise 4: Student Database Input Screen 5. Java GUI Application Design and Distribution Review and Preview Application Design Considerations JTabbedPane Control Example 5-1: Shopping Cart Using General Methods in Applications Example 5-2: Average Value Returning Multiple Values from General Methods Example 5-3: Circle Geometry Adding Menus to Java Applications Example 5-4: Note Editor Distribution of a Java GUI Application Executable (jar) Files Creating a Manifest File in NetBeans Creating a jar File in Netbeans Application Icons Using IconEdit Running a Project on Another Computer Class Review Practice Problems 5 Problem 5-1 Tabbed Pane Problem Problem 5-2 Note Editor About Box Problem Problem 5-3 Normal Numbers Problem Exercise 5: US/World Capitals Quiz 6. Exception Handling, Debugging and Sequential Files Review and Preview Program Errors Exception Handling Debugging Java Programs Simple Debugging Example 6-1: Debugging Example Using the Java Debugger Using the Debugging Tools Debugging Strategies Sequential Files Sequential File Output (Variables) Example 6-2: Writing Variables to Sequential Files Sequential File Input (Variables) Example 6-3: Reading Variables from Sequential Files Parsing Data Lines Example 6-4. Parsing Data Lines Reading Tokenized Lines Example 6-5. Reading Tokenized Data Lines Building Data Lines Example 6-6: Building Data Lines Configuration Files Example 6-7: Configuration Files Writing and Reading Text Using Sequential Files JFileChooser Control (Save Files) Example 6-8: Note Editor - Reading and Saving Text Files Class Review Practice Problems 6 Problem 6-1. Debugging Problem Problem 6-2. Option Saving Problem Problem 6-3. Text File Problem Problem 6-4. Data File Problem Exercise 6-1: Information Tracking Exercise 6-2: ‘Recent Files’ Menu Option

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.