本文整理汇总了Java中org.eclipse.swt.custom.CCombo.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Java CCombo.setEditable方法的具体用法?Java CCombo.setEditable怎么用?Java CCombo.setEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.setEditable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createMatchModeCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void createMatchModeCombo(Composite parent) {
// draw label
Label comboLabel = new Label(parent,SWT.LEFT);
comboLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
comboLabel.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.label")); //$NON-NLS-1$
// draw combo
matchModeCombo = new CCombo(parent,SWT.BORDER);
matchModeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
matchModeCombo.setEditable(false);
String[] matchModes = {LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.find"), LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.match")};
matchModeCombo.setItems(matchModes);
if(edit) {
String[] items = matchModeCombo.getItems();
for(int i = 0 ; i < items.length ; i++) {
if(items[i].toLowerCase().indexOf(this.data.getMatchMode())!=-1) {
matchModeCombo.select(i);
return;
}
}
}
}
示例2: createControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
@Override
protected Control createControl(Composite parent) {
Control control = super.createControl(parent);
if (control instanceof CCombo) {
CCombo combo = (CCombo) control;
combo.setEditable(false);
}
return control;
}
示例3: initControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
@Override
protected void initControl() {
isReadOnly = (controlStyle & SWT.READ_ONLY) != 0;
// BUG in SWT: clear READ_ONLY bit since this does block the ProgressMonitorDialog
combo = new CCombo(parent, controlStyle | SWT.FLAT | SWT.SINGLE | SWT.BORDER) {
@Override
protected void checkSubclass() {
}
//
// public void setSelection(Point selection) {
// deselectAll();
// }
};
// combo = new CCombo(parent, controlStyle & ~SWT.READ_ONLY);
FontData[] fD = combo.getFont().getFontData();
fD[0].setHeight(DEFAULT_FONT_SIZE);
// combo.setFont(new Font(display,fD[0]));
combo.setFont(Fonts.createFont(fD[0]));
this.setControl(combo);
combo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setWidth(combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
}
});
combo.setEditable(false);
combo.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
combo.setListVisible(false);
// if (isReadOnly) {
// logger.debug("combo is read only!");
// combo.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
//
//
//
// combo.addKeyListener(new KeyListener() {
//
// @Override
// public void keyPressed(KeyEvent e) {
//
// e.doit=false;
// }
//
// @Override
// public void keyReleased(KeyEvent e) {
//
// e.doit=false;
// }
// });
// }
}
示例4: LabelTimeComposite
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public LabelTimeComposite(Composite composite, String labelText, String toolTipText) {
super(composite, SWT.NONE);
props.setLook(this);
int middle = props.getMiddlePct();
int threeQuarters = (middle + 100) / 2;
int margin = Const.MARGIN;
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
formLayout.marginTop = 0;
formLayout.marginBottom = 0;
this.setLayout(formLayout);
wText = new Text(this, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
FormData fdText = new FormData();
fdText.left = new FormAttachment(middle, margin);
fdText.right = new FormAttachment(threeQuarters, 0);
wText.setLayoutData(fdText);
wText.setToolTipText(toolTipText);
wTimeUnit = new CCombo(this, SWT.SINGLE | SWT.DROP_DOWN | SWT.BORDER | SWT.LEFT);
FormData fdCombo = new FormData();
fdCombo.left = new FormAttachment(threeQuarters, margin);
fdCombo.right = new FormAttachment(100, 0);
wTimeUnit.setEditable(false);
wTimeUnit.setLayoutData(fdCombo);
wTimeUnit.setItems(getTimeUnits());
wTimeUnit.setToolTipText(toolTipText);
wLabel = new Label(this, SWT.RIGHT);
props.setLook(wLabel);
wLabel.setText(labelText);
FormData fdLabel = new FormData();
fdLabel.left = new FormAttachment(0, 0);
fdLabel.right = new FormAttachment(middle, 0);
fdLabel.top = new FormAttachment(wText, 0, SWT.CENTER);
wLabel.setLayoutData(fdLabel);
wLabel.setToolTipText(toolTipText);
wText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (!StringUtils.isNumeric(wText.getText())) {
wText.setText(lastValidValue);
} else lastValidValue = wText.getText();
}
});
}