コード例 #1
0
 private void drawScreenFrame(Graphics2D g2d, int scrId) {
   g2d.setColor(screenFrameColor);
   g2d.setStroke(strokeScreenFrame);
   if (screenFrame == null) {
     screenFrame = Screen.getBounds(scrId);
     Rectangle ubound = scrOCP.getBounds();
     screenFrame.x -= ubound.x;
     screenFrame.y -= ubound.y;
     int sw = (int) (strokeScreenFrame.getLineWidth() / 2);
     screenFrame.x += sw;
     screenFrame.y += sw;
     screenFrame.width -= sw * 2;
     screenFrame.height -= sw * 2;
   }
   g2d.draw(screenFrame);
 }
コード例 #2
0
ファイル: JCanvas.java プロジェクト: xaleth09/Connect4-AI
 public void drawDashedLine(int d, int x1, int y1, int x2, int y2) {
   Stroke s = getStroke();
   float w = 1;
   int c = BasicStroke.CAP_BUTT;
   int j = BasicStroke.JOIN_MITER;
   float ml = 0;
   float[] dp = {d, d};
   if (s instanceof BasicStroke) {
     BasicStroke b = (BasicStroke) s;
     w = b.getLineWidth();
     c = b.getEndCap();
     j = b.getLineJoin();
     ml = b.getMiterLimit();
   }
   setStroke(new BasicStroke(w, c, j, ml, dp, 0));
   drawLine(x1, y1, x2, y2);
   setStroke(s);
 }
コード例 #3
0
ファイル: JCanvas.java プロジェクト: xaleth09/Connect4-AI
  /** [Internal] */
  public String obj2str(Object o) {
    if (o == null) return "-null-";
    String s = "";
    if (o instanceof Object[]) {
      Object[] a = (Object[]) o;
      for (Object ox : a) s = s + " " + ox;
    } else if (o instanceof BasicStroke) {
      BasicStroke o1 = (BasicStroke) o;
      s =
          "BasicStroke("
              + o1.getLineWidth()
              + ","
              + o1.getDashPhase()
              + ","
              + o1.getLineJoin()
              + ","
              + o1.getMiterLimit()
              + ","
              + o1.getEndCap();

    } else s = "" + o;
    return s;
  }