Examples of MTImageButton


Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

    this.getCanvas().addChild(tagContainer);
    this.getCanvas().addChild(fotoContainer);
    this.getCanvas().addChild(buttonContainer);
   
    //Button for foto search
    final MTImageButton fotoButton;
//    PImage fotoButtonImg = p.loadImage(System.getProperty("user.dir")+File.separator + "examples"+  File.separator +"advanced"+ File.separator+ File.separator +"modestMapsMT"+ File.separator +  File.separator + "data"+ File.separator +
//        "foto6.png");
    //Load image from classpath
    PImage fotoButtonImg = p.loadImage( "advanced" + MTApplication.separator + "modestMapsMT" + MTApplication.separator + "data" + MTApplication.separator +
    "foto6.png");
    fotoButtonImg.resize((int)(fotoButtonImg.width/1.5f), (int)(fotoButtonImg.height/1.5f));
    fotoButton = new MTImageButton(fotoButtonImg, p);
    fotoButton.setName("fotoButton");
    fotoButton.setNoStroke(true);
    fotoButton.setDepthBufferDisabled(true); //Draw on top of everything
//    fotoButton.translate(new Vector3D(MT4jSettings.getInstance().getScreenWidth() - fotoButton.getWidthXY(TransformSpace.RELATIVE_TO_PARENT) -5, MT4jSettings.getInstance().getScreenHeight()- fotoButton.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) -5, 0));
    fotoButton.translate(new Vector3D(0, MT4jSettings.getInstance().getWindowHeight()- fotoButton.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) , 0));
    fotoButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:
          Point[] p = getScreenPoints();
          for (int i = 0; i < p.length; i++) {
            Point point = p[i];
            Location loc = map.pointLocation(point.x ,point.y);
            getPictures(loc, getAccuracyForZoom(map), true);
          }
          getPictures(map.getCenter(), getAccuracyForZoom(map), false);
        }
      }
    });
    fotoButton.setTextureEnabled(true);
    fotoButton.setUseDirectGL(true);
    this.buttonContainer.addChild(fotoButton);
   
    tagToPhoto = new HashMap<MTEllipse, Photo>();
   
    /// Create map provider menu \\\
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

    //Load from classpath
    PImage keyboardImg = app.loadImage("advanced" + MTApplication.separator + "flickrMT"+ MTApplication.separator + "data"+ MTApplication.separator
//        + "keyb2.png");
        + "keyb128.png");
   
    final MTImageButton keyboardButton = new MTImageButton(keyboardImg, app);
    keyboardButton.setFillColor(new MTColor(255,255,255,200));
    keyboardButton.setName("KeyboardButton");
    keyboardButton.setNoStroke(true);
//    keyboardButton.translateGlobal(new Vector3D(5,5,0));
    keyboardButton.translateGlobal(new Vector3D(-2,app.height-keyboardButton.getWidthXY(TransformSpace.GLOBAL)+2,0));
    topLayer.addChild(keyboardButton);

