Jlabel不可见,jDialog在addActionListener中工作

时间:2017-03-20 16:22:37

标签: java swing

btnLogin.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
    JLabel mes = new JLabel("Please wait .. initializing");
    mes.setBounds(268, 249, 221, 14);
    frame.getContentPane().add(mes);
    JDialog d = new JDialog(frame, "Please wait .. initializing", true);
    ImageIcon loading = new ImageIcon("ajax-loader.gif");
    frame.add(new JLabel("loading... ", loading, JLabel.CENTER));
    JDialog d = new JDialog(frame, "Please wait .. initializing", true);
    d.setVisible(true);
    d.setBounds(268, 249, 221, 14);
    d.setLocationRelativeTo(frame);
    d.setVisible(true);
}

}

未显示JLabel,但在addActionListener

上可以看到jdialog

0 个答案:

没有答案