[英]Increasing the size of the Text field
I am using org.eclipse.swt.widgets.Text
's type of Text field. 我正在使用
org.eclipse.swt.widgets.Text
的Text字段类型。 I want to increase the length of the field. 我想增加场地的长度。 How would I do this?
我该怎么做?
For each field, if your general layout manager is GridLayout, your textbox layout data will be GridData. 对于每个字段,如果您的常规布局管理器是GridLayout,则您的文本框布局数据将是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.
将宽度和高度传递到GridData构造函数并将其设置为文本框(textbox.setLayoutData()),以及有关布局管理器如何操作字段的属性。
Since Text is a control, it inherits the method: Text.setSize(width, height)
. 由于Text是一个控件,它继承了方法:
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)
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Text.html 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: Text从Control继承这些方法:
public void setSize(int width,int height)
public void setSize(Point size)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.