private void addResourcePanel(final String username) {
        resourcePanel = new JPanel();
        resourcePanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        resourcePanel.setBorder(new TitledBorder("对应权限"));
        resourcePanel.setPreferredSize(new Dimension(800, 150));

        ResourceService resourceService = MyFactory.getResourceService();
        Map<Integer, String> resourceMap = resourceService.getResourceMap();

        User user = username == null ? null : MyFactory.getUserService().queryUserByName(username);

        int count = 1;
        for (Map.Entry<Integer, String> m : resourceMap.entrySet()) {
            JCheckBox cb = new JCheckBox(count + "." + m.getValue());
            if (user != null) {
                if (resourceService.hasRight(user, m.getKey())) {
                    cb.setSelected(true);
                }
            }
            resourcePanel.add(cb);
            count++;
        }

        if (MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.USER_MNG)) {
            JButton save = new JButton("保存");
            save.addMouseListener(new MouseAdapter() {
                public void mousePressed(MouseEvent e) {
                    saveResource(username);
                }
            });

            resourcePanel.add(save);
        }

        this.add(resourcePanel, 1);
    }