Exemple #1
0
 @Override
 public void run() {
   view = new View(ViewFeature.USER_SCROLL);
   view.add(new TestElement());
   draw();
   view.addEventListener(this);
 }
Exemple #2
0
 private void draw() {
   Canvas canvas = view.getBackground();
   canvas.setColor(Color.BLUE);
   canvas.setAntiAliasing(true);
   canvas.fill();
   canvas.setColor(Color.WHITE);
   canvas.drawCircle(0, 0, 1);
   canvas.drawEllipse(0, 0, 3, 2);
   canvas.setTextSize(20);
   canvas.drawText(3, 3, "Scale=" + view.getScale());
   canvas.drawRectangle(2, 2, 4, 4);
   canvas.drawImage(2, 2, new Image("res:drawable/spain.jpg"));
   canvas.drawImage(2, 2, Image.JEDA_LOGO_64x64);
   canvas.drawLine(1, 1, 3, 1);
 }
Exemple #3
0
  @Override
  public void onKeyDown(KeyEvent event) {
    if (event.getKey() == Key.UP) {
      view.setScale(view.getScale() * 1.1);
      draw();
    }

    if (event.getKey() == Key.DOWN) {
      view.setScale(view.getScale() / 1.1);
      draw();
    }

    if (event.getKey() == Key.LEFT) {
      view.translate(-0.01, 0);
      draw();
    }
  }