01/10/2018, 00:26
Hiển thị Frame trong Java
Mọi người cho em hỏi, em khai báo các câu lệnh sau theo thứ tự trong hàm khởi tạo:
this.setVisible(true);
this.setSize(500, 500);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
(Trong hàm em đã add nhiều component khác)
Có những lúc Frame hiện ra luôn nội dung, có lúc phải kéo chỉnh kích thước Frame thì nội dung mới hiện ra. Mọi người ai biết giúp em với ạ?
Bài liên quan
Layout design như thế nào?
Nên gọi method setVisible(true); sau khi add tất cả component, nếu add/remove/hide/show/move component sau khi đã setVisible thì gọi method updateUi(); để cập nhật lại giao diện
Chuẩn quá anh ơi :). Em cảm ơn anh!