NetBeans Loading

public JDialog showLoading() {
        JDialog dia = new JDialog();
        JPanel panel = new JPanel();
        panel.setBackground(new Color(220, 220, 220));
        BoxLayout layoutMgr = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
        panel.setLayout(layoutMgr);
        ClassLoader cldr = this.getClass().getClassLoader();
        java.net.URL imageURL = cldr.getResource("com/mapvision/dataspider/loading2.gif");
        ImageIcon imageIcon = new ImageIcon(imageURL);
        imageIcon.setImage(imageIcon.getImage().getScaledInstance(300, 205, Image.SCALE_DEFAULT));
        JLabel iconLabel = new JLabel();
        iconLabel.setIcon(imageIcon);
        imageIcon.setImageObserver(iconLabel);
        JLabel label = new JLabel();
        label.setSize(300, 25);
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setText("正在加载城市列表,请耐心等待");
        label.setForeground(new Color(140, 140, 140));
        Font fname = new Font("宋体", 0, 14);
        label.setFont(fname);
        panel.add(iconLabel);
        panel.add(label);
        dia.setSize(300, 270);
        dia.add(panel);
        dia.setEnabled(false);
        dia.setAlwaysOnTop(true);
        dia.setLocationRelativeTo(null);
        dia.setTitle("加载城市列表");
        dia.show();
        return dia;
    }

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。