//    progressBar = new MTProgressBar(app, app.loadFont(MT4jSettings.getInstance().getDefaultFontPath()+ "Ziggurat.vlw"));
    progressBar = new MTProgressBar(app, app.createFont("arial", 18));
   
    progressBar.setDepthBufferDisabled(true);
    progressBar.setVisible(false);
    topLayer.addChild(progressBar);
   
    keyboardButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:
          //Flickr Keyboard
              MTKeyboard keyb = new MTKeyboard(app);
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

    this.getCanvas().addChild(textField);
    textField.setPositionGlobal(new Vector3D(mtApplication.width/2f, mtApplication.height/2f));
   
    //Button to change to the previous scene on the scene stack
    PImage arrow = mtApplication.loadImage(imagePath + "arrowRight.png");
    MTImageButton previousSceneButton = new MTImageButton(arrow, mtApplication);
    previousSceneButton.setNoStroke(true);
    if (MT4jSettings.getInstance().isOpenGlMode())
      previousSceneButton.setUseDirectGL(true);
    previousSceneButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:
          mtApp.popScene();
          break;
        default:
          break;
        }
      }
    });
    getCanvas().addChild(previousSceneButton);
    previousSceneButton.scale(-1, 1, 1, previousSceneButton.getCenterPointLocal(), TransformSpace.LOCAL);
    previousSceneButton.setPositionGlobal(new Vector3D(previousSceneButton.getWidthXY(TransformSpace.GLOBAL) + 5, mtApp.height - previousSceneButton.getHeightXY(TransformSpace.GLOBAL) - 5, 0));
   
    //Button to get to the next scene
    MTImageButton nextSceneButton = new MTImageButton(arrow, mtApplication);
    nextSceneButton.setNoStroke(true);
    if (MT4jSettings.getInstance().isOpenGlMode())
      nextSceneButton.setUseDirectGL(true);
    nextSceneButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:
          //Save the current scene on the scene stack before changing
          mtApp.pushScene();
          if (scene3 == null){
            scene3 = new Scene3(mtApp, "Scene 3");
            mtApp.addScene(scene3);
          }
          //Do the scene change
          mtApp.changeScene(scene3);
          break;
        default:
          break;
        }
      }
    });
    getCanvas().addChild(nextSceneButton);
    nextSceneButton.setPositionGlobal(new Vector3D(mtApp.width - nextSceneButton.getWidthXY(TransformSpace.GLOBAL) - 5, mtApp.height - nextSceneButton.getHeightXY(TransformSpace.GLOBAL) - 5, 0));

    //Set a scene transition - Flip transition only available using opengl supporting the FBO extenstion
    if (MT4jSettings.getInstance().isOpenGlMode() && GLFBO.isSupported(mtApp))
      this.setTransition(new SlideTransition(mtApp, 700));
    else{
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

    this.getCanvas().addChild(textField);
    textField.setPositionGlobal(new Vector3D(mtApp.width/2f, mtApp.height/2f));
   
    //Button to get to the next scene
    PImage arrow = mtApplication.loadImage(imagePath +  "arrowRight.png");
    MTImageButton nextSceneButton = new MTImageButton(arrow, mtApplication);
    nextSceneButton.setNoStroke(true);
    if (MT4jSettings.getInstance().isOpenGlMode())
      nextSceneButton.setUseDirectGL(true);
    nextSceneButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:
          //Save the current scene on the scene stack before changing
          mtApp.pushScene();
          if (scene2 == null){
            scene2 = new Scene2(mtApp, "Scene 2");
            //Add the scene to the mt application
            mtApp.addScene(scene2);
          }
          //Do the scene change
          mtApp.changeScene(scene2);
          break;
        default:
          break;
        }
      }
    });
    getCanvas().addChild(nextSceneButton);
    nextSceneButton.setPositionGlobal(new Vector3D(mtApp.width - nextSceneButton.getWidthXY(TransformSpace.GLOBAL) - 5, mtApp.height - nextSceneButton.getHeightXY(TransformSpace.GLOBAL) - 5, 0));
   
    //Set a scene transition - Flip transition only available using opengl supporting the FBO extenstion
    if (MT4jSettings.getInstance().isOpenGlMode() && GLFBO.isSupported(mtApp))
      this.setTransition(new BlendTransition(mtApp, 700));
    else{
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

    this.getCanvas().addChild(textField);
    textField.setPositionGlobal(new Vector3D(mtApplication.width/2f, mtApplication.height/2f));
   
    //Button to return to the previous scene
    PImage arrow = mtApplication.loadImage(imagePath + "arrowRight.png");
    MTImageButton previousSceneButton = new MTImageButton(arrow, mtApplication);
    previousSceneButton.setNoStroke(true);
    if (MT4jSettings.getInstance().isOpenGlMode())
      previousSceneButton.setUseDirectGL(true);
    previousSceneButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:
          mtApp.popScene();
          break;
        default:
          break;
        }
      }
    });
    getCanvas().addChild(previousSceneButton);
    previousSceneButton.scale(-1, 1, 1, previousSceneButton.getCenterPointLocal(), TransformSpace.LOCAL);
    previousSceneButton.setPositionGlobal(new Vector3D(previousSceneButton.getWidthXY(TransformSpace.GLOBAL) + 5, mtApp.height - previousSceneButton.getHeightXY(TransformSpace.GLOBAL) - 5, 0));
   
    //Set a scene transition - Flip transition only available using opengl supporting the FBO extenstion
    if (MT4jSettings.getInstance().isOpenGlMode() && GLFBO.isSupported(mtApp))
      this.setTransition(new FlipTransition(mtApp, 700));
    else{
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

//      "124241-matte-white-square-icon-alphanumeric-circled-x3_cr.png"
//      "124241-matte-white-square-icon-alphanumeric-circled-x3128.png"
        "closeButton64.png"
      );
    }
    MTImageButton closeButton = new MTImageButton(closeButtonImage, applet);
    closeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent r) {
        switch (r.getID()) {
        case TapEvent.BUTTON_CLICKED:
          close();
//          destroy();
          break;
        default:
          break;
        }
      }
    });
    this.addChild(closeButton);
    closeButton.setNoStroke(true);
