Đang chuẩn bị liên kết để tải về tài liệu:
Java Programming for absolute beginner- P20

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Java Programming for absolute beginner- P20:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | JavaProgAbsBeg-09.qxd 2 25 03 8 55 AM Page 338 Table 9.4 Color Methods Method Description Color int r int g int b Constructs a Color object with the given red green and blue values that range from 0-255. Color int r int g int b int a Color brighter Color darker int getAlpha int getBlue int getGreen int getRed V Constructs a Color object with the given red green blue and alpha values which range from 0-255. Returns a brighter version of this Color. Returns a darker version of this Color. Returns the alpha value of this Color. Returns the blue value of this Color. Returns the green value of this Color. Returns the red value of this Color. Java Programming for the Absolute Beginner on which button you press. The canvas will change color accordingly. Here is the source code for ColorTest.java the result can be seen in Figure 9.12. ColorTest Demonstrates the Color class import java.awt. import java.awt.event. public class ColorTest extends GUIFrame Canvas palette Button bright dark public final static int MIN 0 MAX 255 public ColorTest int r int g int b super Color Test r r MIN r MAX r MIN g g MIN g MAX g MIN b r MIN b MAX b MIN palette new Canvas palette.setBackground new Color r g b palette.setSize 200 150 add palette BorderLayout.CENTER Panel controlPanel new Panel controlPanel.setLayout new GridLayout 1 0 bright new Button Brighter team Line - live informative Nan-cast and Genuine Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. JavaProgAbsBeg-09.qxd 2 25 03 8 55 AM Page 339 bright.addActionListener new ActionListener public void actionPerformed ActionEvent e Color c palette.getBackground .brighter palette.setBackground c controlPanel.add bright dark new Button Darker dark.addActionListener new ActionListener public void actionPerformed ActionEvent e Color c palette.getBackground .darker palette.setBackground c controlPanel.add dark add controlPanel BorderLayout.SOUTH pack setVisible true public static void main String args if args.length

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.