コード例 #1
0
  public void drawScene(Graphics g) {
    boolean darker = false;

    int halfwidth = size().width / 2;
    int halfheight = size().height / 2;

    for (int i = 0; i < npoint; i++) {
      SequencePoint sp = (SequencePoint) points.elementAt(i);
      int x = (int) ((float) (sp.coord[0] - centre[0]) * scale) + halfwidth;
      int y = (int) ((float) (sp.coord[1] - centre[1]) * scale) + halfheight;
      float z = sp.coord[1] - centre[2];
      if (sp.sequence instanceof DrawableSequence) {
        if (((DrawableSequence) sp.sequence).color == Color.black) {
          g.setColor(Color.white);
        } else {
          g.setColor(((DrawableSequence) sp.sequence).color);
        }
      } else {
        g.setColor(Color.red);
      }
      if (av != null) {
        if (av.getSelection().contains(((SequencePoint) points.elementAt(i)).sequence)) {
          g.setColor(Color.gray);
        }
      }
      if (z < 0) {
        g.setColor(g.getColor().darker());
      }

      g.fillRect(x - 3, y - 3, 6, 6);
      g.setColor(Color.red);
    }
    //    //Now the rectangle
    //    if (rectx2 != -1 && recty2 != -1) {
    //      g.setColor(Color.white);
    //
    //      g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);
    //    }
  }
コード例 #2
0
 public void drawBackground(Graphics g, Color col) {
   g.setColor(col);
   g.fillRect(0, 0, prefsize.width, prefsize.height);
 }