コード例 #1
0
 @Override
 public void paint(SimpleGraphics graphics) {
   int textSize =
       CrossCuttingProperty.getInstance().getProperty(KEY_TEXTSIZE, graphics.getTextSize());
   int textColor =
       CrossCuttingProperty.getInstance().getProperty(KEY_MENUCOLOR, SimpleGraphicUtil.GREEN);
   int x = SimpleCircleControllerMenuPlus.this.getCenterX();
   int y = SimpleCircleControllerMenuPlus.this.getCenterY();
   int radius = SimpleCircleControllerMenuPlus.this.getMinRadius();
   graphics.setTextSize(textSize);
   graphics.setColor(textColor);
   graphics.setStrokeWidth(3);
   graphics.drawCircle(x + mCurrentX, y + mCurrentY, radius * 4 / 5);
   graphics.drawCircle(x + mCurrentX, y + mCurrentY, radius * 3 / 5);
 }
コード例 #2
0
ファイル: Main.java プロジェクト: ruanhouli/KyoroText
 @Override
 public void paint(SimpleGraphics graphics) {
   //			System.out.println("begin paint");
   SimpleGraphicsForJ2SE graj2se = (SimpleGraphicsForJ2SE) graphics;
   graj2se.drawBackGround(0xAAFFFF00);
   graphics.setColor(0xFFFF0000);
   // graphics.drawLine(0, 0, 100, 100);
   graphics.drawCircle(0, 0, 100);
   // graphics.setColor(0xFFFF00);
   // graj2se.setTextSize(20);
   // graj2se.drawText("text", 50, 50);
   float[] widths = {10, 10, 10, 10, 10, 10};
   graj2se.drawPosText("abcd".toCharArray(), widths, (float) 1.5, 0, 3, 50, 50);
   //			System.out.println("end paint");
 }
コード例 #3
0
 @Override
 public void paint(SimpleGraphics graphics) {
   super.paint(graphics);
   graphics.setColor(SimpleGraphicUtil.BLACK);
   //		graphics.drawText(_message, 10, 10);
 }
コード例 #4
0
    @Override
    public void paint(SimpleGraphics graphics) {
      int x = SimpleCircleControllerMenuPlus.this.getCenterX();
      int y = SimpleCircleControllerMenuPlus.this.getCenterY();
      int radius = SimpleCircleControllerMenuPlus.this.getMaxRadius();
      int radiusN = SimpleCircleControllerMenuPlus.this.getMaxRadius() * 3 * 3 / 4;
      if (mFocus) {
        graphics.setColor(SimpleGraphicUtil.GREEN);
        graphics.setStrokeWidth(1);
        graphics.drawCircle(x, y, radiusN * 4 / 5);
        graphics.drawCircle(x, y, radiusN * 3 / 5);

        int div = 16;
        // int div = 18;
        double angle = Math.PI * 2 / div;

        // �ス�ス�スン位置
        double p = 0;
        p = Math.atan2(-mButton.getYY(), mButton.getXX());
        int curDegree = (int) Math.toDegrees(p); // - 90;

        // 90�スx�ス�ス�ス迯�ソスレ追会ソス
        curDegree -= 90 - (360 / div / 2);
        //
        int base = ((360 * 2 + curDegree) % 360) / (360 / div);
        int selected = base;
        // android.util.Log.v("kiyo","po="+selected+","+(360 /
        // div)+","+curDegree);

        for (int i = 0; i < div; i++) {
          double a = angle * i + Math.PI / 2;
          double extra = 0;
          extra = Math.PI / 36 / 2;
          if (i - 1 == selected) {
            a += extra;
          } else if (i + 1 == selected) {
            a -= extra;
          }
          if (i == selected) {
            graphics.setColor(SimpleGraphicUtil.YELLOW);
          } else {
            int textColor =
                CrossCuttingProperty.getInstance()
                    .getProperty(KEY_MENUCOLOR, SimpleGraphicUtil.GREEN);
            graphics.setColor(textColor);
          }

          graphics.drawLine(
              (int) (radius * Math.cos(a)) + getCenterX(),
              (int) (radius * -1 * Math.sin(a)) + getCenterY(),
              (int) (radiusN * Math.cos(a)) + getCenterX(),
              (int) (radiusN * -1 * Math.sin(a)) + getCenterY());
          if (i < itemList.size()) {
            graphics.drawText(
                itemList.get(i).title,
                (int) (radiusN * Math.cos(a)) + getCenterX(),
                (int) (radiusN * -1 * Math.sin(a)) + getCenterY());
          }
        }

        int radiusM = SimpleCircleControllerMenuPlus.this.getMaxRadius();
        if (mButton.getXX() * mButton.getXX() + mButton.getYY() * mButton.getYY()
                > radiusM * radiusM
            || (mButton.getXX() >= getWidth() + getMinRadius() / 2
                && mButton.getYY() >= getHeight() + getMinRadius() / 2)) {
          if (selected < itemList.size()) {
            if (mListener.selected(itemList.get(selected).id, itemList.get(selected).title)) {
              mFocus = false;
              // todo
              SimpleCircleControllerMenuPlus.this.mFocus = false;
              SimpleCircleControllerMenuPlus.this.mButton.mCurrentX = 0;
              SimpleCircleControllerMenuPlus.this.mButton.mCurrentY = 0;
            }
          } else if (selected >= itemList.size()) {
            if (isMinimized()) {
              maxmize();
              mFocus = false;
            } else {
              minmize();
              mFocus = false;
            }
          }
        }
      }
    }