本文整理匯總了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");
}
}