Increasing the size of the Text field

隐身守侯 提交于 2019-12-23 12:41:19

问题


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?


回答1:


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.




回答2:


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)




回答3:


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)


来源:https://stackoverflow.com/questions/2320292/increasing-the-size-of-the-text-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!