public void reset() { Contact c = selectedContact; if (c != null) { name.setText(c.getName()); try { ImageIcon icon = new ImageIcon( (ResourceHelper.getImageObject(c.getImageLoc())) .getScaledInstance(110, 100, Image.SCALE_DEFAULT)); picture.setIcon(icon); } catch (Exception ex) { picture.setIcon(null); System.out.println("DetPane > changeContact(...) > Error in setting image : " + ex); } detail1.setText(""); detail2.setText(""); if (c.getSummary() != null) { String[] smry = c.getSummary(); if (smry.length >= 1) { detail1.setText(smry[0]); } else { detail1.setText(""); } if (smry.length >= 2) { detail2.setText(smry[1]); } else { detail2.setText(""); } } } resetDetailPane(); }
public void resetDetailPane() { detailPane.removeAll(); Dimension d = new Dimension(0, 3); detailPane.setOpaque(false); detPaneHolder.setOpaque(false); if (selectedContact != null && selectedContact.getProperties() != null) { String[][] properties = selectedContact.getProperties(); for (String[] property : properties) { javax.swing.JSeparator space = new JSeparator(SwingConstants.HORIZONTAL); space.setSize(d); detailPane.add(space); DetInnerPaneBlocks dipb = new DetInnerPaneBlocks(property[0], property[1]); detailPane.add(dipb); } detailPane.add(Box.createGlue()); detailPane.setSize(0, (DetInnerPaneBlocks.height + d.height) * properties.length); } else { detailPane.setSize(0, 0); } resetDetPaneHolderSize(); }
/** Diese Methode extrahiert die Daten den Kontakts und zeigt sie auf der Gui an. */ private void initContactInfo() { lblValid.setText("" + contact.getId()); lblVallasttime.setText("" + (new Date(contact.getLast_time_contacted()))); lblValname.setText(contact.getDisplay_name()); if (contact.getOrganisationName() != null) lblValorga.setText(contact.getOrganisationName()); if (contact.getOrganisationStatus() != null) lblValstatus.setText(contact.getOrganisationStatus()); lblValtimes.setText("" + contact.getTimes_contacted()); String temp = ""; if (contact.getEmails() != null) { for (String s : contact.getEmails()) temp += s + "\n"; } areaEmails.setText(temp); temp = ""; if (contact.getEmails() != null) { for (String s : contact.getNotes()) temp += s + "\n"; } areaNotes.setText(temp); temp = ""; if (contact.getEmails() != null) { for (String s : contact.getMessaging()) temp += s + "\n"; } areaMessaging.setText(temp); temp = ""; if (contact.getEmails() != null) { for (String s : contact.getPhones()) temp += s + "\n"; } areaPhones.setText(temp); temp = ""; if (contact.getStreet() != null) temp += contact.getStreet() + "\n"; if (contact.getCity() != null) temp += contact.getCity() + "\n"; if (contact.getRegion() != null) temp += contact.getRegion() + " "; if (contact.getCountry() != null) temp += contact.getCountry(); areaAdress.setText(temp); if (contact.getPhoto() != null) { ImageIcon image = new ImageIcon(contact.getPhoto()); Image img = image.getImage(); Image newimg = img.getScaledInstance(145, 145, java.awt.Image.SCALE_SMOOTH); lblPicture.setIcon(new ImageIcon(newimg)); lblPicture.setBounds(lblPicture.getX(), lblPicture.getY(), 145, 145); } }