码迷,mamicode.com
首页 > Web开发 > 详细

NetBeans Loading

时间:2014-12-15 17:09:26      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:io   color   sp   for   java   on   log   bs   ad   

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

标签:io   color   sp   for   java   on   log   bs   ad   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!