Package org.ggp.base.util.presence

Examples of org.ggp.base.util.presence.PlayerPresence


        setForeground(list.getForeground());
      }

      if (value == null) return this;

      PlayerPresence presence = thePresenceManager.getPresence(value.toString());
      String status = presence.getStatus();
      if (status != null) status = status.toLowerCase();

      int iconSize = 20;

      BufferedImage img = new BufferedImage( iconSize, iconSize, BufferedImage.TYPE_INT_RGB );
      Graphics g = img.getGraphics();
      g.setColor( getBackground() );
      g.fillRect( 0, 0, iconSize, iconSize );
      if (status == null) {
        g.setColor(Color.GRAY);
      } else if (status.equals("available")) {
        g.setColor(Color.GREEN);
      } else if (status.equals("busy")) {
        g.setColor(Color.ORANGE);
      } else if (status.equals("error")) {
        g.setColor(Color.BLACK);
      } else {
        g.setColor(Color.MAGENTA);
      }

      g.fillOval( 3, 3, iconSize-6, iconSize-6 );

      String textLabel = presence.getHost() + ":" + presence.getPort();
      if (presence.getName() != null) {
        textLabel = presence.getName() + " (" + textLabel + ")";
      }
      if (textLabel.length() > maxLabelLength) {
        textLabel = textLabel.substring(0, maxLabelLength-3) + "...";
      }
View Full Code Here

TOP

Related Classes of org.ggp.base.util.presence.PlayerPresence

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.