310 likes | 323 Views
Learn about computer organization, high-level languages, Java and object technology. Explore the evolution of the Internet, run Java applications, and access web resources in this tutorial.
E N D
Tutorial 1 – Moving Shapes Application Introducing Computers, the Internet and Java Programming Outline1.1 What Is a Computer?1.2 Computer Organization1.3 Machine Languages, Assembly Languages and High-Level Languages1.4 Java1.5 Other High-Level Languages1.6 Structured Programming1.7 Key Software Trend: Object Technology1.8 The Internet and the World Wide Web1.9 Running a Java Application1.10 Test-Driving the Moving Shapes Application1.11 Internet and Web Resources1.12 Wrap-Up
Objectives • In this tutorial, you will learn: • The units into which typical computers are divided. • To identify the characteristics of low-level and high-level programming languages. • About the history of high-level programming languages. • What objects are and why object technology is important. • The evolution of the Internet and the World Wide Web. • How to run your first Java application. • How to locate additional Java information using the Internet.
1.1 What Is a Computer? • Types of computers • Personal computer • Supercomputer • Parts of a computer • Hardware • Software
1.2 Computer Organization • Input unit • Input devices • Output unit • Output devices • Memory unit • Primary memory • Volatile • Arithmetic and logic unit • Performs calculation • Determines logic • Central processing unit • Administrative section
1.2 Computer Organization (Cont.) • Secondary storage unit • Long-term • High capacity storage • Nonvolatile
1.3 Machine Languages, Assembly Languages and High-Level Languages • Machine language • “Natural language” • Machine dependent • Assembly language • Machine language too slow • English-like abbreviation • Assemblers • High-level language • Compiler and interpreter • Write instructions that look like everyday English
1.4 Java • Object Oriented • Objects • Components • Classes • Methods • Graphical User Interface (GUI) • Event Driven • Java Application Programming Interface (API) • Platform Independent
1.5 Other High-Level Languages • Fortran • Developed in mid-1950s • For scientific and engineering applications • COBOL • Developed in late 1950s • Business software • The C language • Development language of the Unix operating system • C++ extends C • Object-oriented programming language • Basic • Developed in mid-1960s • Sun Microsystems
1.5 Other High-Level Languages (Cont.) • Visual Basic .NET • Designed for Microsoft’s .NET framework • Object-oriented programming language • Framework Class Library (FCL) • C# • Designed for Microsoft’s .NET framework • Comparable capabilities with Java and Visual Basic .NET
1.6 Structured Programming • Evolution of structured programming • Clearer and easy to modify • Pascal • Designed for teaching structured programming • Lacked many features • Ada programming language • Develop with sponsorship of the U.S. Department of Defense
1.7 Key Software Trend: Object Technology • Object technology • Objects have attributes • Objects perform actions • Procedural programming language
1.8 The Internet and the World Wide Web • Advanced Research Projects Agency • Networking together computer systems • ARPAnet • Today’s internet • Transmission Control Protocol • Sending and receiving packets • Internet Protocol • “Network of networks” • World Wide Web • Collection of hardware and software • HyperText Markup Language
1.9 Running a Java Application • Java Runtime Environment (JRE) • Portion of the J2SDK that enables you to execute Java applications • .java or source code files • .class files • Compilation • Process of converting statements from a high-level language into statements of a machine language • Command Prompt window
Beginning directory for Windows 2000 1.9 Running a Java Application (Cont.) Figure 1.1 A CommandPrompt window in Windows 2000.
Beginning directory for Windows XP 1.9 Running a Java Application (Cont.) Figure 1.2 A Command Prompt window in Windows XP.
1.10 Test-Driving the Moving Shapes Application • Opening the application • Open a Command Prompt window • Change to your completed Moving Shapes directory • Type javaMovingShapes
Note that the current directory changed 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.3 Changing to the Moving Shapes application’s directory.
Execute MovingShapes application 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.4 Running the MovingShapes application.
1.10 Test-Driving the Moving Shapes Application (Cont.) • GUI Components • Graphical Elements • JFrame • JButton • JComboBox • JPanel
Clicking this JButton displays a window that allows the user to select the color of a shape Application displays in a JFrame (that is, a window) Clicking this JComboBox allows the user to select shape to draw White portion is a JPanel, which represents the drawing area 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.5 Moving Shapes Java application with an interactive GUI.
Rectangle option highlighted 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.6 JComboBoxdisplaying options. • Draw a Rectangle • Choose Rectangle from the JComboBox
1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.7 Clicking the ColorJButton. • Select a Color • Press the JButton to display a Select a Color dialog • Choose the color red from the palette
Palette of color swatches Select a color by clicking the mouse 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.8 Select a Color dialog.
JButton with changed background color 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.9 Application once color has been modified.
1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.10 Drawing a rectangle. • Draw the Shape • Drag the mouse across the JPanel to draw a shape
Rectangle moves once mouse button is released 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.11 Moving rectangle after mouse button is released.
1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.12 Selecting Oval as the shape to draw. • Draw an Oval • Select Oval from the JComboBox
1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.13 Drawing an oval. • Select a color and Draw the oval • Choose the color green • Drag the mouse to draw the oval
Close button Shapes may overlap when moving Lines may be drawn as well as rectangles and ovals 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.14 Moving Shapes application with several shapes drawn. • Create more shapes • Draw various shapes with various colors in the same manner that you drew the rectangle and oval
1.10 Test-Driving the Moving Shapes Application (Cont.) • Software reuse • Did not need to define the general look and feel of some components • Line • Rectangle • Oval
1.11 Internet and Web Resources • www.deitel.com • www.prenhall.com/deitel • www.softlord.com/comp • www.elsop.com/wrc/h_comput.htm • www.w3.org/History.html • www.netvalley.com/intval.html • java.sun.com • developer.java.sun.com/developer/onlineTraining/new2java