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

Bài giảng Lập trình cơ sở dữ liệu Java: Bài do GV. Nguyễn Hữu Thể biên soạn cung cấp cho người đọc các nội dung: JTable, JButton, JMenu, JTextField, JToolBar, JCheckBox, JOptionPane, JRadioButton, JFileChooser, JPanelJComboBox, JList. nội dung chi tiết. | LẬP TRÌNH JAVA CSDL BÀI 3 COMPONENTS Nguyễn Hữu Thể 1 Nội dung JLabel JButton JTextField JCheckBox JRadioButton JPanel JComboBox, JList JTable JMenu JToolBar JOptionPane JFileChooser 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", 4 "Green", "Blue"}); 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 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
322    85    1    02-06-2024
Đã 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.