GuruKulki
GuruKulki

Reputation: 26418

Increasing the size of the Text field

I am using org.eclipse.swt.widgets.Text's type of Text field. I want to increase the length of the field. How would I do this?

Upvotes: 5

Views: 23663

Answers (3)

Chris Dennett
Chris Dennett

Reputation: 22721

For each field, if your general layout manager is GridLayout, your textbox layout data will be GridData. Pass width and height into the GridData constructor and set it to the textbox (textbox.setLayoutData()), along with the properties about how you want the layout manager to manipulate the field.

Upvotes: 11

stacker
stacker

Reputation: 68962

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Text.html

Text inherits these methods from Control:

public void setSize(int width,int height)
public void setSize(Point size)

Upvotes: 1

bkritzer
bkritzer

Reputation: 1416

Since Text is a control, it inherits the method: Text.setSize(width, height). This lets you set the actual dimensions of the Text field. Change the width to be something larger. You might also want to keep the height the same by doing something like

textField.setSize(width, textField.getSize().y)

Upvotes: 4

Related Questions