本文整理匯總了Java中org.eclipse.swt.widgets.Text.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java Text.setText方法的具體用法?Java Text.setText怎麽用?Java Text.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Text
的用法示例。
在下文中一共展示了Text.setText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(2, false);
layout.marginRight = 5;
layout.marginLeft = 10;
container.setLayout(layout);
Label lblUser = new Label(container, SWT.NONE);
lblUser.setText("User:");
txtUser = new Text(container, SWT.BORDER);
txtUser.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtUser.setText(user);
Label lblPassword = new Label(container, SWT.NONE);
GridData gd_lblNewLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblNewLabel.horizontalIndent = 1;
lblPassword.setLayoutData(gd_lblNewLabel);
lblPassword.setText("Password:");
txtPassword = new Text(container, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD);
txtPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtPassword.setText(password);
return container;
}
示例2: createTextControl
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
private void createTextControl(String slabel, final String propName, Composite content) {
final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
final Label label = new Label(content, SWT.NONE);
label.setText(slabel);
final Text text = new Text(content, SWT.BORDER);
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
text.setText(store.getString(propName));
text.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
store.setValue(propName, text.getText());
}
});
}
示例3: createLabelTextBoxAndButton
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
private void createLabelTextBoxAndButton(Composite textBobLabelButtonComposite, int data_key)
{
AbstractELTWidget outputRecordCountLabel1=new ELTDefaultLable(Constants.OUTPUT_RECORD_COUNT);
outputRecordCountLabel1.attachWidget(textBobLabelButtonComposite);
Composite composite=new Composite(textBobLabelButtonComposite, SWT.NONE);
setLayoutAndDataToComposite(composite,1);
ELTDefaultTextBox outputRecordCountTextBox=new ELTDefaultTextBox();
outputRecordCountTextBox.attachWidget(composite);
outputRecordCoundText=(Text)outputRecordCountTextBox.getSWTWidgetControl();
expressionValidateDecorator = WidgetUtility.addDecorator(outputRecordCoundText,"Invalid Expression");
expressionValidateDecorator.setMarginWidth(3);
addModifyListenerToRecordCountTextBox();
if(transformMapping.getExpressionEditorData()!=null)
{
outputRecordCoundText.setText(transformMapping.getExpressionEditorData().getExpression());
showHideDecorator();
}
AbstractELTWidget outputRecordCountButton=new ELTDefaultButton(Constants.EDIT);
outputRecordCountButton.attachWidget(textBobLabelButtonComposite);
editButton=(Button)outputRecordCountButton.getSWTWidgetControl();
intializeEnableOrDisableStateOfWidgetsBasedOnExpressionOrOperationSelected();
addListenerOnEditButtonToOpenExpressionEditor();
expressionRadioButton.setData(String.valueOf(data_key), outputRecordCountLabel1.getSWTWidgetControl());
}
示例4: attachToPropertySubGroup
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget subGroup) {
logger.debug("Starting {} button creation");
ELTDefaultSubgroupComposite selectUpdateKeysComposite = new ELTDefaultSubgroupComposite(subGroup.getContainerControl());
selectUpdateKeysComposite.createContainerWidget();
ELTDefaultLable defaultLable1 = new ELTDefaultLable(Messages.LABEL_UPDATE_BY_KEYS);
selectUpdateKeysComposite.attachWidget(defaultLable1);
setPropertyHelpWidget((Control) defaultLable1.getSWTWidgetControl());
ELTDefaultTextBox defaultUpdateByKeysTextBox = new ELTDefaultTextBox();
selectUpdateKeysComposite.attachWidget(defaultUpdateByKeysTextBox);
updateByKeysTextBox=(Text)defaultUpdateByKeysTextBox.getSWTWidgetControl();
updateByKeysTextBox.setEnabled(false);
setPropertyHelpWidget((Control) defaultUpdateByKeysTextBox.getSWTWidgetControl());
ELTDefaultButton eltDefaultButton = new ELTDefaultButton(Messages.LABEL_SELECT_KEYS);
selectUpdateKeysComposite.attachWidget(eltDefaultButton);
selectKeysButton=(Button)eltDefaultButton.getSWTWidgetControl();
updateByKeysTextBoxDecorator = WidgetUtility.addDecorator(updateByKeysTextBox, Messages.bind(Messages.EMPTY_FIELD, "JDBC Driver \n Class"));
updateByKeysTextBoxDecorator.setMarginWidth(3);
if(StringUtils.isNotEmpty(propertyValue)){
updateByKeysTextBox.setText(propertyValue);
updateByKeysTextBoxDecorator.hide();
}
attachButtonListner(selectKeysButton);
updateByKeysTextBox.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent event) {
Text textBox=(Text)event.widget;
if(StringUtils.isBlank(textBox.getText())){
updateByKeysTextBoxDecorator.show();
}else{
updateByKeysTextBoxDecorator.hide();
}
}
});
}
示例5: browseSchemaSelectionDialog
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
*
* Open selection dialog for schema files, File selection restricted to ".schema" extension.
* @param filterExtension
* @param fileName
*/
private void browseSchemaSelectionDialog(String filterExtension, Text fileName) {
String externalSchemaTextBoxValue = "";
ExternalSchemaFileSelectionDialog dialog = new ExternalSchemaFileSelectionDialog("Project",
"Select Schema File (.schema or.xml)", new String[]{filterExtension,Extensions.XML.toString()}, this);
if (dialog.open() == IDialogConstants.OK_ID) {
String file = fileNameTextBoxValue;
IResource resource = (IResource) dialog.getFirstResult();
String path[] = resource.getFullPath().toString().split("/");
if (file.isEmpty()) {
for (int i = 1; i < path.length; i++) {
externalSchemaTextBoxValue = externalSchemaTextBoxValue + path[i] + "/";
}
} else {
for (int i = 1; i < path.length; i++) {
if (!path[i].endsWith(".schema") && !path[i].endsWith(".xml")) {
externalSchemaTextBoxValue = externalSchemaTextBoxValue + path[i] + "/";
}
}
externalSchemaTextBoxValue = externalSchemaTextBoxValue + file;
}
fileName.setText(externalSchemaTextBoxValue);
}
}
示例6: initialize
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
* This method initializes this
*
*/
private void initialize() {
XpathTrigger trigger = (parent.getTrigger() instanceof XpathTrigger)?(XpathTrigger)parent.getTrigger():null;
GridData gridData2 = new GridData();
gridData2.horizontalAlignment = GridData.FILL;
gridData2.grabExcessHorizontalSpace = true;
gridData2.verticalAlignment = GridData.CENTER;
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
this.setLayout(gridLayout);
xpath_label = new Label(this, SWT.NONE);
xpath_label.setText("Waiting for Xpath");
xpath_txt = new Text(this, SWT.BORDER);
xpath_txt.setText( (trigger!=null)? trigger.getXPath():"");
xpath_txt.setLayoutData(gridData2);
xpath_txt.setSize(600, 50);
}
示例7: createDialogArea
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite comp = (Composite) super.createDialogArea(parent);
Text filed = new Text(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
| SWT.READ_ONLY | SWT.MULTI);
filed.setText(text);
filed.setBackground(getShell().getDisplay().getSystemColor(
SWT.COLOR_LIST_BACKGROUND));
filed.setFont(JFaceResources.getTextFont());
PixelConverter pc = new PixelConverter(filed);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = pc.convertWidthInCharsToPixels(80);
gd.heightHint = pc.convertHeightInCharsToPixels(30);
filed.setLayoutData(gd);
return comp;
}
示例8: createErrorGroup
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
* @param parent
* @param composite
*/
private void createErrorGroup(Composite parent) {
Composite errorGroup = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
errorGroup.setLayout(layout);
errorGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
errorGroup.setFont(parent.getFont());
errorText = new Text(errorGroup, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI | SWT.BORDER);
errorText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
errorText.setText("asldfjlasjflkj");
}
示例9: GridTextInput
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param parent The parent {@link Composite}.
* @param type The {@link Type}.
* @param name The {@link GridTextInput} name.
* @param labelText The {@link Label} text.
* @param labelStyle The {@link Label} style.
* @param labelLayoutData The {@link Label} {@link GridData layout data}.
* @param textText The {@link Text} text.
* @param textStyle The {@link Text} style.
* @param textLayoutData The {@link Text} {@link GridData layout data}.
*/
public GridTextInput(Composite parent, Type type, String name, String labelText, int labelStyle,
GridData labelLayoutData, String textText, int textStyle, GridData textLayoutData) {
_Type = type;
_DefaultTextValue = textText;
if (_DefaultTextValue != null && _Type.isInteger()) {
if (!isValidIntegerText(_DefaultTextValue)) {
throw new IllegalArgumentException("Invalid integer value: " + _DefaultTextValue);
}
}
_Name = name;
if (labelText != null) {
_Label = new Label(parent, labelStyle);
_Label.setText(labelText);
_Label.setLayoutData(labelLayoutData);
_Label.pack();
}
_Text = new Text(parent, textStyle);
if (textText != null) {
_Text.setText(textText);
}
_Text.setLayoutData(textLayoutData);
if (_Type.isInteger()) {
_Text.setTextLimit(10);
}
_Text.setData(this);
}
示例10: createrequirementSection
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
* Create the Text that will hold the Requirement coming from the graphml file
* @param panel
* @param file
*/
protected void createrequirementSection(Composite panel, IFile file) {
Label label = createLabel(panel, MessageUtil.getString("Requirements")); //$NON-NLS-1$
Text t = new Text(panel, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
t.setData(GW4E_FILE_REQUIREMENT_TEXT_ID,GW4E_FILE_REQUIREMENT_TEXT_ID );
Set<String> requirements = null;
String reqMessage = "";
try {
requirements = GraphWalkerFacade.getRequirement(file);
String newline = System.getProperty("line.separator");
if (requirements == null || requirements.size() == 0) {
reqMessage = MessageUtil.getString("NoRequirements");
} else {
StringBuffer sb = new StringBuffer();
for (String req : requirements) {
sb.append(req).append(newline);
}
t.setText(sb.toString());
reqMessage = requirements.size() + " " + MessageUtil.getString("requirementsfound");
}
} catch (Exception e) {
ResourceManager.logException(e);
t.setText(e.getMessage());
}
t.setEditable(false);
GridDataFactory.fillDefaults().grab(true, true).hint(150, 150).applyTo(t);
createLabel(panel, MessageUtil.getString("requirementMessage")); //$NON-NLS-1$
label = createLabel(panel, reqMessage);
fillExcessHorizontalSpace(label);
}
示例11: createContents
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
@Override
protected Control createContents(Composite parent) {
this.getShell().setText(_Command);
ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComposite.setExpandHorizontal(true);
Text text = new Text(scrolledComposite, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
text.setText(_Result);
text.pack();
scrolledComposite.setContent(text);
return scrolledComposite;
}
示例12: initialize
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
protected void initialize() {
GridData gridData = new org.eclipse.swt.layout.GridData();
gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.grabExcessVerticalSpace = true;
gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
cicsData = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
cicsData.setEditable(false);
cicsData.setBackground(new Color(null,253,253,244));
cicsData.setFont(new Font(null,"Courier New",10,1));
cicsData.setLayoutData(gridData);
cicsData.setText("");
this.setLayout(new GridLayout());
setSize(new Point(300, 200));
}
示例13: browseJavaSelectionDialog
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
* Open selection dialog for Java files, File selection restricted to ".java" extension.
* @param filterExtension
* @param fileName
*/
public static void browseJavaSelectionDialog(String filterExtension, Text fileName) {
ResourceFileSelectionDialog dialog = new ResourceFileSelectionDialog(
"Project", "Select Java Class (.java)", new String[] { filterExtension });
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource) dialog.getFirstResult();
String filePath = resource.getRawLocation().toOSString();
java.nio.file.Path path =Paths.get(filePath);
String classFile=path.getFileName().toString();
String name = "";
try(BufferedReader reader= new BufferedReader(new FileReader(filePath))){
String firstLine= reader.readLine();
if(firstLine.contains(Constants.PACKAGE)){
name= firstLine.replaceFirst(Constants.PACKAGE, "").replace(";", "");
if(!name.equalsIgnoreCase("")){
name=name+"."+classFile.substring(0, classFile.lastIndexOf('.'));
}
}else{
name=classFile.substring(0, classFile.lastIndexOf('.'));
}
} catch (IOException e) {
logger.error("Unable to read file " + filePath,e );
}
fileName.setText(name.trim());
filePath = resource.getRawLocation().toOSString();
fileName.setData("path", resource.getFullPath().toString());
}
}
示例14: createConsoleBufferWidget
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
/**
* Create console buffer widget
* @param bufferSize
*/
private void createConsoleBufferWidget(String bufferSize){
HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
hydroGroup.setHydroGroupText(Messages.HYDROGRAPH_CONSOLE_PREFERANCE_PAGE_GROUP_NAME);
hydroGroup.setLayout(new GridLayout(1, false));
hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
Label label = new Label(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
label.setText(Messages.PREFERANCE_CONSOLE_BUFFER_SIZE);
textWidget = new Text(hydroGroup.getHydroGroupClientArea(), SWT.BORDER);
textWidget.setText(bufferSize);
textWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
textWidget.setTextLimit(6);
attachConsoleBufferValidator();
Composite purgeComposite = new Composite(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
purgeComposite.setLayout(new GridLayout(2, false));
purgeComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
Label lblNote = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
lblNote.setText(Messages.PREFERANCE_PAGE_NOTE);
FontData fontData = lblNote.getFont().getFontData()[0];
Font font = new Font(purgeComposite.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
lblNote.setFont(font);
Label lblmsg = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
lblmsg.setText(Messages.UI_PERFORMANCE_NOTE_IN_CASE_OF_CHANGE_IN_BUFFER_SIZE);
}
示例15: addPathSection
import org.eclipse.swt.widgets.Text; //導入方法依賴的package包/類
private void addPathSection(Composite parent) {
Composite composite = createDefaultComposite(parent);
// Label for path field
Label pathLabel = new Label(composite, SWT.NONE);
pathLabel.setText(PATH_TITLE);
// Path text field
Text pathValueText = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
pathValueText.setText(getProject().getFullPath().toString());
}