Chào mọi người, vấn đề em đang mắc phải là khi chạy giao diện có chứa JLabel , em cho nó hiển thị từng câu, chẳng bạn: "Chào bạn" -> "Ờ" -> "Hả". Câu sau bị câu trước thay thế, em cho mỗi câu là một thread để chạy. Nếu chạy trên file đó thì chữ vẫn xuất hiện bình thường. Còn khi ở 1 giao diện khác gọi cái giao diện lúc nãy thì nó không chịu xuất chữ. Mong các bác chỉ lỗi sai và hướng khắc phục.


Mã:
import java.awt.BorderLayout;import java.awt.Toolkit; import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.SwingConstants; public class ClosingForm extends JDialog{    /**     *      */        private static final long serialVersionUID = 870999276222751495L;    private JLabel label_status;    private WishThread thread = null;    private static volatile ClosingForm getInstance = null;        public ClosingForm(){        setSize(300, 100);        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icon/Tet_2014.jpg")));        setDefaultCloseOperation(DISPOSE_ON_CLOSE);        setFocusable(true);        setVisible(true);                thread = new WishThread();        label_status = new JLabel();        label_status.setHorizontalAlignment(SwingConstants.CENTER);        add(label_status, BorderLayout.CENTER);                thread.print(label_status, "Congratulation!");        thread.print(label_status, "Chúc bạn thành công trong năm mới.");        thread.print(label_status, "Sức khỏe dồi dào.");        thread.print(label_status, "Và mãi luôn tươi trẻ.");                System.exit(0);    }    private class WishThread extends Thread{        public synchronized void print(JLabel label, String stt){            try{                label.setText(stt);//              System.out.println(label.getText());                sleep(1000);            }            catch(InterruptedException exception){                JOptionPane.showMessageDialog(null, exception.toString(), "Error", JOptionPane.ERROR_MESSAGE);            }        }    }        public static synchronized ClosingForm getInstance(){        if (getInstance == null)            getInstance = new ClosingForm();        return getInstance;    }        public static void main(String[] args){        ClosingForm app = ClosingForm.getInstance();    }}
Ở giao diện kia em dùng câu lệnh bên dưới để gọi..


Mã:
ClosingForm app = ClosingForm.getInstance();