1 / 31

Tutorial 1 – Moving Shapes Application Introducing Computers, the Internet and Java Programming

Tutorial 1 – Moving Shapes Application Introducing Computers, the Internet and Java Programming.

rolandom
Télécharger la présentation

Tutorial 1 – Moving Shapes Application Introducing Computers, the Internet and Java Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. 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.

  3. 1.1 What Is a Computer? • Types of computers • Personal computer • Supercomputer • Parts of a computer • Hardware • Software

  4. 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

  5. 1.2 Computer Organization (Cont.) • Secondary storage unit • Long-term • High capacity storage • Nonvolatile

  6. 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

  7. 1.4 Java • Object Oriented • Objects • Components • Classes • Methods • Graphical User Interface (GUI) • Event Driven • Java Application Programming Interface (API) • Platform Independent

  8. 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

  9. 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

  10. 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

  11. 1.7 Key Software Trend: Object Technology • Object technology • Objects have attributes • Objects perform actions • Procedural programming language

  12. 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

  13. 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

  14. Beginning directory for Windows 2000 1.9 Running a Java Application (Cont.) Figure 1.1 A CommandPrompt window in Windows 2000.

  15. Beginning directory for Windows XP 1.9 Running a Java Application (Cont.) Figure 1.2 A Command Prompt window in Windows XP.

  16. 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

  17. 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.

  18. Execute MovingShapes application 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.4 Running the MovingShapes application.

  19. 1.10 Test-Driving the Moving Shapes Application (Cont.) • GUI Components • Graphical Elements • JFrame • JButton • JComboBox • JPanel

  20. 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.

  21. 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

  22. 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

  23. 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.

  24. JButton with changed background color 1.10 Test-Driving the Moving Shapes Application (Cont.) Figure 1.9 Application once color has been modified.

  25. 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

  26. 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.

  27. 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

  28. 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

  29. 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

  30. 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

  31. 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

More Related