Spec-Zone .ru
спецификации, руководства, описания, API
|
001/* 002 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. Oracle designates this 008 * particular file as subject to the "Classpath" exception as provided 009 * by Oracle in the LICENSE file that accompanied this code. 010 * 011 * This code is distributed in the hope that it will be useful, but WITHOUT 012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 014 * version 2 for more details (a copy is included in the LICENSE file that 015 * accompanied this code). 016 * 017 * You should have received a copy of the GNU General Public License version 018 * 2 along with this work; if not, write to the Free Software Foundation, 019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 020 * 021 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 022 * or visit www.oracle.com if you need additional information or have any 023 * questions. 024 */ 025 026package javafx.event; 027 028/** 029 * An {@link Event} representing some type of action. This event type is widely 030 * used to represent a variety of things, such as when a {@link javafx.scene.control.Button} 031 * has been fired, when a {@link javafx.animation.KeyFrame} has finished, and other 032 * such usages. 033 */ 034public class ActionEvent extends Event { 035 036 private static final long serialVersionUID = 20121107L; 037 /** 038 * The only valid EventType for the ActionEvent. 039 */ 040 public static final EventType<ActionEvent> ACTION = 041 new EventType<ActionEvent>(Event.ANY, "ACTION"); 042 043 /** 044 * Common supertype for all action event types. 045 */ 046 public static final EventType<ActionEvent> ANY = ACTION; 047 048 /** 049 * Creates a new {@code ActionEvent} with an event type of {@code ACTION}. 050 * The source and target of the event is set to {@code NULL_SOURCE_TARGET}. 051 */ 052 public ActionEvent() { 053 super(ACTION); 054 } 055 056 /** 057 * Construct a new {@code ActionEvent} with the specified event source and target. 058 * If the source or target is set to {@code null}, it is replaced by the 059 * {@code NULL_SOURCE_TARGET} value. All ActionEvents have their type set to 060 * {@code ACTION}. 061 * 062 * @param source the event source which sent the event 063 * @param target the event target to associate with the event 064 */ 065 public ActionEvent(Object source, EventTarget target) { 066 super(source, target, ACTION); 067 } 068 069 @Override 070 public ActionEvent copyFor(Object newSource, EventTarget newTarget) { 071 return (ActionEvent) super.copyFor(newSource, newTarget); 072 } 073 074 @Override 075 public EventType<? extends ActionEvent> getEventType() { 076 return (EventType<? extends ActionEvent>) super.getEventType(); 077 } 078 079 080 081}