本文整理汇总了Java中org.eclipse.jface.layout.PixelConverter.convertWidthInCharsToPixels方法的典型用法代码示例。如果您正苦于以下问题:Java PixelConverter.convertWidthInCharsToPixels方法的具体用法?Java PixelConverter.convertWidthInCharsToPixels怎么用?Java PixelConverter.convertWidthInCharsToPixels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.layout.PixelConverter
的用法示例。
在下文中一共展示了PixelConverter.convertWidthInCharsToPixels方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDialogArea
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的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;
}
示例2: createColumn
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
@Override
public TableColumnDefinition createColumn( final ColumnManager columnManager,
final PixelConverter pixelConverter) {
final int pixelWidth = pixelConverter.convertWidthInCharsToPixels(8);
final TableColumnDefinition colDef = new TableColumnDefinition(columnManager, "MARKER_MAP_VISIBLE", //$NON-NLS-1$
SWT.CENTER);
colDef.setColumnCategory(Messages.ColumnFactory_Category_Marker);
colDef.setColumnLabel(Messages.Tour_Marker_Column_IsVisible);
colDef.setColumnHeaderText(Messages.Tour_Marker_Column_IsVisible);
colDef.setColumnHeaderToolTipText(Messages.Tour_Marker_Column_IsVisibleNoEdit_Tooltip);
colDef.setDefaultColumnWidth(pixelWidth);
colDef.setColumnWeightData(new ColumnPixelData(pixelWidth, true));
return colDef;
}
示例3: initUI
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private void initUI(final Composite parent) {
_pc = new PixelConverter(parent);
_hintDefaultSpinnerWidth = _isLinux ? SWT.DEFAULT : _pc.convertWidthInCharsToPixels(_isOSX ? 10 : 5);
_selectionListener = new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (_isUpdateUI) {
return;
}
onModifySmoothing(e.widget, true);
}
};
_spinnerMouseWheelListener = new MouseWheelListener() {
@Override
public void mouseScrolled(final MouseEvent event) {
Util.adjustSpinnerValueOnMouseScroll(event);
if (_isUpdateUI) {
return;
}
onModifySmoothing(event.widget, true);
}
};
}
示例4: createUITextarea
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private void createUITextarea( final Composite parent,
final String labelText,
final String areaText,
final PixelConverter pc) {
Label label;
final int horizontalHint = areaText.length() > 80 ? pc.convertWidthInCharsToPixels(80) : SWT.DEFAULT;
label = createUILabel(parent, labelText);
GridDataFactory.fillDefaults()//
.align(SWT.FILL, SWT.BEGINNING)
.applyTo(label);
label = new Label(parent, SWT.WRAP);
GridDataFactory.fillDefaults()//
.hint(horizontalHint, SWT.DEFAULT)
.applyTo(label);
label.setForeground(_fgColor);
label.setBackground(_bgColor);
label.setText(areaText);
}
示例5: createToolTipContentArea
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
@Override
protected Composite createToolTipContentArea(final Composite parent) {
if (_photo == null) {
return null;
}
_pc = new PixelConverter(parent);
_defaultTextWidthPixel = _pc.convertWidthInCharsToPixels(DEFAULT_TEXT_WIDTH);
final Composite container = createUI(parent);
// set colors for all controls
updateUI_colors(parent);
return container;
}
示例6: addTextField
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
/**
* Returns an array of size 2: - first element is of type <code>Label</code> - second element is
* of type <code>Text</code> Use <code>getLabelControl</code> and <code>getTextControl</code> to
* get the 2 controls.
*
* @param parent the parent composite
* @param label the text field's label
* @param key the preference key
* @param widthHint the text limit
* @param indent the field's indentation
* @param isNumber <code>true</code> iff this text field is used to edit a number
* @return the controls added
*/
protected Control[] addTextField(Composite parent, String label, String key, int widthHint, int indent,
boolean isNumber) {
PixelConverter pixelConverter = new PixelConverter(parent);
Label labelControl = new Label(parent, SWT.NONE);
labelControl.setText(label);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = indent;
labelControl.setLayoutData(gd);
Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
textBox.setText(fStore.getString(key));
makeScrollableCompositeAware(textBox);
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = pixelConverter.convertWidthInCharsToPixels(widthHint + 1);
gd.horizontalSpan = 2;
textBox.setLayoutData(gd);
if (widthHint > 0) textBox.setTextLimit(widthHint);
fTextFields.put(textBox, key);
if (isNumber) {
fNumberFields.add(textBox);
textBox.addModifyListener(fNumberFieldListener);
} else {
textBox.addModifyListener(fTextFieldListener);
}
return new Control[] { labelControl, textBox };
}
示例7: createColumn
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
@Override
public ColumnDefinition createColumn(final ColumnManager columnManager, final PixelConverter pixelConverter) {
final int pixelWidth = pixelConverter.convertWidthInCharsToPixels(50);
final ColumnDefinition colDef = new TableColumnDefinition(columnManager, "photoOtherTags", SWT.LEAD); //$NON-NLS-1$
colDef.setColumnLabel(Messages.ColumnFactory_Photo_OtherTags);
colDef.setColumnHeaderText(Messages.ColumnFactory_Photo_OtherTags);
colDef.setDefaultColumnWidth(pixelWidth);
colDef.setColumnWeightData(new ColumnPixelData(pixelWidth, true));
return colDef;
}
示例8: initUI
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private void initUI(final Composite parent) {
final Display display = parent.getDisplay();
_pc = new PixelConverter(parent);
_defaultTextWidth = _pc.convertWidthInCharsToPixels(DEFAULT_TEXT_WIDTH);
_defaultTextHeight = _pc.convertHeightInCharsToPixels(DEFAULT_TEXT_HEIGHT);
_colorCache = new ColorCache();
_boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT);
_fgBorder = display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
_titleColor = _colorCache.getColor(new RGB(0x50, 0x50, 0x50));
}
示例9: createUI
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private Composite createUI(final Composite parent) {
_pc = new PixelConverter(parent);
_firstColumnIndent = _pc.convertWidthInCharsToPixels(3);
_shellContainer = new Composite(parent, SWT.NONE);
GridLayoutFactory.swtDefaults().applyTo(_shellContainer);
{
final Composite container = new Composite(_shellContainer, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(container);
GridLayoutFactory.fillDefaults()//
.numColumns(4)
.applyTo(container);
// container.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_GREEN));
{
createUI_10_Title(container);
createUI_12_Actions(container);
createUI_20_Options(container);
createUI_30_SegmentValues(container);
createUI_50_SegmenterTitle(container);
createUI_60_SegmenterColors(container);
}
}
return _shellContainer;
}
示例10: createPartControl
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
@Override
public void createPartControl(final Composite parent) {
_parent = parent;
_pc = new PixelConverter(parent);
_spinnerWidth = _pc.convertWidthInCharsToPixels(_isOSX ? 10 : 5);
setMaxDistanceSpinner();
// define all columns
_columnManager = new ColumnManager(this, _state);
_columnManager.setIsCategoryAvailable(true);
defineAllColumns(parent);
createUI(parent);
createActions();
fillToolbar();
addSelectionListener();
addPartListener();
addPrefListener();
addTourEventListener();
// tell the site that this view is a selection provider
getSite().setSelectionProvider(_postSelectionProvider = new PostSelectionProvider(ID));
_pageBookUI.showPage(_pageNoData);
restoreState();
enableActions();
showTour();
}
示例11: createUI_70_Option_GeoPosition
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private Composite createUI_70_Option_GeoPosition(final PageBook parent) {
final PixelConverter pc = new PixelConverter(parent);
final int valueWidth = pc.convertWidthInCharsToPixels(4);
Label label;
final Group group = new Group(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
group.setText(Messages.Adjust_Altitude_Group_GeoPosition);
GridLayoutFactory.swtDefaults().numColumns(3).applyTo(group);
{
/*
* label: adjusted slices
*/
label = new Label(group, SWT.NONE);
label.setText(Messages.Adjust_Altitude_Label_GeoPosition_Slices);
/*
* label: slice value
*/
_lblSliceValue = new Label(group, SWT.TRAIL);
GridDataFactory
.fillDefaults()
.align(SWT.END, SWT.CENTER)
.hint(valueWidth, SWT.DEFAULT)
.applyTo(_lblSliceValue);
/*
* scale: slice position
*/
_scaleSlicePos = new Scale(group, SWT.HORIZONTAL);
GridDataFactory.fillDefaults().grab(true, false).applyTo(_scaleSlicePos);
_scaleSlicePos.setMinimum(0);
_scaleSlicePos.setMaximum(MAX_ADJUST_GEO_POS_SLICES * 2);
_scaleSlicePos.setPageIncrement(5);
_scaleSlicePos.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
onSelectSlicePosition();
}
});
_scaleSlicePos.addListener(SWT.MouseDoubleClick, new Listener() {
@Override
public void handleEvent(final Event event) {
onDoubleClickGeoPos(event.widget);
}
});
}
return group;
}
示例12: initUI
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private void initUI(final Composite parent) {
_pc = new PixelConverter(parent);
_imagePaste = TourbookPlugin.getImageDescriptor(Messages.Image__App_Edit_Paste).createImage();
// final int signImageMaxSize = TourMarker.getSignImageMaxSize(_pc);
CONTENT_DEFAULT_WIDTH = _pc.convertWidthInCharsToPixels(30);
// IMAGE_MIN_WIDTH = signImageMaxSize / 3;
// IMAGE_DEFAULT_WIDTH = signImageMaxSize / 2;
// ROW_MAX_HEIGHT = signImageMaxSize;
restoreState_Viewer();
}
示例13: initUI
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private void initUI(final Composite parent) {
_pc = new PixelConverter(parent);
_tk = new FormToolkit(parent.getDisplay());
_hintDefaultSpinnerWidth = UI.IS_LINUX ? SWT.DEFAULT : _pc.convertWidthInCharsToPixels(UI.IS_OSX ? 10 : 5);
}
示例14: initUI
import org.eclipse.jface.layout.PixelConverter; //导入方法依赖的package包/类
private void initUI(final Composite parent) {
_pc = new PixelConverter(parent);
_hintDefaultSpinnerWidth = _isLinux //
? SWT.DEFAULT
: _pc.convertWidthInCharsToPixels(_isOSX ? 14 : 7);
_hintValueFieldWidth = _pc.convertWidthInCharsToPixels(10);
}