Package org.mt4j

Examples of org.mt4j.MTApplication.invokeLater()


      
        JButton e2 = new JButton("Clear");
        e2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        if (instance.getCurrentScene() != null){
          instance.invokeLater(new Runnable() {
            public void run() {
              MTComponent[] ch = instance.getCurrentScene().getCanvas().getChildren();
              for (int i = 0; i < ch.length; i++) {
                MTComponent mtComponent = ch[i];
                if (!(mtComponent instanceof MTOverlayContainer)){
View Full Code Here


      public void actionPerformed(ActionEvent arg0) {
        if (instance.getCurrentScene() != null){
          //If we want to modify the MT4j applet from the swing thread
          //we should wrap the actions into an invokeLater runnable which
          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              MTRectangle r = new MTRectangle(0,0,ToolsMath.getRandom(50, 250),ToolsMath.getRandom(50, 250), instance);
              r.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              r.addGestureListener(DragProcessor.class, new InertiaDragAction());
              instance.getCurrentScene().getCanvas().addChild(r);
View Full Code Here

      public void actionPerformed(ActionEvent arg0) {
        if (instance.getCurrentScene() != null){
          //If we want to modify the MT4j applet from the swing thread
          //we should wrap the actions into an invokeLater runnable which
          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              float arc = ToolsMath.getRandom(8, 25);
              MTRoundRectangle r = new MTRoundRectangle(0,0,0, ToolsMath.getRandom(50, 250),ToolsMath.getRandom(50, 250), arc, arc, instance);
              r.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              r.addGestureListener(DragProcessor.class, new InertiaDragAction());
View Full Code Here

      public void actionPerformed(ActionEvent arg0) {
        if (instance.getCurrentScene() != null){
          //If we want to modify the MT4j applet from the swing thread
          //we should wrap the actions into an invokeLater runnable which
          //will be executed the next time the mt4j thread runs.
          instance.invokeLater(new Runnable() {
            public void run() {
              MTEllipse e = new MTEllipse(instance, new Vector3D(0,0), ToolsMath.getRandom(50, 150),ToolsMath.getRandom(50, 150));
              e.setFillColor(new MTColor(ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255),ToolsMath.getRandom(50,255)));
              e.addGestureListener(DragProcessor.class, new InertiaDragAction());
              instance.getCurrentScene().getCanvas().addChild(e);
View Full Code Here

   
    @Override
    protected void finalize() throws Throwable {
      if (this.p instanceof MTApplication ) {
      MTApplication mtApp = (MTApplication) this.p;
      mtApp.invokeLater(new Runnable() {
        public void run() {
          deleteTess();
        }
      });
    }else{
View Full Code Here

  @Override
  protected void finalize() throws Throwable {
    logger.debug("Finalizing - " + this);
    if (this.pa instanceof MTApplication) {
      MTApplication mtApp = (MTApplication) this.pa;
      mtApp.invokeLater(new Runnable() {
        public void run() {
          destroy();
        }
      });
    }else{
View Full Code Here

  @Override
  protected void finalize() throws Throwable {
    //System.out.println("Finalizing GLTEXTURE - " + this);
    if (this.app instanceof MTApplication) {
      MTApplication mtApp = (MTApplication) this.app;
      mtApp.invokeLater(new Runnable() {
        public void run() {
          destroy();
        }
      });
    }else{
View Full Code Here

          this.setUseDirectGL(true);
        }else{
          //IF we are useing OpenGL, set useDirectGL to true
          //(=>creates OpenGL texture, draws with pure OpenGL commands)
          //in our main thread.
          app.invokeLater(new Runnable() {
            public void run() {
              setUseDirectGL(true);
            }
          });
        }
View Full Code Here

                  }
                }
              //Per default use direct gl drawing and displaylists in OGL mode
              if (pa instanceof MTApplication) {
                MTApplication app = (MTApplication) pa;
                app.invokeLater(new InvokeLaterAction(shape));
              }
              }
              //IF shape has no or only 1 vertex return null
            }else if (shape.getVerticesLocal().length < 2){
              return null;
View Full Code Here

            rectangle.setPickable(false);
            rectangle.setFillDrawMode(GL.GL_QUADS);

            //Use displaylist by default for gradientshape
            if (MT4jSettings.getInstance().isOpenGlMode()){
              app.invokeLater(new InvokeLaterAction(rectangle));
            }

            //FIXME REMOVE TEST
            /*//Draw the shape we draw in swing
          MTRectangle rectanglePaintedComp = new MTRectangle(new Vertex(boundsVecs[0]), size, size, pa);
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.