当前位置: 首页>>代码示例>>Java>>正文


Java Caret类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.Caret的典型用法代码示例。如果您正苦于以下问题:Java Caret类的具体用法?Java Caret怎么用?Java Caret使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Caret类属于org.eclipse.swt.widgets包,在下文中一共展示了Caret类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getShell

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * Returns the shell for the given widget. If the widget doesn't represent a
 * SWT object that manage a shell, <code>null</code> is returned.
 * 
 * @param widget
 *            the widget
 * 
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
	if (widget instanceof Control)
		return ((Control) widget).getShell();
	if (widget instanceof Caret)
		return ((Caret) widget).getParent().getShell();
	if (widget instanceof DragSource)
		return ((DragSource) widget).getControl().getShell();
	if (widget instanceof DropTarget)
		return ((DropTarget) widget).getControl().getShell();
	if (widget instanceof Menu)
		return ((Menu) widget).getParent().getShell();
	if (widget instanceof ScrollBar)
		return ((ScrollBar) widget).getParent().getShell();

	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:26,代码来源:SWTUtil.java

示例2: getShell

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * Returns the shell for the given widget. If the widget doesn't represent a SWT object that manage a shell,
 * <code>null</code> is returned.
 * 
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget)
{
	if (widget instanceof Control)
		return ((Control) widget).getShell();
	if (widget instanceof Caret)
		return ((Caret) widget).getParent().getShell();
	if (widget instanceof DragSource)
		return ((DragSource) widget).getControl().getShell();
	if (widget instanceof DropTarget)
		return ((DropTarget) widget).getControl().getShell();
	if (widget instanceof Menu)
		return ((Menu) widget).getParent().getShell();
	if (widget instanceof ScrollBar)
		return ((ScrollBar) widget).getParent().getShell();

	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:24,代码来源:SWTUtil.java

示例3: getShell

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * Returns the shell for the given widget. If the widget doesn't represent
 * a SWT object that manage a shell, <code>null</code> is returned.
 * @param widget the widget
 *
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
	if (widget instanceof Control)
		return ((Control)widget).getShell();
	if (widget instanceof Caret)
		return ((Caret)widget).getParent().getShell();
	if (widget instanceof DragSource)
		return ((DragSource)widget).getControl().getShell();
	if (widget instanceof DropTarget)
		return ((DropTarget)widget).getControl().getShell();
	if (widget instanceof Menu)
		return ((Menu)widget).getParent().getShell();
	if (widget instanceof ScrollBar)
		return ((ScrollBar)widget).getParent().getShell();

	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:SWTUtil.java

示例4: getShell

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * Returns the shell for the given widget. If the widget doesn't represent
 * a SWT object that manage a shell, <code>null</code> is returned.
 * @param widget the widget
 *
 * @return the shell for the given widget
 */
public static Shell getShell(Widget widget) {
    if (widget instanceof Control) {
        return ((Control) widget).getShell();
    }
    if (widget instanceof Caret) {
        return ((Caret) widget).getParent().getShell();
    }
    if (widget instanceof DragSource) {
        return ((DragSource) widget).getControl().getShell();
    }
    if (widget instanceof DropTarget) {
        return ((DropTarget) widget).getControl().getShell();
    }
    if (widget instanceof Menu) {
        return ((Menu) widget).getParent().getShell();
    }
    if (widget instanceof ScrollBar) {
        return ((ScrollBar) widget).getParent().getShell();
    }

    return null;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:30,代码来源:SWTUtil.java

示例5: GridCopyEnable

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * @param gridTable
 */
public GridCopyEnable(Grid gridTable) {
	Assert.isNotNull(gridTable);
	this.gridTable = gridTable;
	defaultCaret = new Caret(gridTable, SWT.NONE);
	clipboard = new Clipboard(gridTable.getDisplay());
	this.gridTable.setCaret(defaultCaret);
	this.gridTable.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM));
	initListener();
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:13,代码来源:GridCopyEnable.java

示例6: getPoint

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
public static Point getPoint(Caret c) {
	Point p = new Point(c.getBounds().x + 46, c.getBounds().y
			+ c.getBounds().height + 51);

	Control control = c.getParent();

	while (control.getParent() != null) {
		control = control.getParent();
		p.x += control.getBounds().x;
		p.y += control.getBounds().y;
	}

	return p;
}
 
开发者ID:yaoxinghuo,项目名称:StringEditEclipse,代码行数:15,代码来源:StringHandler.java

示例7: windowAlwaysInScreen

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * ��ֹ���ڳ�����Ļ
 * �˷����������ձ��ԣ�����black�����ijЩShell�������
 * @param location ����λ�õ�
 * @param shell ��ҪУ׼��Shell����
 * @param addvalue �ڻ���λ�õ�location֮�ϵ����긽��ֵ������Ϊnull
 * 
 */
public static Point windowAlwaysInScreen(Point location,Shell parent, Shell shell,Caret caret){
	int newX = 0,newY = 0;
	int width = 0, height = 0;
	int lineheightatcaretoffset = (int)caret.getData();
	int caretsizeX = 0,caretsizeY =0;
	if(caret != null){
		caretsizeX = caret.getSize().x;
		caretsizeY = caret.getSize().y;
	}
	if(parent != null){
		width = returnScreenWidth();
		//width = parent.getSize().x;
		height = parent.getSize().y;
	}else{
		width = returnScreenWidth();
		height = returnScreenHeight();
	}
	int locationX = location.x;
	int locationY = location.y;
	int sizeX = shell.getSize().x;
	int sizeY = shell.getSize().y;
	
	if(locationX <= 0){
		newX = 0;
	}
	if(locationX+sizeX+caretsizeX >= width){
		newX = width-sizeX;
	}
	if(locationY <= 0){
		newY = 0;
	}
	if(locationY+sizeY+caretsizeY >= height){
		if(caret.getStyle() == SWT.VERTICAL)
			newY = locationY-sizeY;
		else newY = locationY-sizeY-lineheightatcaretoffset;
	}
	if(newX == 0) newX = locationX;
	if(newY == 0) {
		if(caret.getStyle() == SWT.VERTICAL)
			newY = locationY+caretsizeY;
		else newY = locationY+caret.getSize().y;
	}
	shell.setLocation(newX, newY);
	return new Point(newX,newY);
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:54,代码来源:windowLocation.java

示例8: CheckForUpdates

import org.eclipse.swt.widgets.Caret; //导入依赖的package包/类
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public CheckForUpdates(Composite parent, int style) {
	super(parent, style);
	GridLayout gridLayout = new GridLayout(1, false);
	gridLayout.marginHeight = 0;
	gridLayout.marginWidth = 0;
	gridLayout.verticalSpacing = 0;
	gridLayout.horizontalSpacing = 0;
	setLayout(gridLayout);
	setVisible(false);

	txtStatus = new StyledText(this, SWT.WRAP);
	txtStatus.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	txtStatus.setEditable(false);
	txtStatus.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
	txtStatus.setBackground(getBackground());
	txtStatus.setFont(FontSize.getThisFontInNewSize(txtStatus.getFont(), 10, SWT.NORMAL));
	txtStatus.addMouseListener(mouseHandler);
	txtStatus.setCaret(new Caret(txtStatus, SWT.NONE));
	setText("Rel updates?");

	updateChecker = new UpdatesCheck(parent.getDisplay()) {
		@Override
		public void completed(SendStatus sendStatus) {
			CheckForUpdates.this.completed(sendStatus);
		}
	};

	TimerTask checkForUpdates = new TimerTask() {
		@Override
		public void run() {
			if (CheckForUpdates.this.isDisposed())
				return;
			getDisplay().asyncExec(() -> {
				if (CheckForUpdates.this.isDisposed())
					return;
				setVisible(true);
				setText("Rel updates?");
				System.out.println("CheckForUpdates: check for updates.");
				updateChecker.doCancel();
				updateChecker.doSend();
			});
		}
	};

	// Check for updates after 10 seconds, then every 12 hours
	Timer checkTimer = new Timer();
	checkTimer.schedule(checkForUpdates, 1000 * 5, 1000 * 60 * 60 * 12);
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:55,代码来源:CheckForUpdates.java


注:本文中的org.eclipse.swt.widgets.Caret类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。