/** * Returns the Avatar in the form of an <code>ImageIcon</code>. * * @param vcard the vCard containing the avatar. * @return the ImageIcon or null if no avatar was present. */ public static ImageIcon getAvatarIcon(VCard vcard) { // Set avatar byte[] bytes = vcard.getAvatar(); if (bytes != null && bytes.length > 0) { ImageIcon icon = new ImageIcon(bytes); return GraphicUtils.scaleImageIcon(icon, 40, 40); } return null; }
/** * Builds the UI based on a VCard. * * @param vcard * the vcard used to build the UI. */ private void buildUI(VCard vcard) { fillUI(vcard); // Set Avatar byte[] bytes = vcard.getAvatar(); if (bytes != null && bytes.length > 0) { ImageIcon icon = new ImageIcon(bytes); // See if we should remove the Avatar tab in profile dialog if (!Default.getBoolean("DISABLE_AVATAR_TAB") && Enterprise.containsFeature(Enterprise.AVATAR_TAB_FEATURE)) { avatarPanel.setAvatar(icon); avatarPanel.setAvatarBytes(bytes); } if (avatarLabel != null) { icon = GraphicUtils.scaleImageIcon(icon, 48, 48); avatarLabel.setIcon(icon); } } }
URL imageURL = downloadedFile.toURI().toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image);
icon = GraphicUtils.scaleImageIcon(icon, 96, 96); avatarLabel.setIcon(icon);
URL imageURL = new File(transfer.getFilePath()).toURI().toURL(); ImageIcon image = new ImageIcon(imageURL); image = GraphicUtils.scaleImageIcon(image, 64, 64); imageLabel.setIcon(image);