Package chatroom.client.dataclass

Examples of chatroom.client.dataclass.User


        @Override
        public Component getListCellRendererComponent(
                JList list, Object value, int index,
                boolean isSelected, boolean cellHasFocus) {

            User user = (User) value;
            // Display the text for this item
            String status = user.getStatus();
            URL statusIconURL = getClass().getResource("/images/" + status + ".png");
            ImageIcon statusIcon = new ImageIcon(statusIconURL);
            JLabel statusBall = new JLabel(statusIcon);
            // Set the correct image
            //BufferedImage pic = user.getSmallPic();
            //ImageIcon icon = new ImageIcon(pic);
            this.setIcon(statusIcon);
            this.setText(user.getName());
            //setIcon(ProfilePicResizer.getIcon(user.getSmallPic(), photolen));
            // Draw the correct colors and font
            if (isSelected) {
                // Set the color and font for a selected item
                setBackground(new Color(230, 230, 255));
View Full Code Here


        @Override
        public Component getListCellRendererComponent(
                JList list, Object value, int index,
                boolean isSelected, boolean cellHasFocus) {

            User user = (User) value;
            // Display the text for this item
            setText(user.getName());
            // Set the correct image
            //BufferedImage pic = user.getSmallPic();
            //ImageIcon icon = new ImageIcon(pic);
            //this.setIcon(icon);
            setIcon(ProfilePicResizer.getIcon(user.getSmallPic(), photolen));
            // Draw the correct colors and font
            if (isSelected) {
                // Set the color and font for a selected item
                setBackground(new Color(230, 230, 255));
                setForeground(Color.black);
View Full Code Here

        RoomPane r = getRoomListModel().get(roomid);
        if (r == null) {
            System.err.println("null room in setProfilePic, implement this better.");
            return;
        }
        User u = r.getUser(userid);
        if (u == null) {
            System.err.println("null user in setProfilePic, is presence handling ok?");
            return;
        }
        if (pic == null) { // simply use default "faceless" picture
            System.err.println("pic-null");
            u.setFaceless();
        } else {
            System.err.println("pic-real");
            System.err.println(fullPicURL);
            u.setSmallPic(pic);
            u.setLargePic(fullPicURL);
        }
        /* for testing purpose only. */
        /* System.err.printf("got pic for %s, %s\n", roomid, userid);
        try {
        ImageIO.write(pic, "PNG", new File("test.png"));
View Full Code Here

                    Logger.getLogger(ChatroomClient.class.getName()).log(Level.SEVERE, null, ex);
                    return;
                }
                serverIP = login.getServer();
                // store user object
                user = new User(login.getUsername());
                // remove pane
                ChatroomClient.this.getContentPane().removeAll();
                ((JComponent) ChatroomClient.this.getContentPane()).revalidate();
                ChatroomClient.this.repaint();
                startEntry();
View Full Code Here

        if (room == null) {
            // TODO: private room?
            room = roomList.add(roomid);
            //room = roomList.get(roomid);
        }
        room.addUser(new User(userid));
        getConnection().getParticipantInfo(roomid, userid);
        if(getUserName().equals(userid)) {
            getEntry().enterRoom(room);
        }
    }
View Full Code Here

    }

    private JPanel getUserInfoPanel(int ind) {
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        User u = getUser(ind);
        String name = u.getName();
        BufferedImage pic = u.getSmallPic();
        ImageIcon picIcon = new ImageIcon(pic);
        JLabel nameLabel = new JLabel(name);
        nameLabel.setAlignmentY(Component.CENTER_ALIGNMENT);
        nameLabel.setHorizontalAlignment(JLabel.CENTER);
        JLabel picLabel = new JLabel(picIcon);
View Full Code Here

    }

    private JPanel getUserInfoPanelBig(int ind) {
        JPanel panel = new JPanel();
        panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
        User u = getUser(ind);
        String name = u.getName();
        BufferedImage pic = u.getLargePic();
        if (pic == null) {
            pic = u.getSmallPic();
        }
        ImageIcon picIcon = new ImageIcon(pic);
        JLabel nameLabel = new JLabel(name);
        nameLabel.setAlignmentY(Component.CENTER_ALIGNMENT);
        nameLabel.setHorizontalAlignment(JLabel.CENTER);
View Full Code Here

        try {
            allImage = ImageIO.read(allIconURL);
        } catch (IOException ex) {
            Logger.getLogger(UserSelector.class.getName()).log(Level.SEVERE, null, ex);
        }
        userList.add(0, new User(HTMLTextEditor.allStr, allImage));
        // remove the user himself
        String selfname = ChatroomClient.getClient().getUserName();
        for (int i = 0; i < userList.size(); i++) {
            if (userList.get(i).getName().equals(selfname)) {
                userList.remove(i);
                break;
            }
        }
        final JList selectList = new JList(userList.toArray());
        selectList.setCellRenderer(new UserRenderer());
        //selectList.setLayout(new GridLayout(0,6));
        selectList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        selectList.setVisibleRowCount(-1);
        selectList.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    int index = selectList.locationToIndex(e.getPoint());
                    User u = (User) selectList.getModel().getElementAt(index);
                    UserSelector.this.finialize(u.getName());
                }
            }
        });
        JScrollPane scrollPane = new JScrollPane(selectList);
        //selectPanel.setLayout(new GridLayout(0,6));
View Full Code Here

                    if (eventType == XmlPullParser.START_TAG) {
                        if ("item".equals(tagName)) {
                            String user = xmlParser.getAttributeValue("", "jid");
                            Jid userJid = new Jid(user);
                            if (jid.getRoom().equals(userJid.getRoom())) {
                                allUser.add(new User(userJid.getName()));
                            } else {
                                logger.warning("Got some user from other room ...");
                            }
                        }
                    }
View Full Code Here

TOP

Related Classes of chatroom.client.dataclass.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.