//    closeButton.setSizeXYRelativeToParent(borderWidth - borderWidth/20, borderWidth - borderWidth/20);
    closeButton.setSizeXYRelativeToParent(borderWidth - borderWidth/30, borderWidth - borderWidth/30);
//    closeButton.setSizeXYRelativeToParent(borderWidth -0.5f, borderWidth-0.5f);
    closeButton.setPositionRelativeToParent(new Vector3D( (applet.width+ (borderWidth /2f)), borderHeight - 5));
   
    if (maximizeButtonImage == null){
      maximizeButtonImage = applet.loadImage(MT4jSettings.getInstance().getDefaultImagesPath() +
//      "window_app_blank_32.png")
//      "127941-simple-black-square-icon-symbols-shapes-maximize-button_cr.png"
      "maximizeButton64.png"
      );
    }
    MTImageButton maximizeButton = new MTImageButton(maximizeButtonImage, applet);
    maximizeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent r) {
        switch (r.getID()) {
        case TapEvent.BUTTON_CLICKED:
          maximize();
          break;
        default:
          break;
        }
      }
    });
    this.addChild(maximizeButton);
    maximizeButton.setNoStroke(true);
//    maximizeButton.setSizeXYRelativeToParent(borderWidth - borderWidth/10, borderWidth - borderWidth/10);
    maximizeButton.setSizeXYRelativeToParent(borderWidth - borderWidth/30, borderWidth - borderWidth/30);
//    maximizeButton.setPositionRelativeToParent(new Vector3D( (applet.width+2*borderWidth)-maximizeButton.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), closeButton.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) + 40));
//    maximizeButton.setPositionRelativeToParent(new Vector3D( (applet.width+ (borderWidth /2f)), borderHeight + closeButton.getHeightXY(TransformSpace.RELATIVE_TO_PARENT) + 15));
    maximizeButton.setPositionRelativeToParent(new Vector3D( (applet.width+ (borderWidth /2f)), applet.height - closeButton.getHeightXY(TransformSpace.RELATIVE_TO_PARENT)/2f));
   
  }
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

        sceneTexture.setStrokeColor(new MTColor(155,155,155));
        frame.addChild(sceneTexture);
       
        //Eraser button
        PImage eraser = pa.loadImage(imagesPath + "Kde_crystalsvg_eraser.png");
        MTImageButton b = new MTImageButton(eraser, pa);
        b.setNoStroke(true);
        b.translate(new Vector3D(-50,0,0));
        b.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
