#14 jaxeTextPane.requestFocus()

open
nobody
None
5
2009-02-25
2009-02-25
No

I think it is a coorect action to add code bellow into Jaxe's frame. Code updates menu etc.

this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent e) {
jaxeTextPane.requestFocus();
}
});

Discussion

  • Damien Guillaume

    I tried that before, and it caused endless loops with some configurations, freezing Jaxe. I tried many other ways to get the focus in the text pane when the window is activated, but all triggered some kind of JVM bug. After spending years on that issue, I had to give up. Maybe this would work with recent versions of Java, but I would have to do lots of testing to find out on what version it works...

     
  • Vladimir Bogdanov

    In my jdk1.5.0_10 for windows this works good, but i rewrote frame completely.

    It is strange to listen that. This is too common actions to have bugs. I think that there is some code in textPane or jaxeFrame or somewhere else which just creates an infinite loop.

     
  • Vladimir Bogdanov

    I wanted to say that we met such problems in powerbuilder (not java, but ...) In all cases when such problems occured there was some peaces of code which rival for focus.

     
  • Vladimir Bogdanov

    Yes. This error occures when we open a second frame. Then that windows start to switch one to another and back again. So I move the code into the method which is called in openDocument and newDocument methods. And now everything works good.
    Something like that:

    removeComponentListener(this);
    addComponentListener(this);
    validate();

    jaxeTextPane.requestFocus();
    }

     
  • Vladimir Bogdanov

    Sory.
    It is not work
    That was mirage. :-(

     
  • Vladimir Bogdanov

    It is a shamanism. :-(
    Now it is works after:
    attente.dispose();
    setCursor(null);
    toFront();

    jaxeTextPane.requestFocus();
    }

    Well. I will examine this again tomorow morning :-D

     

Log in to post a comment.