本文整理汇总了Java中javafx.event.EventTarget类的典型用法代码示例。如果您正苦于以下问题:Java EventTarget类的具体用法?Java EventTarget怎么用?Java EventTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EventTarget类属于javafx.event包,在下文中一共展示了EventTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isNotHotKey
import javafx.event.EventTarget; //导入依赖的package包/类
/**
* @param event the event.
* @return true if the event is not hotkey.
*/
@FXThread
public static boolean isNotHotKey(@Nullable final KeyEvent event) {
if (event == null) return false;
final String text = event.getText();
if (text.isEmpty()) return false;
final KeyCode code = event.getCode();
final EventTarget target = event.getTarget();
if (code == KeyCode.TAB && !(target instanceof TextInputControl)) {
return false;
}
if (event.isControlDown()) {
return false;
} else if (event.isShiftDown()) {
return false;
}
return true;
}
示例2: GoogleTrendChartEvent
import javafx.event.EventTarget; //导入依赖的package包/类
/**
* @param source
* @param target
* @param eventType
* @param x
* @param y
* @param screenX
* @param screenY
* @param pickResult
* @param clickCount
* @param contents
*/
public GoogleTrendChartEvent(Object source, EventTarget target, EventType<? extends GoogleTrendChartEvent> eventType, double x,
double y, double screenX, double screenY, PickResult pickResult, int clickCount, List<Node> contents) {
super(source, target, eventType);
this.x = x;
this.y = y;
this.screenX = screenX;
this.screenY = screenY;
this.sceneX = x;
this.sceneY = y;
this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y);
final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null);
this.x = p.getX();
this.y = p.getY();
this.z = p.getZ();
this.clickCount = clickCount;
this.contents = contents;
}
示例3: DockEvent
import javafx.event.EventTarget; //导入依赖的package包/类
/**
* Constructs new DockEvent event..
*
* @param source the source of the event. Can be null.
* @param target the target of the event. Can be null.
* @param eventType The type of the event.
* @param x The x with respect to the source. Should be in scene coordinates if source == null or
* source is not a Node.
* @param y The y with respect to the source. Should be in scene coordinates if source == null or
* source is not a Node.
* @param screenX The x coordinate relative to screen.
* @param screenY The y coordinate relative to screen.
* @param pickResult pick result. Can be null, in this case a 2D pick result without any further
* values is constructed based on the scene coordinates
* @param contents The contents being dragged during this event.
*/
public DockEvent(Object source, EventTarget target, EventType<? extends DockEvent> eventType,
double x, double y, double screenX, double screenY, PickResult pickResult, Node contents) {
super(source, target, eventType);
this.x = x;
this.y = y;
this.screenX = screenX;
this.screenY = screenY;
this.sceneX = x;
this.sceneY = y;
this.pickResult = pickResult != null ? pickResult : new PickResult(target, x, y);
final Point3D p = InputEventUtils.recomputeCoordinates(this.pickResult, null);
this.x = p.getX();
this.y = p.getY();
this.z = p.getZ();
this.contents = contents;
}
示例4: isOnSelectedCell
import javafx.event.EventTarget; //导入依赖的package包/类
/**
* Checks if the given {@link MouseEvent} is on the selected cell.
*
* @param pMouseEvent the {@link MouseEvent}.
* @return {@code true} if the given event is on the selected cell.
*/
private boolean isOnSelectedCell(MouseEvent pMouseEvent)
{
EventTarget target = pMouseEvent.getTarget();
if (target instanceof Node)
{
Node targetNode = (Node)target;
while (targetNode != null && !(targetNode instanceof FXDataBooksTree))
{
if (targetNode instanceof TreeCell<?>)
{
return ((TreeCell<?>)targetNode).isSelected();
}
targetNode = targetNode.getParent();
}
}
return false;
}
示例5: startDrag
import javafx.event.EventTarget; //导入依赖的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);
}
示例6: isOnEntry
import javafx.event.EventTarget; //导入依赖的package包/类
private boolean isOnEntry(EventTarget target) {
if (target == null || !(target instanceof Node)) {
return false;
}
Node node = (Node) target;
if (node instanceof DayEntryView) {
return true;
}
return isOnEntry(node.getParent());
}
示例7: isScrollBar
import javafx.event.EventTarget; //导入依赖的package包/类
private boolean isScrollBar(EventTarget target) {
if (target instanceof Node) {
return isScrollBar((Node) target);
}
return false;
}
示例8: startDrag
import javafx.event.EventTarget; //导入依赖的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);
}
示例9: redirect
import javafx.event.EventTarget; //导入依赖的package包/类
private void redirect(@NotNull final GestureEvent event) {
final EventTarget target = event.getTarget();
if (target == destination) return;
final FileEditor currentEditor = editorAreaComponent.getCurrentEditor();
if (currentEditor == null || !currentEditor.isInside(event.getSceneX(), event.getSceneY(), event.getClass())) {
return;
}
Event.fireEvent(destination, event.copyFor(event.getSource(), destination));
}
示例10: processMouseClick
import javafx.event.EventTarget; //导入依赖的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();
}
示例11: isOnSelectedCell
import javafx.event.EventTarget; //导入依赖的package包/类
/**
* Checks if the given {@link MouseEvent} is on the selected cell.
*
* @param pMouseEvent the {@link MouseEvent}.
* @return {@code true} if the given event is on the selected cell.
*/
private boolean isOnSelectedCell(MouseEvent pMouseEvent)
{
EventTarget target = pMouseEvent.getTarget();
if (target instanceof Node)
{
boolean isCellSelection = resource.getSelectionModel().isCellSelectionEnabled();
Node targetNode = (Node)target;
while (targetNode != null && !(targetNode instanceof FXDataBookView))
{
if (isCellSelection && targetNode instanceof TableCell<?, ?>)
{
return ((TableCell<?, ?>)targetNode).isSelected();
}
else if (!isCellSelection && targetNode instanceof TableRow<?>)
{
return ((TableRow<?>)targetNode).isSelected();
}
targetNode = targetNode.getParent();
}
}
return false;
}
示例12: treeViewClicked
import javafx.event.EventTarget; //导入依赖的package包/类
public void treeViewClicked(MouseEvent ev) {
if (ev.getClickCount() == 2) {
// don't process click on triangle
EventTarget target = ev.getTarget();
if (target instanceof Node && !"arrow".equals(((Node)target).getStyleClass())) {
TreeItem<DbTreeValue> selectedItem = treeView.getSelectionModel().getSelectedItem();
if (selectedItem != null && selectedItem.getValue().getValueType() == TreeValueType.COLLECTION) {
mainFrameController.openTab();
ev.consume();
}
}
}
}
示例13: initializeKeyActions
import javafx.event.EventTarget; //导入依赖的package包/类
private void initializeKeyActions() {
addEventHandler(KeyEvent.KEY_RELEASED, event -> {
if (isDeleteCode(event.getCode())) {
EventTarget target = event.getTarget();
if (target instanceof DraggableAudioFileListView) {
DraggableAudioFileListView listView = (DraggableAudioFileListView) target;
removeTracks(newArrayList(listView.getSelectionModel().getSelectedIndices()));
}
}
});
}
示例14: GameEvent
import javafx.event.EventTarget; //导入依赖的package包/类
public GameEvent(GameHandler source, EventTarget target, EventType<? extends GameEvent> eventType) {
super(source, target, eventType);
}
示例15: SujiEvent
import javafx.event.EventTarget; //导入依赖的package包/类
public SujiEvent(EventPublisher source, EventTarget target, EventType<? extends SujiEvent> eventType) {
super(source, target, eventType);
publisher = source;
}