Nyx
Nyx

Reputation: 1374

Netbeans GUI Builder Private Members

I have an existing project for which i have decided to create a GUI for in Netbeans. The problem I am encountering is the fact that every component that i drag-and-drop is private in the source and is unmodifiable. Must i create getters for everything?

I mainly just need this problem resolved for appending to the TextArea.

Thank you in advance

Upvotes: 0

Views: 438

Answers (3)

BillRobertson42
BillRobertson42

Reputation: 12883

If you want to change that globally, go to the options dialog, then select miscellaneous, and pick the gui builder tab. You can configure the default modifier there.

Upvotes: 2

trashgod
trashgod

Reputation: 205795

By right clicking on a component in the Inspector panel, you can influence the generated code, even though it is in an editor-fold and not directly editable. For example, right click on a JList and edit the Properties > model to add text entries; right click on Code > Post Creation Code to add a code snippet affecting the selection model:

itemList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

Examine the code in the editor-fold to see the generated changes.

See also Introduction to GUI Building.

Upvotes: 1

Logan
Logan

Reputation: 2364

You should see some tags in the code, something to do with begin and end of variable area. Usually there are 2 different sets of tags, any code between those tags will regenerate when you modify the gui with the form builder.

You can write your own code outside of those tags and it should remain even after you make changes. Getters and setters are a good idea if you need to update your object from another class. I've done that before with some text areas where I had a utility class update the text in it.

Upvotes: 0

Related Questions