Lecter Java: Program design - Chapter 4: Classes

This chapter introduce how to create and manipulate simple objects with attributes and behaviors that you can specify. We do so through the use of classes. The class is Java's principal mechanism for supporting object-oriented design. | Classes Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Preparation Scene so far has been background material and experience Computing systems and problem solving Variables Types Input and output Expressions Assignments Objects Standard classes and methods Ready Experience what Java is really about Design and implement objects representing information and physical world objects Object-oriented programming Basis Create and manipulate objects with attributes and behaviors that the programmer can specify Mechanism Classes Benefits An information type is design and implemented once Reused as needed No need reanalysis and re-justification of the representation First class – ColoredRectangle Purpose Represent a colored rectangle in a window Introduce the basics of object design and implementation Background JFrame Principal Java class for representing a titled, bordered graphical window. Standard class Part of the swing library import . | Classes Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Preparation Scene so far has been background material and experience Computing systems and problem solving Variables Types Input and output Expressions Assignments Objects Standard classes and methods Ready Experience what Java is really about Design and implement objects representing information and physical world objects Object-oriented programming Basis Create and manipulate objects with attributes and behaviors that the programmer can specify Mechanism Classes Benefits An information type is design and implemented once Reused as needed No need reanalysis and re-justification of the representation First class – ColoredRectangle Purpose Represent a colored rectangle in a window Introduce the basics of object design and implementation Background JFrame Principal Java class for representing a titled, bordered graphical window. Standard class Part of the swing library import .* ; Example Consider JFrame w1 = new JFrame("Bigger"); JFrame w2 = new JFrame("Smaller"); (200, 125); (150, 100); (true); (true); A JFrame is the principal way in Java to represent a titled, bordered graphical window. Class JFrame is part of the standard package swing. The swing package is one of several APIs (application programmer interfaces) that comprise the Java Foundations Classes (JFC). Although now part of the Java standard, the Java Foundation Classes are extensions of the original Java specification. Because it is an extension, the swing package is found at . Example Consider JFrame w1 = new JFrame("Bigger"); JFrame w2 = new JFrame("Smaller"); (200, 125); (150, 100); (true); (true); A JFrame is the principal way in Java to represent a titled, bordered graphical window. Class JFrame is part of the standard package swing. The swing package is one of several APIs (application

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.