Package lounge.gatheringlounge

Source Code of lounge.gatheringlounge.FriendListRenderer

/**
*
* @author Tom Naessens Tom.Naessens@UGent.be 2de Bachelor Informatica Universiteit Gent
*
*/
package lounge.gatheringlounge;

import java.awt.Component;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import userManagement.Friend;

public class FriendListRenderer extends JLabel implements ListCellRenderer {

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

    Friend friend = (Friend) value;

    if (isSelected) {
      setBackground(list.getSelectionBackground());
      setForeground(list.getSelectionForeground());
    } else {
      setBackground(list.getBackground());
      setForeground(list.getForeground());
    }

    SquareIcon icon = new SquareIcon(friend.getStatus().getColor(), 10, getHorizontalAlignment(), 10, 10);
    setOpaque(true);
   
    setText(friend.getAlias());
   
    setIcon(icon);
    setIconTextGap(15);

    return this;

  }
}
TOP

Related Classes of lounge.gatheringlounge.FriendListRenderer

TOP
Copyright © 2018 www.massapi.com. 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.