首页 > Web开发 > 详细

NetBeans Loading

时间:2014-12-15 17:06:37      阅读:329      评论:0      收藏:0      [点我收藏+]

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;
    }

NetBeans Loading

原文:http://www.cnblogs.com/mr-boy/p/4164926.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!