本文整理匯總了Java中java.awt.Cursor.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.getType方法的具體用法?Java Cursor.getType怎麽用?Java Cursor.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.Cursor
的用法示例。
在下文中一共展示了Cursor.getType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: stopScanningForLinks
import java.awt.Cursor; //導入方法依賴的package包/類
/**
* Resets the editor state after the user clicks on a hyperlink or releases
* the hyperlink modifier.
*/
private void stopScanningForLinks() {
if (isScanningForLinks) {
Cursor c = getCursor();
isScanningForLinks = false;
linkGeneratorResult = null;
hoveredOverLinkOffset = -1;
if (c!=null && c.getType()==Cursor.HAND_CURSOR) {
setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR));
repaint(); // TODO: Repaint just the affected line.
}
}
}
示例2: setCursor
import java.awt.Cursor; //導入方法依賴的package包/類
@Override
protected void setCursor(final Cursor cursor) {
if (cursor == currentCursor) {
return;
}
currentCursor = cursor;
if (cursor == null) {
nativeSetBuiltInCursor(Cursor.DEFAULT_CURSOR, null);
return;
}
if (cursor instanceof CCustomCursor) {
final CCustomCursor customCursor = (CCustomCursor) cursor;
final long imagePtr = customCursor.getImageData();
if (imagePtr != 0L) {
final Point hotSpot = customCursor.getHotSpot();
nativeSetCustomCursor(imagePtr, hotSpot.x, hotSpot.y);
}
return;
}
final int type = cursor.getType();
if (type != Cursor.CUSTOM_CURSOR) {
nativeSetBuiltInCursor(type, null);
return;
}
final String name = cursor.getName();
if (name != null) {
nativeSetBuiltInCursor(NAMED_CURSOR, name);
return;
}
// do something special
throw new RuntimeException("Unimplemented");
}
示例3: instantiate
import java.awt.Cursor; //導入方法依賴的package包/類
@Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
Cursor cursor = (Cursor) oldInstance;
return new Expression(oldInstance, oldInstance.getClass(),
BeansUtils.NEW, new Object[] { cursor.getType() });
}