本文整理汇总了Java中org.eclipse.swt.graphics.Point类的典型用法代码示例。如果您正苦于以下问题:Java Point类的具体用法?Java Point怎么用?Java Point使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Point类属于org.eclipse.swt.graphics包,在下文中一共展示了Point类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextWidget
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
protected void createTextWidget(String textContents) {
StyledText styledText = new StyledText(getComposite(), SWT.NONE);
styledText.setText(textContents);
styledText.setFont(getCourierFont());
styledText.setEditable(false);
//styledText.setWordWrap(true); // seems to throw size out-of-whack
Point size = styledText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
getComposite().setContent(styledText);
getComposite().setExpandHorizontal(true);
getComposite().setExpandVertical(true);
getComposite().setMinWidth(size.x);
getComposite().setMinHeight(size.y);
getComposite().getContent().addListener(SWT.KeyUp, getToolbarCommandHandler());
getToolItem().setSelection(true);
setContentTypeAdapter(new StyledTextAdapter(styledText, getFileEntry().getFilename()));
}
示例2: render
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
*
*/
@Override
public void render(XCalendarFrame frame) {
// Background
final GC gc = frame.getGc();
final boolean hovered = mouse.isEntered();
final XCalendarModel model = popup.getModel();
final XCalendarTheme theme = model.getTheme();
final XVirtualCalendar calendar = model.getCalendar();
int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
gc.setBackground(theme.getBackground(true, false, false, hovered));
gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());
// Foreground
String t1 = this.type.text(theme, calendar);
gc.setForeground(theme.getForeground(true, false, true));
gc.setFont(theme.getBold()); final Point s1 = extent(gc, t1);
gc.drawText(t1, x + 1 + ((w - s1.x) >> 1), y + 1 + ((h - s1.y) >> 1));
if(this.type == XCalendarTime.HOUR || this.type == XCalendarTime.MINUTE) {
String t2 = ":"; Point s2 = extent(gc, t2);
gc.setBackground(theme.getBackground(true, false, false, false));
gc.drawText(t2, x + 1 + w + (getMargin().x >> 2), y + 1 + ((h - s2.y) >> 1));
}
}
示例3: getInitialSize
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
protected Point getInitialSize() {
IDialogSettings dialogSettings = getDialogSettings();
if (dialogSettings == null) {
/* no dialog settings available, so fall back to min settings */
return new Point(minWidth, minHeight);
}
Point point = super.getInitialSize();
if (point.x < minWidth) {
point.x = minWidth;
}
if (point.y < minHeight) {
point.y = minHeight;
}
return point;
}
示例4: createShell
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
* Create the Shell, setting up any elements that are not set up by the main Composite.
* @param arrayModificationHandler The ArrayModificationHandler the holds the represented array.
* @param myDimension The dimension of a probably multidimensional array this Window represents.
* @param dimensionsIndexes Dimension indexes of the higher-level dimensions the array represented might be a part of.
*/
private void createShell(ArrayModificationHandler arrayModificationHandler, int myDimension, int[] dimensionsIndexes) {
this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Array Entries");
this.shell.setLayout(new FillLayout(SWT.VERTICAL));
// Initialize the composite.
new ArrayEntriesComposite(this, this.shell, this.display, SWT.NONE, arrayModificationHandler, myDimension, dimensionsIndexes);
// Compute the needed size.
Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
point.x += 2;
point.y += 2;
int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, this.parent.getShell());
this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
示例5: render
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
public void render ( final Graphics g, final Rectangle clientRectangle )
{
if ( this.title == null || this.title.isEmpty () )
{
return;
}
g.setClipping ( this.rect );
g.setFont ( createFont ( g.getResourceManager () ) );
final Point size = g.textExtent ( this.title );
final int x = this.rect.width / 2 - size.x / 2;
final int y = this.padding;
g.drawText ( this.title, this.rect.x + x, this.rect.y + y, null );
g.setClipping ( clientRectangle );
}
示例6: createShell
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
* Create the Shell, setting up any elements that are not set up by the main Composite.
* @param parentShell The parent windows' Shell.
* @param className The name of the class to inspect.
* @param classFile The ClassFile to inspect.
*/
private void createShell(Shell parentShell, String className, ClassFile classFile) {
this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Class File Inspection");
this.shell.setLayout(new FillLayout(SWT.VERTICAL));
// No need to read it later, so it is not assigned to a variable.
new ClassInspectionComposite(this, this.shell, this.display, SWT.NONE, className, classFile);
// Compute the needed size.
Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
point.x += 2;
point.y += 2;
int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
示例7: computeSizeOfTextAndImages
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
private Point computeSizeOfTextAndImages() {
int width = 0, height = 0;
final boolean textISNotEmpty = getText() != null && !getText().equals("");
if (textISNotEmpty) {
final GC gc = new GC(this.parentBreadcrumb);
gc.setFont(this.parentBreadcrumb.getFont());
final Point extent = gc.stringExtent(getText());
gc.dispose();
width += extent.x;
height = extent.y;
}
final Point imageSize = computeMaxWidthAndHeightForImages(getImage(),
this.selectionImage, this.disabledImage);
if (imageSize.x != -1) {
width += imageSize.x;
height = Math.max(imageSize.y, height);
if (textISNotEmpty) {
width += MARGIN * 2;
}
}
width += MARGIN;
return new Point(width, height);
}
示例8: render
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
* Render
*/
@Override
public void render(XCalendarFrame frame) {
// Background
final GC gc = frame.getGc();
final XCalendarModel model = popup.getModel();
final XCalendarTheme theme = model.getTheme();
final boolean hovered = this.mouse.isEntered();
int x = bounds.x, y = bounds.y, w = bounds.width, h = bounds.height;
gc.setBackground(theme.getBackground(true, false, false, hovered));
gc.fillRoundRectangle(x, y, w, h, theme.getArc(), theme.getArc());
// Foreground
String text = trash_o;
gc.setForeground(theme.getToolBarBackground(false));
gc.setFont(Fonts.getAwesomeFont()); final Point size = extent(gc, text);
gc.drawText(text, x + 1 + ((w - size.x) >> 1), y + 1 + ((h - size.y) >> 1));
}
示例9: createShell
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
* Create the Shell, setting up any elements that are not set up by the main Composite.
* @param parentShell The parent windows' Shell.
* @param classLoader The system MugglClassLoader.
*/
private void createShell(Shell parentShell, MugglClassLoader classLoader) {
this.shell = new Shell(this.display, SWT.BORDER | SWT.CLOSE | SWT.TITLE | SWT.MIN);
this.shell.setText(Globals.WINDOWS_TITLE + Globals.WINDOWS_TITLE_CONNECTOR + "Options");
this.shell.setLayout(new FillLayout(SWT.VERTICAL));
final Image small = new Image(shell.getDisplay(),
OptionsWindow.class.getResourceAsStream("/images/tray_small.png"));
final Image large = new Image(shell.getDisplay(),
OptionsWindow.class.getResourceAsStream("/images/tray_large.png"));
this.shell.setImages(new Image[] { small, large });
// No need to read it later, so it is not assigned to a variable.
new OptionsComposite(this, this.shell, SWT.NONE, classLoader);
// Compute the needed size.
Point point = this.shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
point.x += 2;
point.y += 2;
int[] posXY = StaticGuiSupport.getCenteredPosition(point.x, point.y, parentShell);
this.shell.setBounds(posXY[0], posXY[1], point.x, point.y);
}
示例10: paintVerticalRuler
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
* Handle paint requests for vertical ruler.
*/
protected void paintVerticalRuler(PaintEvent event) {
// FIXME - not i18n safe!!
String label = (disk.getBitmapLabels()[0] + "s").toUpperCase(); //$NON-NLS-1$
if (disk.getBitmapLabels().length == 2) {
label = (disk.getBitmapLabels()[1] + "s").toUpperCase(); //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
for (int i=0; i<label.length(); i++) {
if (i>0) buf.append("\n"); //$NON-NLS-1$
buf.append(label.charAt(i));
}
label = buf.toString();
Canvas canvas = (Canvas) event.widget;
Rectangle area = canvas.getClientArea();
event.gc.drawLine(area.x + area.width/2, area.y, area.x + area.width/2, area.y + area.height);
Point size = event.gc.textExtent(label);
event.gc.drawText(label, area.x + area.width/2 - size.x/2, area.y + area.height/2 - size.y/2);
}
示例11: obfuscatedImage
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
public Image obfuscatedImage(Image image) {
Rectangle bounds = swtItem == null ? null : swtItem.getBounds();
if ( bounds != null ){
boolean isActive = swtItem.getParent().getSelection() == swtItem;
boolean isHeaderVisible = swtItem.isShowing();
Point location = Utils.getLocationRelativeToShell(swtItem.getParent());
bounds.x += location.x;
bounds.y += location.y;
Map<String, Object> map = new HashMap<>();
map.put("image", image);
map.put("obfuscateTitle", false);
if (isActive) {
triggerEvent(UISWTViewEvent.TYPE_OBFUSCATE, map);
if (viewTitleInfo instanceof ObfuscateImage) {
((ObfuscateImage) viewTitleInfo).obfuscatedImage(image);
}
}
if (isHeaderVisible) {
if (viewTitleInfo instanceof ObfuscateTab) {
String header = ((ObfuscateTab) viewTitleInfo).getObfuscatedHeader();
if (header != null) {
UIDebugGenerator.obfuscateArea(image, bounds, header);
}
}
if (MapUtils.getMapBoolean(map, "obfuscateTitle", false)) {
UIDebugGenerator.obfuscateArea(image, bounds);
}
}
}
return image;
}
示例12: getToolTipBounds
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
*
* Returns tooltip bounds
*
* @return org.eclipse.swt.graphics.Rectangle
*/
public Rectangle getToolTipBounds(){
Point tooltipSize = getToolTipWidthHeight();
Rectangle bounds = new Rectangle(0, 0, tooltipSize.x, tooltipSize.y);
logger.debug("tooltip bounds=" + bounds);
return bounds;
}
示例13: hideTabs
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
/**
* If there is just one page in the multi-page editor part,
* this hides the single tab at the bottom.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void hideTabs() {
if (getPageCount() <= 1) {
setPageText(0, "");
if (getContainer() instanceof CTabFolder) {
((CTabFolder)getContainer()).setTabHeight(1);
Point point = getContainer().getSize();
getContainer().setSize(point.x, point.y + 6);
}
}
}
示例14: getSignedSelection
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
protected final IRegion getSignedSelection(ISourceViewer sourceViewer) {
Point viewerSelection = sourceViewer.getSelectedRange();
StyledText text = sourceViewer.getTextWidget();
Point selection = text.getSelectionRange();
if (text.getCaretOffset() == selection.x) {
viewerSelection.x = viewerSelection.x + viewerSelection.y;
viewerSelection.y = -viewerSelection.y;
}
return new Region(viewerSelection.x, viewerSelection.y);
}
示例15: computeSize
import org.eclipse.swt.graphics.Point; //导入依赖的package包/类
@Override
public Point computeSize(int wHint, int hHint) {
if (!inSetSize && wHint > 0 && hHint == SWT.DEFAULT) {
inSetSize = true;
return super.computeSize(Utils.adjustPXForDPI(wHint), hHint);
}
return super.computeSize(wHint, hHint);
}