TextField: How do I set the Top/Left properties of a textField at runtime?

  1. Drag and drop a textField and a button onto the page.
  2. Double click on the button to go to the button1_action method.
  3. Type the following line of code in the button action method
    textField1.setStyle("left: 100px; top: 100px; position: absolute");
    Note: Make sure the values you are giving for left and top positions are different from the ones currently.
  4. Save and run the application.
  5. When the page loads click on the button. You will notice that the position of the textField changes once the page is rendered again.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo