本文整理汇总了Java中javafx.scene.input.MouseEvent.getTarget方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getTarget方法的具体用法?Java MouseEvent.getTarget怎么用?Java MouseEvent.getTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getTarget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performSelection
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void performSelection(MouseEvent evt) {
if ((evt.getButton().equals(PRIMARY) || evt.isPopupTrigger()) && evt.getClickCount() == 1) {
Entry<?> entry;
EntryViewBase<?> view = null;
if (evt.getTarget() instanceof EntryViewBase) {
view = (EntryViewBase<?>) evt.getTarget();
}
if (view == null) {
return;
}
String disableFocusHandlingKey = "disable-focus-handling"; //$NON-NLS-1$
view.getProperties().put(disableFocusHandlingKey, true);
view.requestFocus();
entry = view.getEntry();
if (entry != null) {
if (!isMultiSelect(evt) && !getSelections().contains(entry)) {
clearSelection();
}
if (isMultiSelect(evt) && getSelections().contains(entry)) {
getSelections().remove(entry);
} else if (!getSelections().contains(entry)) {
getSelections().add(entry);
}
}
view.getProperties().remove(disableFocusHandlingKey);
}
}
示例2: startDrag
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void startDrag(MouseEvent evt) {
EventTarget target = evt.getTarget();
if (isScrollBar(target) || !isOnEntry(target)) {
return;
}
Dragboard db = startDragAndDrop(TransferMode.MOVE);
ClipboardContent content = new ClipboardContent();
/*
* We have to add some content, otherwise drag over will not be called.
*/
content.putString("dummy"); //$NON-NLS-1$
db.setContent(content);
}
示例3: startDrag
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void startDrag(MouseEvent evt) {
EventTarget target = evt.getTarget();
if (!isOnEntry(target)) {
return;
}
Dragboard db = startDragAndDrop(TransferMode.MOVE);
ClipboardContent content = new ClipboardContent();
/*
* We have to add some content, otherwise drag over will not be called.
*/
content.putString("dummy"); //$NON-NLS-1$
db.setContent(content);
}
示例4: initDragModeAndHandle
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void initDragModeAndHandle(MouseEvent evt) {
dragMode = null;
handle = null;
if (!(evt.getTarget() instanceof EntryViewBase)) {
return;
}
dayEntryView = (DayEntryView) evt.getTarget();
entry = dayEntryView.getEntry();
Calendar calendar = entry.getCalendar();
if (calendar.isReadOnly()) {
return;
}
double y = evt.getY() - dayEntryView.getBoundsInParent().getMinY();
LOGGER.finer("y-coordinate inside entry view: " + y);
if (y > dayEntryView.getHeight() - 5) {
if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_END))) {
dragMode = DraggedEntry.DragMode.END_TIME;
handle = Handle.BOTTOM;
}
} else if (y < 5) {
if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_START))) {
dragMode = DraggedEntry.DragMode.START_TIME;
handle = Handle.TOP;
}
} else {
if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.MOVE))) {
dragMode = DraggedEntry.DragMode.START_AND_END_TIME;
handle = Handle.CENTER;
}
}
}
示例5: processMouseClick
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
* Handle a click to a tab.
*/
private void processMouseClick(@NotNull final MouseEvent event) {
final EventTarget target = event.getTarget();
if (!(target instanceof Node)) return;
final Node node = (Node) target;
if (!(node instanceof Text) || node.getStyleClass().contains("tab-container")) {
return;
}
final Parent label = node.getParent();
if (!(label instanceof Label)) {
return;
}
final Parent tabContainer = label.getParent();
if (!tabContainer.getStyleClass().contains("tab-container")) {
return;
}
if (isChangingTab()) {
setChangingTab(false);
return;
}
processExpandOrCollapse();
}
示例6: mousePressed
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override protected void mousePressed(MouseEvent me) {
Node target = (Node) me.getTarget();
if (onCloseButton(target)) {
recorder.recordSelect(this, getTextForTab((TabPane) node, getTab(target)) + "::close");
}
}