Skip to main content

Edit Components

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
dlingenf
Offline
Joined: 2011-03-25

I have designed a project in the Resource Editor GUI and generated a Netbeans project. My question is, how do I get a reference to a specific component on a form? I have the before show event in my StateMachine. I've tried numerous combinations of findByName() and even the methods in StateMachineBase so on but I can't seem to get it right. Any hints would be helpful. Thanks!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07

The resource editor should automatically generate for you the findComponentName(Container) method you need.
In the GUI select the component you want and copy the value of the name attribute e.g.:

<br />
    protected void beforeMain(Form f) {<br />
          findMyComponent(f).setText("X");<br />
          ((TextField)findByName("my component", f)).setText("Y");<br />
    }<br />