1 Reply Latest reply: Feb 13, 2008 5:33 AM by 843804 RSS

    no keyevents on JTextField when adding it through method

    843804
      Hi all,
      I generated a simple control with axbridge which just has two JTextFields finally.
      The first one is added in the constructor and the second is added by calling doSomething externally (i.e. from HTML/JavaScript testpage).

      The strange about it is that the first textfield can be edited and the second one not... but why?!?!?

      I checked that the textfields are editable and enabled... both were...
      I registered a keylistener for both textfields... I got events from the first textfield but none from the second...

      Here the simple code:
      package axtest;
      
      import java.awt.BorderLayout;
      import javax.swing.JComponent;
      import javax.swing.JTextField;
      
      public class AxTest extends JComponent {
           public AxTest() {
                this.setLayout(new BorderLayout());
                this.add(new JTextField(), BorderLayout.NORTH);
           }
           
           public void doSomething() {
                this.add(new JTextField(), BorderLayout.SOUTH);
                this.validate();
           }
      }
      
      <html>
      <form name="test">
      <input type="button" onclick="document.axtest.doSomething()"/>
      </form>
      <object name="axtest" width="300" height="200" classid="CLSID:65B496AE-BFA3-42A6-B4AD-B6CD515355A1">
      </object>
      </html>