//          //As we are messing with opengl here, we make sure it happens in the rendering thread
          pa.invokeLater(new Runnable() {
            public void run() {
              sceneTexture.getFbo().clear(true, 255, 255, 255, 0, true);           
            }
          });
        }break;
        default:
          break;
        }
      }
        });
        frame.addChild(b);
       
        //Pen brush selector button
        PImage penIcon = pa.loadImage(imagesPath + "pen.png");
        final MTImageButton penButton = new MTImageButton(penIcon, pa);
        frame.addChild(penButton);
        penButton.translate(new Vector3D(-50f, 65,0));
        penButton.setNoStroke(true);
        penButton.setStrokeColor(new MTColor(0,0,0));
       
        //Texture brush selector button
        PImage brushIcon = pa.loadImage(imagesPath + "paintbrush.png");
        final MTImageButton brushButton = new MTImageButton(brushIcon, pa);
        frame.addChild(brushButton);
        brushButton.translate(new Vector3D(-50f, 130,0));
        brushButton.setStrokeColor(new MTColor(0,0,0));
        brushButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
          drawingScene.setBrush(textureBrush);
          brushButton.setNoStroke(false);
          penButton.setNoStroke(true);
        }break;
        default:
          break;
        }
      }
        });
       
        penButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
          drawingScene.setBrush(pencilBrush);
          penButton.setNoStroke(false);
          brushButton.setNoStroke(true);
        }break;
        default:
          break;
        }
      }
        });
       
        //Save to file button
        PImage floppyIcon = pa.loadImage(imagesPath + "floppy.png");
        final MTImageButton floppyButton = new MTImageButton(floppyIcon, pa);
        frame.addChild(floppyButton);
        floppyButton.translate(new Vector3D(-50f, 260,0));
        floppyButton.setNoStroke(true);
        floppyButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
//          pa.invokeLater(new Runnable() {
//            public void run() {
//              drawingScene.getCanvas().drawAndUpdateCanvas(pa.g, 0);
//              pa.saveFrame();
//              clear(pa.g);
//            }
//          });
          drawingScene.registerPreDrawAction(new IPreDrawAction() {
            public void processAction() {
              //drawingScene.getCanvas().drawAndUpdateCanvas(pa.g, 0);
              pa.saveFrame();
            }
            public boolean isLoop() {
              return false;
            }
          });
        }break;
        default:
          break;
        }
      }
        });
       
        /////////////////////////
        //ColorPicker and colorpicker button
        PImage colPick = pa.loadImage(imagesPath + "colorcircle.png");
//        final MTColorPicker colorWidget = new MTColorPicker(0, pa.height-colPick.height, colPick, pa);
        final MTColorPicker colorWidget = new MTColorPicker(0, 0, colPick, pa);
        colorWidget.translate(new Vector3D(0f, 135,0));
        colorWidget.setStrokeColor(new MTColor(0,0,0));
        colorWidget.addGestureListener(DragProcessor.class, new IGestureEventListener() {
      public boolean processGestureEvent(MTGestureEvent ge) {
        if (ge.getId()== MTGestureEvent.GESTURE_ENDED){
          if (colorWidget.isVisible()){
            colorWidget.setVisible(false);
          }
        }else{
          drawingScene.setBrushColor(colorWidget.getSelectedColor());
        }
        return false;
      }
    });
        frame.addChild(colorWidget);
        colorWidget.setVisible(false);
       
        PImage colPickIcon = pa.loadImage(imagesPath + "ColorPickerIcon.png");
        MTImageButton colPickButton = new MTImageButton(colPickIcon, pa);
        frame.addChild(colPickButton);
        colPickButton.translate(new Vector3D(-50f, 195,0));
        colPickButton.setNoStroke(true);
        colPickButton.addActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent ae) {
        switch (ae.getID()) {
        case TapEvent.BUTTON_CLICKED:{
          if (colorWidget.isVisible()){
            colorWidget.setVisible(false);
View Full Code Here

Examples of org.mt4j.components.visibleComponents.widgets.buttons.MTImageButton

   
   
    //Close button
    PImage closeButtonImage = app.loadImage(MT4jSettings.getInstance().getDefaultImagesPath() +
    "closeButton64.png");
    closeButton = new MTImageButton(closeButtonImage, app);
    closeButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent r) {
        switch (r.getID()) {
        case TapEvent.BUTTON_CLICKED:
          close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.