Why this.getX() method is missing in Processing 3.1.1 ?

Is there an alternative to this method? this.getX()


  • It would be helpful if you tell what you want this method to do.

    When you use this in a main program, outside of your own class, you refer to PApplet, which does not have such a method (what do you expect it to return?). If you're talking about some specific class, then, please, tell which one. If it is in your custom created class, you need to provide your own method.

  • This is not my class. this.getX() was in processing 2.

  • edited June 2016

    Method getX() belongs to class Component:

    Given that in P3 the PApplet class stopped extending class Applet, all of those such members don't belong to the former anymore: [-X

  • What do I need to do to take advantage of this.getX?

  • edited June 2016 Answer ✓
    // forum.Processing.org/two/discussion/17270/
    // why-this-getx-method-is-missing-in-processing-3-1-1#Item_5
    // GoToLoop (2016-Jun-24)
    void setup() {
    static final javax.swing.JFrame getJFrame(final PSurface surf) {
  • @gotoloop: thank you but

    I receive

    ClassCastException rcom.jogamp.newt.opengl.GLWindow cannot cast to processing.awt.PSurfaceAWT.SmoothCanvas

    for this part


    maybe because I am on P3D....?

  • yeah

    com.jogamp.newt.opengl.GLWindow win = ((com.jogamp.newt.opengl.GLWindow) surf.getNative());
      return (javax.swing.JFrame)  win.getFrame();

    I always get function getFrame doesn't exist

    any ideas...?

  • @gotoloop could you help please?

    I am on P3D and I always get function getFrame doesn't exist


  • edited March 2017

    @Chrisir, this thread is more than 1 year ago and it's about the "mysterious" getX(), which was available in older Processing versions; and got nothing to do w/ P3D or jogamp! :-@

  • @Chrisir

    What are you trying to do? Do you want to set the position of your sketch window?


  • shall I open a new thread?

    I came here with a suggestion of yours (and one of kfrajer) ;-)

  • edited March 2017
    • Links from old forum threads are for lookups for related subject only. =;
    • They're not "invitations" to dredge old & already answered posts and disturb the OP! :-w
    • Unless we wanna bring in better replies for the old thread, we should create our own. :-\"
Sign In or Register to comment.