Пример #1
0
  /** @return the list of the data flavors */
  public Collection<DataFlavor> getColorDataFlavors() {

    LinkedList<DataFlavor> dataFlavors = new LinkedList<DataFlavor>();

    dataFlavors.add(colorFlavor);
    dataFlavors.add(w3cSVGColorFlavor);

    return dataFlavors;
  }
 public void add(Transferable t) {
   DataFlavor[] f = t.getTransferDataFlavors();
   for (int i = 0; i < f.length; i++) {
     if (!transferables.containsKey(f[i])) {
       flavors.add(f[i]);
     }
     transferables.put(f[i], t);
   }
 }
Пример #3
0
  public void drawsmall(GOut g, Coord br, int h) {
    Coord c;
    if (qline != null) {
      if ((rqline == null) || !rqline.text.equals(qline.line)) {
        String pre = String.format("%s> ", qline.chan.name());
        rqline = qfnd.render(pre + qline.line);
        rqpre = pre.length();
      }
      c = br.sub(0, 20);
      g.chcolor(24, 24, 16, 200);
      g.frect(c, rqline.tex().sz());
      g.chcolor();
      g.image(rqline.tex(), c);
      int lx = rqline.advance(qline.point + rqpre);
      g.line(new Coord(br.x + lx + 1, br.y - 18), new Coord(br.x + lx + 1, br.y - 6), 1);
    } else {
      c = br.sub(0, 5);
    }
    long now = System.currentTimeMillis();
    synchronized (notifs) {
      for (Iterator<Notification> i = notifs.iterator(); i.hasNext(); ) {
        Notification n = i.next();
        if (now - n.time > 5000) {
          i.remove();
          continue;
        }
        if ((c.y -= n.msg.sz().y) < br.y - h) break;

        g.chcolor(24, 24, 16, 200);
        g.frect(c, n.chnm.tex().sz().add(n.msg.tex().sz().x + selw, 0));
        g.chcolor();
        g.image(n.chnm.tex(), c, br.sub(0, h), br.add(selw - 10, 0));
        g.image(n.msg.tex(), c.add(selw, 0));
      }
    }
  }
 /**
  * Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The
  * array should be ordered according to preference for providing the data (from most richly
  * descriptive to least descriptive).
  *
  * @return an array of data flavors in which this data can be transferred
  */
 @Override
 public DataFlavor[] getTransferDataFlavors() {
   return (DataFlavor[]) flavors.toArray(new DataFlavor[transferables.size()]);
 }
Пример #5
0
 public void notify(Channel chan, Channel.Message msg) {
   synchronized (notifs) {
     notifs.addFirst(new Notification(chan, msg));
   }
   Audio.play(notifsfx);
 }