本文整理汇总了Java中org.eclipse.swt.SWT.CONTROL属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.CONTROL属性的具体用法?Java SWT.CONTROL怎么用?Java SWT.CONTROL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.swt.SWT
的用法示例。
在下文中一共展示了SWT.CONTROL属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMouseEventToFX
private void sendMouseEventToFX(MouseEvent me, int embedMouseType) {
if (scenePeer == null) {
return;
}
Point los = toDisplay(me.x, me.y);
boolean primaryBtnDown = (me.stateMask & SWT.BUTTON1) != 0;
boolean middleBtnDown = (me.stateMask & SWT.BUTTON2) != 0;
boolean secondaryBtnDown = (me.stateMask & SWT.BUTTON3) != 0;
boolean shift = (me.stateMask & SWT.SHIFT) != 0;
boolean control = (me.stateMask & SWT.CONTROL) != 0;
boolean alt = (me.stateMask & SWT.ALT) != 0;
boolean meta = (me.stateMask & SWT.COMMAND) != 0;
int button = me.button;
switch (embedMouseType) {
case AbstractEvents.MOUSEEVENT_PRESSED:
primaryBtnDown |= me.button == 1;
middleBtnDown |= me.button == 2;
secondaryBtnDown |= me.button == 3;
break;
case AbstractEvents.MOUSEEVENT_RELEASED:
primaryBtnDown &= me.button != 1;
middleBtnDown &= me.button != 2;
secondaryBtnDown &= me.button != 3;
break;
case AbstractEvents.MOUSEEVENT_CLICKED:
// Don't send click events to FX, as they are generated in Scene
return;
case AbstractEvents.MOUSEEVENT_MOVED:
case AbstractEvents.MOUSEEVENT_DRAGGED:
case AbstractEvents.MOUSEEVENT_ENTERED:
case AbstractEvents.MOUSEEVENT_EXITED:
// If this event was the result of mouse movement and has no
// button associated with it, then we look at the state to
// determine which button to report
if (button == 0) {
if ((me.stateMask & SWT.BUTTON1) != 0) {
button = 1;
} else if ((me.stateMask & SWT.BUTTON2) != 0) {
button = 2;
} else if ((me.stateMask & SWT.BUTTON3) != 0) {
button = 3;
}
}
break;
default:
break;
}
scenePeer.mouseEvent(
embedMouseType,
SWTEvents.mouseButtonToEmbedMouseButton(button, me.stateMask),
primaryBtnDown, middleBtnDown, secondaryBtnDown,
me.x, me.y,
los.x, los.y,
shift, control, alt, meta,
SWTEvents.getWheelRotation(me, embedMouseType),
false); // RT-32990: popup trigger not implemented
}
示例2: handleSearchKeyPress
private void handleSearchKeyPress(KeyEvent e) {
TableViewSWTFilter<?> filter = tv.getSWTFilter();
if (filter == null || e.widget == filter.widget) {
return;
}
String newText = null;
// normal character: jump to next item with a name beginning with this character
if (ASYOUTYPE_MODE == ASYOUTYPE_MODE_FIND) {
if (System.currentTimeMillis() - filter.lastFilterTime > 3000)
newText = "";
}
if (e.keyCode == SWT.BS) {
if (e.stateMask == SWT.CONTROL) {
newText = "";
} else if (filter.nextText.length() > 0) {
newText = filter.nextText.substring(0, filter.nextText.length() - 1);
}
} else if ((e.stateMask & ~SWT.SHIFT) == 0 && e.character > 32 && e.character != SWT.DEL) {
newText = filter.nextText + String.valueOf(e.character);
}
if (newText == null) {
return;
}
if (ASYOUTYPE_MODE == ASYOUTYPE_MODE_FILTER) {
if (filter != null && filter.widget != null && !filter.widget.isDisposed()) {
filter.widget.setFocus();
}
tv.setFilterText(newText);
// } else {
// TableCellCore[] cells = getColumnCells("name");
//
// //System.out.println(sLastSearch);
//
// Arrays.sort(cells, TableCellImpl.TEXT_COMPARATOR);
// int index = Arrays.binarySearch(cells, filter.text,
// TableCellImpl.TEXT_COMPARATOR);
// if (index < 0) {
//
// int iEarliest = -1;
// String s = filter.regex ? filter.text : "\\Q" + filter.text + "\\E";
// Pattern pattern = Pattern.compile(s, Pattern.CASE_INSENSITIVE);
// for (int i = 0; i < cells.length; i++) {
// Matcher m = pattern.matcher(cells[i].getText());
// if (m.find() && (m.start() < iEarliest || iEarliest == -1)) {
// iEarliest = m.start();
// index = i;
// }
// }
//
// if (index < 0)
// // Insertion Point (best guess)
// index = -1 * index - 1;
// }
//
// if (index >= 0) {
// if (index >= cells.length)
// index = cells.length - 1;
// TableRowCore row = cells[index].getTableRowCore();
// int iTableIndex = row.getIndex();
// if (iTableIndex >= 0) {
// setSelectedRows(new TableRowCore[] {
// row
// });
// }
// }
// filter.lastFilterTime = System.currentTimeMillis();
}
e.doit = false;
}