TAILIEUCHUNG - Bài giảng Lập trình Cơ sở dữ liệu – Java: Bài 3.1 - Nguyễn Hữu Thể

Bài giảng Lập trình cơ sở dữ liệu Java - Bài 3: Components. Chương này cung cấp cho người học các nội dung: JTable, JButton, JMenu, JTextField, JToolBar, JCheckBox, JOptionPane, JRadioButton, JFileChooser, JPanelJComboBox, JList. nội dung chi tiết. | Bài giảng Lập trình Cơ sở dữ liệu – Java: Bài - Nguyễn Hữu Thể LẬP TRÌNH JAVA CSDL BÀI 3 COMPONENTS Nguyễn Hữu Thể 1 Nội dung JLabel JTable JButton JMenu JTextField JToolBar JCheckBox JOptionPane JRadioButton JFileChooser JPanel JComboBox, JList 2 GUI Components JButton, JLabel, JTextField, JCheckBox, JRadioButton, and JComboBox. Each GUI component class provides several constructors that you can use to create GUI component objects. 3 GUI Components // Create a button with text OK JButton btOK = new JButton("OK"); // Create a label with text "Enter your name: " JLabel lbName = new JLabel("Enter your name: "); // Create a text field with text "Type Name Here" JTextField txtName = new JTextField("Type Name Here"); // Create a check box with text bold JCheckBox chkBold = new JCheckBox("Bold"); // Create a radio button with text red JRadioButton rbRed = new JRadioButton("Red"); // Create a combo box with choices red, green, blue JComboBox cboColor = new JComboBox(new String[]{"Red", "Green", "Blue"}); 4 Working with Components Several methods: setEnabled(boolean): receive user input (an argument of true) or is inactive and cannot receive input (false). Components are enabled by default. isEnabled() returns a boolean value. setVisible(boolean): for all components. Use true to display a component and false to hide it. isVisible() setSize(int, int): width and height specified as arguments setSize(Dimension) uses a Dimension getSize(): returns a Dimension object with height and width 5 Working with Components setText() getText() setValue() and getValue() for components that store a numeric value. 6 JLabel Display Text, not editable Constructor: Label() : An empty label JLabel(String) : A label with the .

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.