tailieunhanh - Lập trình Java cơ bản : Các thành phần GUI part 9

Các sự kiện bàn phím • Một lớp muốn nghe sự kiện bàn phím phải cài đặt giao tiếp KeyListener • Chú ý: Có thể sử dụng KeyAdapter thay cho dùng giao tiếp KeyListener | Các lớp adapter Một số lớp adapter Interface Adapter class ComponentListener ComponentAdapter ContainerListener ContainerAdapter FocusListener FocusAdapter KeyListener KeyAdapter MouseListener MouseAdapter MouseMotionListener MouseMotionAdapter WindowListener WindowAdapter 49 Các sự kiện bàn phím Một lớp muốn nghe sự kiện bàn phím phải cài đặt giao tiếp KeyListener void keyTyped KeyEvent e void keyPressed KeyEvent e void keyReleased KeyEvent e Chú ý Có thể sử dụng KeyAdapter thay cho dùng giao tiếp KeyListener 50 Các sự kiện bàn phím Cac import can thiet. public class DemoKey extends Applet implements KeyListener private String key public void init addKeyListener this key public void paint Graphics g new Font Arial 72 key 100 100 .

TÀI LIỆU MỚI ĐĂNG
31    257    0    08-05-2024
46    191    0    08-05-2024
6    101    0    08-05-2024
6    96    0    08-05-2024
crossorigin="anonymous">
Đã 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.