Major merge with Classpath.
Removed many duplicate files. * HACKING: Updated.x * classpath: Imported new directory. * standard.omit: New file. * Makefile.in, aclocal.m4, configure: Rebuilt. * sources.am: New file. * configure.ac: Run Classpath configure script. Moved code around to support. Disable xlib AWT peers (temporarily). * Makefile.am (SUBDIRS): Added 'classpath' (JAVAC): Removed. (AM_CPPFLAGS): Added more -I options. (BOOTCLASSPATH): Simplified. Completely redid how sources are built. Include sources.am. * include/Makefile.am (tool_include__HEADERS): Removed jni.h. * include/jni.h: Removed (in Classpath). * scripts/classes.pl: Updated to look at built classes. * scripts/makemake.tcl: New file. * testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Added -I options. (gcj_jni_invocation_compile_c_to_binary): Likewise. From-SVN: r102082
This commit is contained in:
parent
ea54b29342
commit
b0fa81eea9
2817 changed files with 11656 additions and 643398 deletions
|
@ -1,64 +0,0 @@
|
|||
/* AWTEventListener.java -- listen for all events in the AWT system
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This listener is for classes that need to listen to all events in the AWT
|
||||
* system. In general, this should not be used except for classes like
|
||||
* javax.accessibility or by event recorders.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see AWTEvent
|
||||
* @see Toolkit#addAWTEventListener(AWTEventListener, long)
|
||||
* @see Toolkit#removeAWTEventListener(AWTEventListener)
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface AWTEventListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when any event in the AWT system is dispatched.
|
||||
*
|
||||
* @param event the AWTEvent that was dispatched
|
||||
*/
|
||||
void eventDispatched(AWTEvent event);
|
||||
} // interface AWTEventListener
|
|
@ -1,154 +0,0 @@
|
|||
/* AWTEventListenerProxy.java -- wrapper/filter for AWTEventListener
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.util.EventListenerProxy;
|
||||
|
||||
/**
|
||||
* This class allows adding an AWTEventListener which only pays attention to
|
||||
* a specific event mask.
|
||||
*
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @see Toolkit
|
||||
* @see EventListenerProxy
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class AWTEventListenerProxy extends EventListenerProxy
|
||||
implements AWTEventListener
|
||||
{
|
||||
/** The event mask. */
|
||||
private final long mask;
|
||||
|
||||
/**
|
||||
* Construct an AWT Event Listener which only listens to events in the given
|
||||
* mask, passing the work on to the real listener.
|
||||
*
|
||||
* @param eventMask the mask of events to listen to
|
||||
* @param listener the wrapped listener
|
||||
*/
|
||||
public AWTEventListenerProxy(long eventMask, AWTEventListener listener)
|
||||
{
|
||||
super(listener);
|
||||
mask = eventMask;
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards events on to the delegate if they meet the event mask.
|
||||
*
|
||||
* @param event the property change event to filter
|
||||
* @throws NullPointerException if the delegate this was created with is null
|
||||
*/
|
||||
public void eventDispatched(AWTEvent event)
|
||||
{
|
||||
int id = event == null ? 0 : event.getID();
|
||||
if (((mask & AWTEvent.ACTION_EVENT_MASK) != 0
|
||||
&& event instanceof ActionEvent)
|
||||
|| ((mask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0
|
||||
&& event instanceof AdjustmentEvent)
|
||||
|| ((mask & AWTEvent.COMPONENT_EVENT_MASK) != 0
|
||||
&& event instanceof ComponentEvent
|
||||
&& (id >= ComponentEvent.COMPONENT_FIRST
|
||||
&& id <= ComponentEvent.COMPONENT_LAST))
|
||||
|| ((mask & AWTEvent.CONTAINER_EVENT_MASK) != 0
|
||||
&& event instanceof ContainerEvent)
|
||||
|| ((mask & AWTEvent.FOCUS_EVENT_MASK) != 0
|
||||
&& event instanceof FocusEvent)
|
||||
|| ((mask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0
|
||||
&& event instanceof HierarchyEvent
|
||||
&& (id == HierarchyEvent.ANCESTOR_MOVED
|
||||
|| id == HierarchyEvent.ANCESTOR_RESIZED))
|
||||
|| ((mask & AWTEvent.HIERARCHY_EVENT_MASK) != 0
|
||||
&& event instanceof HierarchyEvent
|
||||
&& id == HierarchyEvent.HIERARCHY_CHANGED)
|
||||
|| ((mask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0
|
||||
&& event instanceof InputMethodEvent)
|
||||
|| ((mask & AWTEvent.INVOCATION_EVENT_MASK) != 0
|
||||
&& event instanceof InvocationEvent)
|
||||
|| ((mask & AWTEvent.ITEM_EVENT_MASK) != 0
|
||||
&& event instanceof ItemEvent)
|
||||
|| ((mask & AWTEvent.KEY_EVENT_MASK) != 0
|
||||
&& event instanceof KeyEvent)
|
||||
|| ((mask & AWTEvent.MOUSE_EVENT_MASK) != 0
|
||||
&& event instanceof MouseEvent
|
||||
&& (id == MouseEvent.MOUSE_PRESSED
|
||||
|| id == MouseEvent.MOUSE_RELEASED
|
||||
|| id == MouseEvent.MOUSE_CLICKED
|
||||
|| id == MouseEvent.MOUSE_ENTERED
|
||||
|| id == MouseEvent.MOUSE_EXITED))
|
||||
|| ((mask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0
|
||||
&& event instanceof MouseEvent
|
||||
&& (id == MouseEvent.MOUSE_MOVED
|
||||
|| id == MouseEvent.MOUSE_DRAGGED))
|
||||
|| ((mask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0
|
||||
&& event instanceof MouseWheelEvent)
|
||||
|| ((mask & AWTEvent.PAINT_EVENT_MASK) != 0
|
||||
&& event instanceof PaintEvent)
|
||||
|| ((mask & AWTEvent.TEXT_EVENT_MASK) != 0
|
||||
&& event instanceof TextEvent)
|
||||
|| ((mask & AWTEvent.WINDOW_EVENT_MASK) != 0
|
||||
&& event instanceof WindowEvent
|
||||
&& (id == WindowEvent.WINDOW_OPENED
|
||||
|| id == WindowEvent.WINDOW_CLOSING
|
||||
|| id == WindowEvent.WINDOW_CLOSED
|
||||
|| id == WindowEvent.WINDOW_ICONIFIED
|
||||
|| id == WindowEvent.WINDOW_DEICONIFIED
|
||||
|| id == WindowEvent.WINDOW_ACTIVATED
|
||||
|| id == WindowEvent.WINDOW_DEACTIVATED))
|
||||
|| ((mask & AWTEvent.WINDOW_FOCUS_EVENT_MASK) != 0
|
||||
&& event instanceof WindowEvent
|
||||
&& (id == WindowEvent.WINDOW_GAINED_FOCUS
|
||||
|| id == WindowEvent.WINDOW_LOST_FOCUS))
|
||||
|| ((mask & AWTEvent.WINDOW_STATE_EVENT_MASK) != 0
|
||||
&& event instanceof WindowEvent
|
||||
&& id == WindowEvent.WINDOW_STATE_CHANGED))
|
||||
((AWTEventListener) getListener()).eventDispatched(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the event mask associated with this listener.
|
||||
*
|
||||
* @return the event mask
|
||||
*/
|
||||
public long getEventMask()
|
||||
{
|
||||
return mask;
|
||||
}
|
||||
} // class AWTEventListenerProxy
|
|
@ -1,226 +0,0 @@
|
|||
/* ActionEvent.java -- an action has been triggered
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
/**
|
||||
* This event is generated when an action on a component (such as a
|
||||
* button press) occurs.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ActionListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class ActionEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -7671078796273832149L;
|
||||
|
||||
/** Bit mask indicating the shift key was pressed. */
|
||||
public static final int SHIFT_MASK = InputEvent.SHIFT_MASK;
|
||||
|
||||
/** Bit mask indicating the control key was pressed. */
|
||||
public static final int CTRL_MASK = InputEvent.CTRL_MASK;
|
||||
|
||||
/** Bit mask indicating the that meta key was pressed. */
|
||||
public static final int META_MASK = InputEvent.META_MASK;
|
||||
|
||||
/** Bit mask indicating that the alt key was pressed. */
|
||||
public static final int ALT_MASK = InputEvent.ALT_MASK;
|
||||
|
||||
/** The first id number in the range of action id's. */
|
||||
public static final int ACTION_FIRST = 1001;
|
||||
|
||||
/** The last id number in the range of action id's. */
|
||||
public static final int ACTION_LAST = 1001;
|
||||
|
||||
/** An event id indicating that an action has occurred. */
|
||||
public static final int ACTION_PERFORMED = 1001;
|
||||
|
||||
/**
|
||||
* A nonlocalized string that gives more specific details of the event cause.
|
||||
*
|
||||
* @see #getActionCommand()
|
||||
* @serial the command for this event
|
||||
*/
|
||||
private final String actionCommand;
|
||||
|
||||
/**
|
||||
* The bitmask of the modifiers that were pressed during the action.
|
||||
*
|
||||
* @see #getModifiers()
|
||||
* @serial modifiers for this event
|
||||
*/
|
||||
private final int modifiers;
|
||||
|
||||
/**
|
||||
* The timestamp of this event; usually the same as the underlying input
|
||||
* event.
|
||||
*
|
||||
* @see #getWhen()
|
||||
* @serial the timestamp of the event
|
||||
* @since 1.4
|
||||
*/
|
||||
private final long when;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ActionEvent</code> with the
|
||||
* specified source, id, and command. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param command the command string for this action
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public ActionEvent(Object source, int id, String command)
|
||||
{
|
||||
this(source, id, command, EventQueue.getMostRecentEventTime(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ActionEvent</code> with the
|
||||
* specified source, id, command, and modifiers. Note that an invalid id
|
||||
* leads to unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param command the command string for this action
|
||||
* @param modifiers the bitwise or of modifier keys down during the action
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public ActionEvent(Object source, int id, String command, int modifiers)
|
||||
{
|
||||
this(source, id, command, EventQueue.getMostRecentEventTime(), modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ActionEvent</code> with the
|
||||
* specified source, id, command, and modifiers, and timestamp. Note that
|
||||
* an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param command the command string for this action
|
||||
* @param when the timestamp of the event
|
||||
* @param modifiers the bitwise or of modifier keys down during the action
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public ActionEvent(Object source, int id, String command, long when,
|
||||
int modifiers)
|
||||
{
|
||||
super(source, id);
|
||||
actionCommand = command;
|
||||
this.when = when;
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the command string associated with this action.
|
||||
*
|
||||
* @return the command string associated with this action
|
||||
*/
|
||||
public String getActionCommand()
|
||||
{
|
||||
return actionCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the timestamp of when this action took place. Usually, this
|
||||
* corresponds to the timestamp of the underlying InputEvent.
|
||||
*
|
||||
* @return the timestamp of this action
|
||||
* @since 1.4
|
||||
*/
|
||||
public long getWhen()
|
||||
{
|
||||
return when;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the keys held down during the action. This value will be a
|
||||
* combination of the bit mask constants defined in this class, or 0 if no
|
||||
* modifiers were pressed.
|
||||
*
|
||||
* @return the modifier bits
|
||||
*/
|
||||
public int getModifiers()
|
||||
{
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string that identifies the action event. This is in the format
|
||||
* <code>"ACTION_PERFORMED,cmd=" + getActionCommand() + ",when=" + getWhen()
|
||||
* + ",modifiers=" + <modifier string></code>, where the modifier
|
||||
* string is in the order "Meta", "Ctrl", "Alt", "Shift", "Alt Graph", and
|
||||
* "Button1", separated by '+', according to the bits set in getModifiers().
|
||||
*
|
||||
* @return a string identifying the event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
StringBuffer s = new StringBuffer(id == ACTION_PERFORMED
|
||||
? "ACTION_PERFORMED,cmd="
|
||||
: "unknown type,cmd=");
|
||||
s.append(actionCommand).append(",when=").append(when).append(",modifiers");
|
||||
int len = s.length();
|
||||
s.setLength(len + 1);
|
||||
if ((modifiers & META_MASK) != 0)
|
||||
s.append("+Meta");
|
||||
if ((modifiers & CTRL_MASK) != 0)
|
||||
s.append("+Ctrl");
|
||||
if ((modifiers & ALT_MASK) != 0)
|
||||
s.append("+Alt");
|
||||
if ((modifiers & SHIFT_MASK) != 0)
|
||||
s.append("+Shift");
|
||||
if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0)
|
||||
s.append("+Alt Graph");
|
||||
if ((modifiers & InputEvent.BUTTON1_MASK) != 0)
|
||||
s.append("+Button1");
|
||||
s.setCharAt(len, '=');
|
||||
return s.toString();
|
||||
}
|
||||
} // class ActionEvent
|
|
@ -1,59 +0,0 @@
|
|||
/* ActionListener.java -- listens for action events
|
||||
Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that listen for action events.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ActionEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface ActionListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is invoked when an action occurs.
|
||||
*
|
||||
* @param event the <code>ActionEvent</code> that occurred
|
||||
*/
|
||||
void actionPerformed(ActionEvent event);
|
||||
}
|
|
@ -1,222 +0,0 @@
|
|||
/* AdjustmentEvent.java -- an adjustable value was changed
|
||||
Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Adjustable;
|
||||
|
||||
/**
|
||||
* This class represents an event that is generated when an adjustable
|
||||
* value is changed.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see Adjustable
|
||||
* @see AdjustmentListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class AdjustmentEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 5700290645205279921L;
|
||||
|
||||
/** This is the first id in the range of ids used by adjustment events. */
|
||||
public static final int ADJUSTMENT_FIRST = 601;
|
||||
|
||||
/** This is the last id in the range of ids used by adjustment events. */
|
||||
public static final int ADJUSTMENT_LAST = 601;
|
||||
|
||||
/** This is the id indicating an adjustment value changed. */
|
||||
public static final int ADJUSTMENT_VALUE_CHANGED = 601;
|
||||
|
||||
/** Adjustment type for unit increments. */
|
||||
public static final int UNIT_INCREMENT = 1;
|
||||
|
||||
/** Adjustment type for unit decrements. */
|
||||
public static final int UNIT_DECREMENT = 2;
|
||||
|
||||
/** Adjustment type for block decrements. */
|
||||
public static final int BLOCK_DECREMENT = 3;
|
||||
|
||||
/** Adjustment type for block increments. */
|
||||
public static final int BLOCK_INCREMENT = 4;
|
||||
|
||||
/** Adjustment type for tracking adjustments. */
|
||||
public static final int TRACK = 5;
|
||||
|
||||
/**
|
||||
* The adjustable object that caused the event.
|
||||
*
|
||||
* @see #getAdjustable()
|
||||
* @serial the cause
|
||||
*/
|
||||
private final Adjustable adjustable;
|
||||
|
||||
/**
|
||||
* The type of adjustment, one of {@link #UNIT_INCREMENT},
|
||||
* {@link #UNIT_DECREMENT}, {@link #BLOCK_INCREMENT},
|
||||
* {@link #BLOCK_DECREMENT}, or {@link #TRACK}.
|
||||
*
|
||||
* @see #getAdjustmentType()
|
||||
* @serial the adjustment type
|
||||
*/
|
||||
private final int adjustmentType;
|
||||
|
||||
/**
|
||||
* The new value of the adjustable; it should be in the range of the
|
||||
* adjustable cause.
|
||||
*
|
||||
* @see #getValue()
|
||||
* @serial the adjustment value
|
||||
*/
|
||||
private final int value;
|
||||
|
||||
/**
|
||||
* True if this is in a series of multiple adjustment events.
|
||||
*
|
||||
* @see #getValueIsAdjusting()
|
||||
* @serial true if this is not the last adjustment
|
||||
* @since 1.4
|
||||
*/
|
||||
private final boolean isAdjusting;
|
||||
|
||||
/**
|
||||
* Initializes an instance of <code>AdjustmentEvent</code> with the
|
||||
* specified source, id, type, and value. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param type the event type, one of the constants of this class
|
||||
* @param value the value of the adjustment
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public AdjustmentEvent(Adjustable source, int id, int type, int value)
|
||||
{
|
||||
this(source, id, type, value, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes an instance of <code>AdjustmentEvent</code> with the
|
||||
* specified source, id, type, and value. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param type the event type, one of the constants of this class
|
||||
* @param value the value of the adjustment
|
||||
* @param isAdjusting if this event is in a chain of adjustments
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public AdjustmentEvent(Adjustable source, int id, int type, int value,
|
||||
boolean isAdjusting)
|
||||
{
|
||||
super(source, id);
|
||||
this.adjustmentType = type;
|
||||
this.value = value;
|
||||
adjustable = source;
|
||||
this.isAdjusting = isAdjusting;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the source of the event as an <code>Adjustable</code>.
|
||||
*
|
||||
* @return the <code>Adjustable</code> source of the event
|
||||
*/
|
||||
public Adjustable getAdjustable()
|
||||
{
|
||||
return adjustable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the new value of the adjustable object.
|
||||
*
|
||||
* @return the value of the event
|
||||
*/
|
||||
public int getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the event, which will be one of
|
||||
* {@link #UNIT_INCREMENT}, {@link #UNIT_DECREMENT},
|
||||
* {@link #BLOCK_INCREMENT}, {@link #BLOCK_DECREMENT}, or {@link #TRACK}.
|
||||
*
|
||||
* @return the type of the event
|
||||
*/
|
||||
public int getAdjustmentType()
|
||||
{
|
||||
return adjustmentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if this event is part of a sequence of multiple adjustements.
|
||||
*
|
||||
* @return true if this is not the last adjustment
|
||||
* @since 1.4
|
||||
*/
|
||||
public boolean getValueIsAdjusting()
|
||||
{
|
||||
return isAdjusting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string that describes the event. This is in the format
|
||||
* <code>"ADJUSTMENT_VALUE_CHANGED,adjType=" + <type> + ",value="
|
||||
* + getValue() + ",isAdjusting=" + getValueIsAdjusting()</code>, where
|
||||
* type is the name of the constant returned by getAdjustmentType().
|
||||
*
|
||||
* @return a string that describes the event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return (id == ADJUSTMENT_VALUE_CHANGED
|
||||
? "ADJUSTMENT_VALUE_CHANGED,adjType=" : "unknown type,adjType=")
|
||||
+ (adjustmentType == UNIT_INCREMENT ? "UNIT_INCREMENT,value="
|
||||
: adjustmentType == UNIT_DECREMENT ? "UNIT_DECREMENT,value="
|
||||
: adjustmentType == BLOCK_INCREMENT ? "BLOCK_INCREMENT,value="
|
||||
: adjustmentType == BLOCK_DECREMENT ? "BLOCK_DECREMENT,value="
|
||||
: adjustmentType == TRACK ? "TRACK,value=" : "unknown type,value=")
|
||||
+ value + ",isAdjusting=" + isAdjusting;
|
||||
}
|
||||
} // class AdjustmentEvent
|
|
@ -1,58 +0,0 @@
|
|||
/* AdjustmentListener.java -- listen for adjustment events
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* Interface for classes that listen for adjustment events.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface AdjustmentListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when an adjustable value changes.
|
||||
*
|
||||
* @param event the <code>AdjustmentEvent</code> that occurred
|
||||
*/
|
||||
void adjustmentValueChanged(AdjustmentEvent event);
|
||||
} // interface AdjustmentListener
|
|
@ -1,97 +0,0 @@
|
|||
/* ComponentAdapter.java -- convenience class for writing component listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>ComponentListener</code> and implements
|
||||
* all methods with empty bodies. This allows a listener interested in
|
||||
* implementing only a subset of the <code>ComponentListener</code>
|
||||
* interface to extend this class and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ComponentEvent
|
||||
* @see ComponentListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class ComponentAdapter implements ComponentListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public ComponentAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void componentResized(ComponentEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void componentMoved(ComponentEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void componentShown(ComponentEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void componentHidden(ComponentEvent event)
|
||||
{
|
||||
}
|
||||
} // class ComponentAdapter
|
|
@ -1,137 +0,0 @@
|
|||
/* ComponentEvent.java -- notification of events for components
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* This class is for events generated when a component is moved, resized,
|
||||
* hidden, or shown. These events normally do not need to be handled by the
|
||||
* application, since the AWT system automatically takes care of them. This
|
||||
* is also the superclass for other events on components, but
|
||||
* ComponentListeners ignore such subclasses.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ComponentAdapter
|
||||
* @see ComponentListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class ComponentEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 8101406823902992965L;
|
||||
|
||||
/** This is the first id in the range of ids used by this class. */
|
||||
public static final int COMPONENT_FIRST = 100;
|
||||
|
||||
/** This is the last id in the range of ids used by this class. */
|
||||
public static final int COMPONENT_LAST = 103;
|
||||
|
||||
/** This id indicates that a component was moved. */
|
||||
public static final int COMPONENT_MOVED = 100;
|
||||
|
||||
/** This id indicates that a component was resized. */
|
||||
public static final int COMPONENT_RESIZED = 101;
|
||||
|
||||
/** This id indicates that a component was shown. */
|
||||
public static final int COMPONENT_SHOWN = 102;
|
||||
|
||||
/** This id indicates that a component was hidden. */
|
||||
public static final int COMPONENT_HIDDEN = 103;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ComponentEvent</code> with the
|
||||
* specified source and id. Note that an invalid id leads to unspecified
|
||||
* results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public ComponentEvent(Component source, int id)
|
||||
{
|
||||
super(source, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the event source as a <code>Component</code>. If the
|
||||
* source has subsequently been modified to a non-Component, this returns
|
||||
* null.
|
||||
*
|
||||
* @return the event source as a <code>Component</code>, or null
|
||||
*/
|
||||
public Component getComponent()
|
||||
{
|
||||
return source instanceof Component ? (Component) source : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string identifying this event. This is the field
|
||||
* name of the id type, and for COMPONENT_MOVED or COMPONENT_RESIZED, the
|
||||
* new bounding box of the component.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
// Unlike Sun, we don't throw NullPointerException or ClassCastException
|
||||
// when source was illegally changed.
|
||||
switch (id)
|
||||
{
|
||||
case COMPONENT_MOVED:
|
||||
return "COMPONENT_MOVED "
|
||||
+ (source instanceof Component
|
||||
? ((Component) source).getBounds() : (Object) "");
|
||||
case COMPONENT_RESIZED:
|
||||
return "COMPONENT_RESIZED "
|
||||
+ (source instanceof Component
|
||||
? ((Component) source).getBounds() : (Object) "");
|
||||
case COMPONENT_SHOWN:
|
||||
return "COMPONENT_SHOWN";
|
||||
case COMPONENT_HIDDEN:
|
||||
return "COMPONENT_HIDDEN";
|
||||
default:
|
||||
return "unknown type";
|
||||
}
|
||||
}
|
||||
} // class ComponentEvent
|
|
@ -1,84 +0,0 @@
|
|||
/* ComponentListener.java -- receive all events for a component
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that receive all events from a component.
|
||||
* Normally it is not necessary to process these events since the AWT
|
||||
* handles them internally, taking all appropriate actions. To watch a subset
|
||||
* of these events, use a ComponentAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ComponentAdapter
|
||||
* @see ComponentEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface ComponentListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the component is resized.
|
||||
*
|
||||
* @param event the <code>ComponentEvent</code> indicating the resize
|
||||
*/
|
||||
void componentResized(ComponentEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the component is moved.
|
||||
*
|
||||
* @param event the <code>ComponentEvent</code> indicating the move
|
||||
*/
|
||||
void componentMoved(ComponentEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the component is made visible.
|
||||
*
|
||||
* @param event the <code>ComponentEvent</code> indicating the visibility
|
||||
*/
|
||||
void componentShown(ComponentEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the component is hidden.
|
||||
*
|
||||
* @param event the <code>ComponentEvent</code> indicating the visibility
|
||||
*/
|
||||
void componentHidden(ComponentEvent event);
|
||||
} // interface ComponentListener
|
|
@ -1,79 +0,0 @@
|
|||
/* ContainerAdapter.java -- convenience class for writing container listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>ContainerListener</code> and implements
|
||||
* all methods with empty bodies. This allows a listener interested in
|
||||
* implementing only a subset of the <code>ContainerListener</code>
|
||||
* interface to extend this class and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ContainerEvent
|
||||
* @see ContainerListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class ContainerAdapter implements ContainerListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public ContainerAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void componentAdded(ContainerEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void componentRemoved(ContainerEvent event)
|
||||
{
|
||||
}
|
||||
} // class ContainerAdapter
|
|
@ -1,135 +0,0 @@
|
|||
/* ContainerEvent.java -- components added/removed from a container
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
|
||||
/**
|
||||
* This event is generated when a component is added or removed from a
|
||||
* container. Applications do not ordinarily need to handle these events
|
||||
* since the AWT system handles them internally.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ContainerAdapter
|
||||
* @see ContainerListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class ContainerEvent extends ComponentEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -4114942250539772041L;
|
||||
|
||||
/** This is the first id in the id range used by this class. */
|
||||
public static final int CONTAINER_FIRST = 300;
|
||||
|
||||
/** This is the last id in the id range used by this class. */
|
||||
public static final int CONTAINER_LAST = 301;
|
||||
|
||||
/** This id indicates a component was added to the container. */
|
||||
public static final int COMPONENT_ADDED = 300;
|
||||
|
||||
/** This id indicates a component was removed from the container. */
|
||||
public static final int COMPONENT_REMOVED = 301;
|
||||
|
||||
/**
|
||||
* The non-null child component that was added or removed.
|
||||
*
|
||||
* @serial the child component that changed
|
||||
*/
|
||||
private final Component child;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ContainerEvent</code> with the
|
||||
* specified source and id. Additionally, the affected child component
|
||||
* is also passed as a parameter. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source container of the event
|
||||
* @param id the event id
|
||||
* @param child the child component affected by this event
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public ContainerEvent(Component source, int id, Component child)
|
||||
{
|
||||
super(source, id);
|
||||
this.child = child;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the source of this event as a <code>Container</code>.
|
||||
*
|
||||
* @return the source of the event
|
||||
* @throws ClassCastException if the source is changed to a non-Container
|
||||
*/
|
||||
public Container getContainer()
|
||||
{
|
||||
return (Container) source;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the child object that was added or removed from
|
||||
* the container.
|
||||
*
|
||||
* @return the child object added or removed
|
||||
*/
|
||||
public Component getChild()
|
||||
{
|
||||
return child;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string identifying this event. It is formatted as:
|
||||
* <code>(getID() == COMPONENT_ADDED ? "COMPONENT_ADDED"
|
||||
* : "COMPONENT_REMOVED") + ",child=" + getChild().getName()</code>.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
// Unlike Sun, we don't throw NullPointerException if child is illegally
|
||||
// null.
|
||||
return (id == COMPONENT_ADDED ? "COMPONENT_ADDED,child="
|
||||
: id == COMPONENT_REMOVED ? "COMPONENT_REMOVED,child="
|
||||
: "unknown type,child=") + (child == null ? "" : child.getName());
|
||||
}
|
||||
} // class ContainerEvent
|
|
@ -1,70 +0,0 @@
|
|||
/* ContainerListener.java -- listen for container events
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to listen for all events from
|
||||
* container objects. This is normally not necessary since the AWT system
|
||||
* listens for and processes these events. To watch a subset of these events,
|
||||
* use a ContainerAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ContainerAdapter
|
||||
* @see ContainerEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface ContainerListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when a component is added to the container.
|
||||
*
|
||||
* @param event the <code>ContainerEvent</code> indicating component addition
|
||||
*/
|
||||
void componentAdded(ContainerEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when a component is removed from the container.
|
||||
*
|
||||
* @param event the <code>ContainerEvent</code> indicating component removal
|
||||
*/
|
||||
void componentRemoved(ContainerEvent event);
|
||||
} // interface ContainerListener
|
|
@ -1,79 +0,0 @@
|
|||
/* FocusAdapter.java -- convenience class for writing focus listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>FocusListener</code> and implements all
|
||||
* methods with empty bodies. This allows a listener interested in
|
||||
* implementing only a subset of the <code>FocusListener</code> interface to
|
||||
* extend this class and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see FocusEvent
|
||||
* @see FocusListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class FocusAdapter implements FocusListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public FocusAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void focusGained(FocusEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void focusLost(FocusEvent event)
|
||||
{
|
||||
}
|
||||
} // class FocusAdapter
|
|
@ -1,181 +0,0 @@
|
|||
/* FocusEvent.java -- generated for a focus change
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* This class represents an event generated when a focus change occurs for a
|
||||
* component. There are both temporary changes, such as when focus is stolen
|
||||
* during a sroll then returned, and permanent changes, such as when the user
|
||||
* TABs through focusable components.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see FocusAdapter
|
||||
* @see FocusListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class FocusEvent extends ComponentEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 523753786457416396L;
|
||||
|
||||
/** This is the first id in the range of ids used by this class. */
|
||||
public static final int FOCUS_FIRST = 1004;
|
||||
|
||||
/** This is the last id in the range of ids used by this class. */
|
||||
public static final int FOCUS_LAST = 1005;
|
||||
|
||||
/** This is the event id for a focus gained event. */
|
||||
public static final int FOCUS_GAINED = 1004;
|
||||
|
||||
/** This is the event id for a focus lost event. */
|
||||
public static final int FOCUS_LOST = 1005;
|
||||
|
||||
/**
|
||||
* Indicates whether or not the focus change is temporary.
|
||||
*
|
||||
* @see #isTemporary()
|
||||
* @serial true if the focus change is temporary
|
||||
*/
|
||||
private final boolean temporary;
|
||||
|
||||
/**
|
||||
* The other component which is giving up or stealing focus from this
|
||||
* component, if known.
|
||||
*
|
||||
* @see #getOppositeComponent()
|
||||
* @serial the component with the opposite focus event, or null
|
||||
* @since 1.4
|
||||
*/
|
||||
private final Component opposite;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>FocusEvent</code> with the
|
||||
* specified source, id, temporary status, and opposite counterpart. Note
|
||||
* that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the component that is gaining or losing focus
|
||||
* @param id the event id
|
||||
* @param temporary true if the focus change is temporary
|
||||
* @param opposite the component receiving the opposite focus event, or null
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public FocusEvent(Component source, int id, boolean temporary,
|
||||
Component opposite)
|
||||
{
|
||||
super(source, id);
|
||||
this.temporary = temporary;
|
||||
this.opposite = opposite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>FocusEvent</code> with the
|
||||
* specified source, id, and temporary status. Note that an invalid id
|
||||
* leads to unspecified results.
|
||||
*
|
||||
* @param source the component that is gaining or losing focus
|
||||
* @param id the event id
|
||||
* @param temporary true if the focus change is temporary
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public FocusEvent(Component source, int id, boolean temporary)
|
||||
{
|
||||
this(source, id, temporary, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>FocusEvent</code> with the
|
||||
* specified source and id. Note that an invalid id leads to unspecified
|
||||
* results.
|
||||
*
|
||||
* @param source the component that is gaining or losing focus
|
||||
* @param id the event id
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public FocusEvent(Component source, int id)
|
||||
{
|
||||
this(source, id, false, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the focus change is temporary or
|
||||
* permanent.
|
||||
*
|
||||
* @return true if the focus change is temporary
|
||||
*/
|
||||
public boolean isTemporary()
|
||||
{
|
||||
return temporary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the component which received the opposite focus event. If this
|
||||
* component gained focus, the opposite lost focus; likewise if this
|
||||
* component is giving up focus, the opposite is gaining it. If this
|
||||
* information is unknown, perhaps because the opposite is a native
|
||||
* application, this returns null.
|
||||
*
|
||||
* @return the component with the focus opposite, or null
|
||||
* @since 1.4
|
||||
*/
|
||||
public Component getOppositeComponent()
|
||||
{
|
||||
return opposite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string identifying this event. This is formatted as:
|
||||
* <code>(getID() == FOCUS_GAINED ? "FOCUS_GAINED" : "FOCUS_LOST")
|
||||
* + (isTemporary() ? ",temporary," : ",permanent,") + "opposite="
|
||||
* + getOppositeComponent()</code>.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return (id == FOCUS_GAINED ? "FOCUS_GAINED"
|
||||
: id == FOCUS_LOST ? "FOCUS_LOST" : "unknown type")
|
||||
+ (temporary ? ",temporary,opposite=" : ",permanent,opposite=")
|
||||
+ opposite;
|
||||
}
|
||||
} // class FocusEvent
|
|
@ -1,69 +0,0 @@
|
|||
/* FocusListener.java -- listen for focus changes
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to be notified of changes of
|
||||
* keyboard focus for a component. To watch a subset of these events, use a
|
||||
* FocusAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see FocusAdapter
|
||||
* @see FocusEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface FocusListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when a component gains the keyboard focus.
|
||||
*
|
||||
* @param event the <code>FocusEvent</code> indicating that focus was gained
|
||||
*/
|
||||
void focusGained(FocusEvent event);
|
||||
|
||||
/**
|
||||
* This method is invoked when a component loses the keyboard focus.
|
||||
*
|
||||
* @param event the <code>FocusEvent</code> indicating that focus was lost
|
||||
*/
|
||||
void focusLost(FocusEvent event);
|
||||
} // interface FocusListener
|
|
@ -1,78 +0,0 @@
|
|||
/* HierarchyBoundsAdapter.java -- convenience class for writing listeners
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>HierarchyBoundsListener</code> and implements
|
||||
* all methods with empty bodies. This allows a listener interested in
|
||||
* implementing only a subset of the <code>HierarchyBoundsListener</code>
|
||||
* interface to extend this class and override only the desired methods.
|
||||
*
|
||||
* @author Bryce McKinlay
|
||||
* @see HierarchyBoundsListener
|
||||
* @see HierarchyEvent
|
||||
* @since 1.3
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public HierarchyBoundsAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void ancestorMoved(HierarchyEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void ancestorResized(HierarchyEvent event)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
/* HierarchyBoundsListener.java -- listens to bounds changes of parents
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This listens for changes in an ancestors size or location. Normally it is
|
||||
* not necessary to process these events since the AWT handles them
|
||||
* internally, taking all appropriate actions. To watch a subset of these
|
||||
* events, use a HierarchyBoundsAdapter.
|
||||
*
|
||||
* @author Bryce McKinlay
|
||||
* @see HierarchyBoundsAdapter
|
||||
* @see HierarchyEvent
|
||||
* @since 1.3
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface HierarchyBoundsListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called when an ancestor component of the source is moved.
|
||||
*
|
||||
* @param e the event describing the ancestor's motion
|
||||
*/
|
||||
void ancestorMoved(HierarchyEvent e);
|
||||
|
||||
/**
|
||||
* Called when an ancestor component is resized.
|
||||
*
|
||||
* @param e the event describing the ancestor's resizing
|
||||
*/
|
||||
void ancestorResized(HierarchyEvent e);
|
||||
} // interface HierarchyBoundsListener
|
|
@ -1,253 +0,0 @@
|
|||
/* HierarchyEvent.java -- generated for a change in hierarchy
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
|
||||
/**
|
||||
* This class represents an event generated for an ancestor component which
|
||||
* may affect this component. These events normally do not need to be handled
|
||||
* by the application, since the AWT system automatically takes care of them.
|
||||
*
|
||||
* <p>There are two types of hierarchy events. The first type is handled by
|
||||
* HierarchyListener, and includes addition or removal of an ancestor, or
|
||||
* an ancestor changing its on-screen status (visible and/or displayble). The
|
||||
* second type is handled by HierarchyBoundsListener, and includes resizing
|
||||
* or moving of an ancestor.
|
||||
*
|
||||
* @author Bryce McKinlay
|
||||
* @see HierarchyListener
|
||||
* @see HierarchyBoundsAdapter
|
||||
* @see HierarchyBoundsListener
|
||||
* @since 1.3
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class HierarchyEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.3+.
|
||||
*/
|
||||
private static final long serialVersionUID = -5337576970038043990L;
|
||||
|
||||
/** This is the first id in the range of ids used by this class. */
|
||||
public static final int HIERARCHY_FIRST = 1400;
|
||||
|
||||
/** This id indicates that the hierarchy tree changed. */
|
||||
public static final int HIERARCHY_CHANGED = 1400;
|
||||
|
||||
/** This id indicates that an ancestor was moved. */
|
||||
public static final int ANCESTOR_MOVED = 1401;
|
||||
|
||||
/** This id indicates that an ancestor was resized. */
|
||||
public static final int ANCESTOR_RESIZED = 1402;
|
||||
|
||||
/** This is the last id in the range of ids used by this class. */
|
||||
public static final int HIERARCHY_LAST = 1402;
|
||||
|
||||
/** This indicates that the HIERARCHY_CHANGED is a changed parent. */
|
||||
public static final int PARENT_CHANGED = 1;
|
||||
|
||||
/**
|
||||
* This indicates that the HIERARCHY_CHANGED is caused by a change in
|
||||
* displayability.
|
||||
*
|
||||
* @see Component#isDisplayable()
|
||||
* @see Component#addNotify()
|
||||
* @see Component#removeNotify()
|
||||
*/
|
||||
public static final int DISPLAYABILITY_CHANGED = 2;
|
||||
|
||||
/**
|
||||
* This indicates that the HIERARCHY_CHANGED is a changed visibility.
|
||||
*
|
||||
* @see Component#isShowing()
|
||||
* @see Component#addNotify()
|
||||
* @see Component#removeNotify()
|
||||
* @see Component#show()
|
||||
* @see Component#hide()
|
||||
*/
|
||||
public static final int SHOWING_CHANGED = 4;
|
||||
|
||||
/**
|
||||
* The component at the top of the changed hierarchy.
|
||||
*
|
||||
* @serial the top component changed
|
||||
*/
|
||||
private final Component changed;
|
||||
|
||||
/**
|
||||
* The parent of this component, either before or after the change depending
|
||||
* on the type of change.
|
||||
*
|
||||
* @serial the parent component changed
|
||||
*/
|
||||
private final Container changedParent;
|
||||
|
||||
/**
|
||||
* The bitmask of HIERARCHY_CHANGED event types.
|
||||
*
|
||||
* @serial the change flags
|
||||
*/
|
||||
private final long changeFlags;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>HierarchyEvent</code> with the
|
||||
* specified parameters. Note that an invalid id leads to unspecified
|
||||
* results.
|
||||
*
|
||||
* @param source the component whose hierarchy changed
|
||||
* @param id the event id
|
||||
* @param changed the top component in the tree of changed hierarchy
|
||||
* @param changedParent the updated parent of this object
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public HierarchyEvent(Component source, int id, Component changed,
|
||||
Container changedParent)
|
||||
{
|
||||
this(source, id, changed, changedParent, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>HierarchyEvent</code> with the
|
||||
* specified parameters. Note that an invalid id leads to unspecified
|
||||
* results.
|
||||
*
|
||||
* @param source the component whose hierarchy changed
|
||||
* @param id the event id
|
||||
* @param changed the top component in the tree of changed hierarchy
|
||||
* @param changedParent the updated parent of this object
|
||||
* @param changeFlags the bitmask of specific HIERARCHY_CHANGED events
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public HierarchyEvent(Component source, int id, Component changed,
|
||||
Container changedParent, long changeFlags)
|
||||
{
|
||||
super(source, id);
|
||||
this.changed = changed;
|
||||
this.changedParent = changedParent;
|
||||
this.changeFlags = changeFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the event source as a <code>Component</code>. If the
|
||||
* source has subsequently been modified to a non-Component, this returns
|
||||
* null.
|
||||
*
|
||||
* @return the event source as a <code>Component</code>, or null
|
||||
*/
|
||||
public Component getComponent()
|
||||
{
|
||||
return source instanceof Component ? (Component) source : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the component at the top of the hierarchy which changed.
|
||||
*
|
||||
* @return the top changed component
|
||||
*/
|
||||
public Component getChanged()
|
||||
{
|
||||
return changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent of the component listed in <code>getChanged()</code>.
|
||||
* If the cause of this event was <code>Container.add</code>, this is the
|
||||
* new parent; if the cause was <code>Container.remove</code>, this is the
|
||||
* old parent; otherwise it is the unchanged parent.
|
||||
*
|
||||
* @return the parent container of the changed component
|
||||
*/
|
||||
public Container getChangedParent()
|
||||
{
|
||||
return changedParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is a HIERARCHY_CHANGED event, this returns a bitmask of the
|
||||
* types of changes that took place.
|
||||
*
|
||||
* @return the bitwise or of hierarchy change types, or 0
|
||||
* @see #PARENT_CHANGED
|
||||
* @see #DISPLAYABILITY_CHANGED
|
||||
* @see #SHOWING_CHANGED
|
||||
*/
|
||||
public long getChangeFlags()
|
||||
{
|
||||
return changeFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string identifying this event. This is the field
|
||||
* name of the id type, followed by a parenthesized listing of the changed
|
||||
* component and its parent container. In addition, if the type is
|
||||
* HIERARCHY_CHANGED, the flags preceed the changed component, in the
|
||||
* order PARENT_CHANGED, DISPLAYABILITY_CHANGED, and SHOWING_CHANGED.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
StringBuffer r = new StringBuffer();
|
||||
switch (id)
|
||||
{
|
||||
case HIERARCHY_CHANGED:
|
||||
r.append("HIERARCHY_CHANGED (");
|
||||
if ((changeFlags & PARENT_CHANGED) != 0)
|
||||
r.append("PARENT_CHANGED,");
|
||||
if ((changeFlags & DISPLAYABILITY_CHANGED) != 0)
|
||||
r.append("DISPLAYABILITY_CHANGED,");
|
||||
if ((changeFlags & SHOWING_CHANGED) != 0)
|
||||
r.append("SHOWING_CHANGED,");
|
||||
break;
|
||||
case ANCESTOR_MOVED:
|
||||
r.append("ANCESTOR_MOVED (");
|
||||
break;
|
||||
case ANCESTOR_RESIZED:
|
||||
r.append("ANCESTOR_RESIZED (");
|
||||
break;
|
||||
default:
|
||||
return "unknown type";
|
||||
}
|
||||
r.append(changed).append(',').append(changedParent).append(')');
|
||||
return r.toString();
|
||||
}
|
||||
} // class HierarchyEvent
|
|
@ -1,62 +0,0 @@
|
|||
/* HierarchyListener.java -- listens to changes in the component hierarchy
|
||||
Copyright (C) 2000, 2002 Free Software Foundation
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This listens for changes in the hierarchy tree of components. Normally it is
|
||||
* not necessary to process these events since the AWT handles them
|
||||
* internally, taking all appropriate actions.
|
||||
*
|
||||
* @author Bryce McKinlay
|
||||
* @see HierarchyEvent
|
||||
* @since 1.3
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface HierarchyListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* Called when the hierarchy of this component changes. Use
|
||||
* <code>getChangeFlags()</code> on the event to see what exactly changed.
|
||||
*
|
||||
* @param e the event describing the change
|
||||
*/
|
||||
void hierarchyChanged(HierarchyEvent e);
|
||||
} // interface HierarchyListener
|
|
@ -1,381 +0,0 @@
|
|||
/* InputEvent.java -- common superclass of component input events
|
||||
Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import gnu.java.awt.EventModifier;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* This is the common superclass for all component input classes. These are
|
||||
* passed to listeners before the component, so that listeners can consume
|
||||
* the event before it does its default behavior.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see KeyEvent
|
||||
* @see KeyAdapter
|
||||
* @see MouseEvent
|
||||
* @see MouseAdapter
|
||||
* @see MouseMotionAdapter
|
||||
* @see MouseWheelEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class InputEvent extends ComponentEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -2482525981698309786L;
|
||||
|
||||
/**
|
||||
* This is the bit mask which indicates the shift key is down. It is
|
||||
* recommended that SHIFT_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #SHIFT_DOWN_MASK
|
||||
*/
|
||||
public static final int SHIFT_MASK = 1;
|
||||
|
||||
/**
|
||||
* This is the bit mask which indicates the control key is down. It is
|
||||
* recommended that CTRL_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #CTRL_DOWN_MASK
|
||||
*/
|
||||
public static final int CTRL_MASK = 2;
|
||||
|
||||
/**
|
||||
* This is the bit mask which indicates the meta key is down. It is
|
||||
* recommended that META_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #META_DOWN_MASK
|
||||
*/
|
||||
public static final int META_MASK = 4;
|
||||
|
||||
/**
|
||||
* This is the bit mask which indicates the alt key is down. It is
|
||||
* recommended that ALT_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #ALT_DOWN_MASK
|
||||
*/
|
||||
public static final int ALT_MASK = 8;
|
||||
|
||||
/**
|
||||
* This is the bit mask which indicates the alt-graph modifier is in effect.
|
||||
* It is recommended that ALT_GRAPH_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #ALT_GRAPH_DOWN_MASK
|
||||
*/
|
||||
public static final int ALT_GRAPH_MASK = 0x20;
|
||||
|
||||
/**
|
||||
* This bit mask indicates mouse button one is down. It is recommended that
|
||||
* BUTTON1_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #BUTTON1_DOWN_MASK
|
||||
*/
|
||||
public static final int BUTTON1_MASK = 0x10;
|
||||
|
||||
/**
|
||||
* This bit mask indicates mouse button two is down. It is recommended that
|
||||
* BUTTON2_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #BUTTON2_DOWN_MASK
|
||||
*/
|
||||
public static final int BUTTON2_MASK = 8;
|
||||
|
||||
/**
|
||||
* This bit mask indicates mouse button three is down. It is recommended
|
||||
* that BUTTON3_DOWN_MASK be used instead.
|
||||
*
|
||||
* @see #BUTTON3_DOWN_MASK
|
||||
*/
|
||||
public static final int BUTTON3_MASK = 4;
|
||||
|
||||
/**
|
||||
* The SHIFT key extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int SHIFT_DOWN_MASK = 0x0040;
|
||||
|
||||
/**
|
||||
* The CTRL key extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int CTRL_DOWN_MASK = 0x0080;
|
||||
|
||||
/**
|
||||
* The META key extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int META_DOWN_MASK = 0x0100;
|
||||
|
||||
/**
|
||||
* The ALT key extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int ALT_DOWN_MASK = 0x0200;
|
||||
|
||||
/**
|
||||
* The mouse button1 key extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int BUTTON1_DOWN_MASK = 0x0400;
|
||||
|
||||
/**
|
||||
* The mouse button2 extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int BUTTON2_DOWN_MASK = 0x0800;
|
||||
|
||||
/**
|
||||
* The mouse button3 extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int BUTTON3_DOWN_MASK = 0x1000;
|
||||
|
||||
/**
|
||||
* The ALT_GRAPH key extended modifier.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int ALT_GRAPH_DOWN_MASK = 0x2000;
|
||||
|
||||
/** The mask to convert new to old, package visible for use in subclasses. */
|
||||
static final int CONVERT_MASK
|
||||
= EventModifier.NEW_MASK & ~(BUTTON2_DOWN_MASK | BUTTON3_DOWN_MASK);
|
||||
|
||||
/**
|
||||
* The timestamp when this event occurred.
|
||||
*
|
||||
* @see #getWhen()
|
||||
* @serial the timestamp
|
||||
*/
|
||||
private final long when;
|
||||
|
||||
/**
|
||||
* The modifiers in effect for this event. Package visible for use by
|
||||
* subclasses. The old style (bitmask 0x3f) should not be mixed with the
|
||||
* new style (bitmasks 0xffffffc0).
|
||||
*
|
||||
* @see #getModifiers()
|
||||
* @see MouseEvent
|
||||
* @serial the modifier state, stored in the new style
|
||||
*/
|
||||
int modifiers;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InputEvent</code> with the specified
|
||||
* source, id, timestamp, and modifiers. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param when the timestamp when the event occurred
|
||||
* @param modifiers the modifiers in effect for this event, old or new style
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
InputEvent(Component source, int id, long when, int modifiers)
|
||||
{
|
||||
super(source, id);
|
||||
this.when = when;
|
||||
this.modifiers = EventModifier.extend(modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the shift key was down during the event.
|
||||
*
|
||||
* @return true if the shift key is down
|
||||
*/
|
||||
public boolean isShiftDown()
|
||||
{
|
||||
return (modifiers & SHIFT_DOWN_MASK) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the control key was down during the
|
||||
* event.
|
||||
*
|
||||
* @return true if the control key is down
|
||||
*/
|
||||
public boolean isControlDown()
|
||||
{
|
||||
return (modifiers & CTRL_DOWN_MASK) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the meta key was down during the event.
|
||||
*
|
||||
* @return true if the meta key is down
|
||||
*/
|
||||
public boolean isMetaDown()
|
||||
{
|
||||
return (modifiers & META_DOWN_MASK) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the alt key was down during the event.
|
||||
*
|
||||
* @return true if the alt key is down
|
||||
*/
|
||||
public boolean isAltDown()
|
||||
{
|
||||
return (modifiers & ALT_DOWN_MASK) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the alt-graph modifier was in effect
|
||||
* during the event.
|
||||
*
|
||||
* @return true if the alt-graph modifier is down
|
||||
*/
|
||||
public boolean isAltGraphDown()
|
||||
{
|
||||
return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the timestamp when this event occurred.
|
||||
*
|
||||
* @return the timestamp when this event occurred
|
||||
*/
|
||||
public long getWhen()
|
||||
{
|
||||
return when;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the old-style modifiers in effect for this event.
|
||||
* Note that this is ambiguous between button2 and alt, and between
|
||||
* button3 and meta. Also, code which generated these modifiers tends to
|
||||
* only list the modifier that just changed, even if others were down at
|
||||
* the time. Consider using getModifiersEx instead. This will be a union
|
||||
* of the bit masks defined in this class that are applicable to the event.
|
||||
*
|
||||
* @return the modifiers in effect for this event
|
||||
* @see #getModifiersEx()
|
||||
*/
|
||||
public int getModifiers()
|
||||
{
|
||||
return EventModifier.revert(modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extended modifiers (new-style) for this event. This represents
|
||||
* the state of all modal keys and mouse buttons at the time of the event,
|
||||
* and does not suffer from the problems mentioned in getModifiers.
|
||||
*
|
||||
* <p>For an example of checking multiple modifiers, this code will return
|
||||
* true only if SHIFT and BUTTON1 were pressed and CTRL was not:
|
||||
* <pre>
|
||||
* int onmask = InputEvent.SHIFT_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK;
|
||||
* int offmask = InputEvent.CTRL_DOWN_MASK;
|
||||
* return (event.getModifiersEx() & (onmask | offmask)) == onmask;
|
||||
* </pre>
|
||||
*
|
||||
* @return the bitwise or of all modifiers pressed during the event
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getModifiersEx()
|
||||
{
|
||||
return modifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Consumes this event. A consumed event is not processed further by the AWT
|
||||
* system.
|
||||
*/
|
||||
public void consume()
|
||||
{
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not this event has been consumed.
|
||||
*
|
||||
* @return true if this event has been consumed
|
||||
*/
|
||||
public boolean isConsumed()
|
||||
{
|
||||
return consumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the extended modifier bitmask into a String, such as "Shift" or
|
||||
* "Ctrl+Button1".
|
||||
*
|
||||
* XXX Sun claims this can be localized via the awt.properties file - how
|
||||
* do we implement that?
|
||||
*
|
||||
* @param modifiers the modifiers
|
||||
* @return a string representation of the modifiers in this bitmask
|
||||
* @since 1.4
|
||||
*/
|
||||
public static String getModifiersExText(int modifiers)
|
||||
{
|
||||
modifiers &= EventModifier.NEW_MASK;
|
||||
if (modifiers == 0)
|
||||
return "";
|
||||
StringBuffer s = new StringBuffer();
|
||||
if ((modifiers & META_DOWN_MASK) != 0)
|
||||
s.append("Meta+");
|
||||
if ((modifiers & CTRL_DOWN_MASK) != 0)
|
||||
s.append("Ctrl+");
|
||||
if ((modifiers & ALT_DOWN_MASK) != 0)
|
||||
s.append("Alt+");
|
||||
if ((modifiers & SHIFT_DOWN_MASK) != 0)
|
||||
s.append("Shift+");
|
||||
if ((modifiers & ALT_GRAPH_DOWN_MASK) != 0)
|
||||
s.append("Alt Graph+");
|
||||
if ((modifiers & BUTTON1_DOWN_MASK) != 0)
|
||||
s.append("Button1+");
|
||||
if ((modifiers & BUTTON2_DOWN_MASK) != 0)
|
||||
s.append("Button2+");
|
||||
if ((modifiers & BUTTON3_DOWN_MASK) != 0)
|
||||
s.append("Button3+");
|
||||
return s.substring(0, s.length() - 1);
|
||||
}
|
||||
} // class InputEvent
|
|
@ -1,303 +0,0 @@
|
|||
/* InputMethodEvent.java -- events from a text input method
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.Component;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.font.TextHitInfo;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
|
||||
/**
|
||||
* This class is for event generated by change in a text input method.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see InputMethodListener
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class InputMethodEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 4727190874778922661L;
|
||||
|
||||
/** This is the first id in the range of event ids used by this class. */
|
||||
public static final int INPUT_METHOD_FIRST = 1100;
|
||||
|
||||
/** This event id indicates that the text in the input method has changed. */
|
||||
public static final int INPUT_METHOD_TEXT_CHANGED = 1100;
|
||||
|
||||
/** This event id indicates that the input method curor point has changed. */
|
||||
public static final int CARET_POSITION_CHANGED = 1101;
|
||||
|
||||
/** This is the last id in the range of event ids used by this class. */
|
||||
public static final int INPUT_METHOD_LAST = 1101;
|
||||
|
||||
/**
|
||||
* The timestamp when this event was created.
|
||||
*
|
||||
* @serial the timestamp
|
||||
* @since 1.4
|
||||
*/
|
||||
private long when;
|
||||
|
||||
/** The input method text. */
|
||||
private final transient AttributedCharacterIterator text;
|
||||
|
||||
/** The number of committed characters in the text. */
|
||||
private final transient int committedCharacterCount;
|
||||
|
||||
/** The caret. */
|
||||
private final transient TextHitInfo caret;
|
||||
|
||||
/** The most important position to be visible. */
|
||||
private final transient TextHitInfo visiblePosition;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InputMethodEvent</code> with the
|
||||
* specified source, id, timestamp, text, char count, caret, and visible
|
||||
* position.
|
||||
*
|
||||
* @param source the source that generated the event
|
||||
* @param id the event id
|
||||
* @param when the timestamp of the event
|
||||
* @param text the input text
|
||||
* @param committedCharacterCount the number of committed characters
|
||||
* @param caret the caret position
|
||||
* @param visiblePosition the position most important to make visible
|
||||
* @throws IllegalArgumentException if source is null, id is invalid, id is
|
||||
* CARET_POSITION_CHANGED and text is non-null, or if
|
||||
* committedCharacterCount is out of range
|
||||
* @since 1.4
|
||||
*/
|
||||
public InputMethodEvent(Component source, int id, long when,
|
||||
AttributedCharacterIterator text,
|
||||
int committedCharacterCount, TextHitInfo caret,
|
||||
TextHitInfo visiblePosition)
|
||||
{
|
||||
super(source, id);
|
||||
this.when = when;
|
||||
this.text = text;
|
||||
this.committedCharacterCount = committedCharacterCount;
|
||||
this.caret = caret;
|
||||
this.visiblePosition = visiblePosition;
|
||||
if (id < INPUT_METHOD_FIRST || id > INPUT_METHOD_LAST
|
||||
|| (id == CARET_POSITION_CHANGED && text != null)
|
||||
|| committedCharacterCount < 0
|
||||
|| (committedCharacterCount
|
||||
> (text == null ? 0 : text.getEndIndex() - text.getBeginIndex())))
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InputMethodEvent</code> with the
|
||||
* specified source, id, text, char count, caret, and visible position.
|
||||
*
|
||||
* @param source the source that generated the event
|
||||
* @param id the event id
|
||||
* @param text the input text
|
||||
* @param committedCharacterCount the number of committed characters
|
||||
* @param caret the caret position
|
||||
* @param visiblePosition the position most important to make visible
|
||||
* @throws IllegalArgumentException if source is null, id is invalid, id is
|
||||
* CARET_POSITION_CHANGED and text is non-null, or if
|
||||
* committedCharacterCount is out of range
|
||||
* @since 1.4
|
||||
*/
|
||||
public InputMethodEvent(Component source, int id,
|
||||
AttributedCharacterIterator text,
|
||||
int committedCharacterCount, TextHitInfo caret,
|
||||
TextHitInfo visiblePosition)
|
||||
{
|
||||
this(source, id, EventQueue.getMostRecentEventTime(), text,
|
||||
committedCharacterCount, caret, visiblePosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InputMethodEvent</code> with the
|
||||
* specified source, id, caret, and visible position, and with a null
|
||||
* text and char count.
|
||||
*
|
||||
* @param source the source that generated the event
|
||||
* @param id the event id
|
||||
* @param caret the caret position
|
||||
* @param visiblePosition the position most important to make visible
|
||||
* @throws IllegalArgumentException if source is null or id is invalid
|
||||
* @since 1.4
|
||||
*/
|
||||
public InputMethodEvent(Component source, int id, TextHitInfo caret,
|
||||
TextHitInfo visiblePosition)
|
||||
{
|
||||
this(source, id, EventQueue.getMostRecentEventTime(), null, 0, caret,
|
||||
visiblePosition);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the input method text. This can be <code>null</code>,
|
||||
* and will always be null for <code>CARET_POSITION_CHANGED</code> events.
|
||||
* Characters from 0 to <code>getCommittedCharacterCount()-1</code> have
|
||||
* been committed, the remaining characters are composed text.
|
||||
*
|
||||
* @return the input method text, or null
|
||||
*/
|
||||
public AttributedCharacterIterator getText()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of committed characters in the input method text.
|
||||
*
|
||||
* @return the number of committed characters in the input method text
|
||||
*/
|
||||
public int getCommittedCharacterCount()
|
||||
{
|
||||
return committedCharacterCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the caret position. The caret offset is relative to the composed
|
||||
* text of the most recent <code>INPUT_METHOD_TEXT_CHANGED</code> event.
|
||||
*
|
||||
* @return the caret position, or null
|
||||
*/
|
||||
public TextHitInfo getCaret()
|
||||
{
|
||||
return caret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the position that is most important to be visible, or null if
|
||||
* such a hint is not necessary. The caret offset is relative to the composed
|
||||
* text of the most recent <code>INPUT_METHOD_TEXT_CHANGED</code> event.
|
||||
*
|
||||
* @return the position that is most important to be visible
|
||||
*/
|
||||
public TextHitInfo getVisiblePosition()
|
||||
{
|
||||
return visiblePosition;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method consumes the event. A consumed event is not processed
|
||||
* in the default manner by the component that generated it.
|
||||
*/
|
||||
public void consume()
|
||||
{
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not this event has been consumed.
|
||||
*
|
||||
* @return true if the event has been consumed
|
||||
*/
|
||||
public boolean isConsumed()
|
||||
{
|
||||
return consumed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the timestamp of this event.
|
||||
*
|
||||
* @return the timestamp
|
||||
* @since 1.4
|
||||
*/
|
||||
public long getWhen()
|
||||
{
|
||||
return when;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string identifying the event. This contains the
|
||||
* event ID, the committed and composed characters separated by '+', the
|
||||
* number of committed characters, the caret, and the visible position.
|
||||
*
|
||||
* @return a string identifying the event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
StringBuffer s
|
||||
= new StringBuffer(80 + (text == null ? 0
|
||||
: text.getEndIndex() - text.getBeginIndex()));
|
||||
s.append(id == INPUT_METHOD_TEXT_CHANGED ? "INPUT_METHOD_TEXT_CHANGED, "
|
||||
: "CARET_POSITION_CHANGED, ");
|
||||
if (text == null)
|
||||
s.append("no text, 0 characters committed, caret: ");
|
||||
else
|
||||
{
|
||||
s.append('"');
|
||||
int i = text.getBeginIndex();
|
||||
int j = committedCharacterCount;
|
||||
while (--j >= 0)
|
||||
s.append(text.setIndex(i++));
|
||||
s.append("\" + \"");
|
||||
j = text.getEndIndex() - i;
|
||||
while (--j >= 0)
|
||||
s.append(text.setIndex(i++));
|
||||
s.append("\", ").append(committedCharacterCount)
|
||||
.append(" characters committed, caret: ");
|
||||
}
|
||||
s.append(caret == null ? (Object) "no caret" : caret).append(", ")
|
||||
.append(visiblePosition == null ? (Object) "no visible position"
|
||||
: visiblePosition);
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads in the object from a serial stream, updating when to
|
||||
* {@link EventQueue#getMostRecentEventTime()} if necessary.
|
||||
*
|
||||
* @param s the stream to read from
|
||||
* @throws IOException if deserialization fails
|
||||
* @throws ClassNotFoundException if deserialization fails
|
||||
* @serialData default, except for updating when
|
||||
*/
|
||||
private void readObject(ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
if (when == 0)
|
||||
when = EventQueue.getMostRecentEventTime();
|
||||
}
|
||||
} // class InputMethodEvent
|
|
@ -1,69 +0,0 @@
|
|||
/* InputMethodListener.java -- listen for input method events
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to receive events from an input
|
||||
* method. For a text component to use input methods, it must also install
|
||||
* an InputMethodRequests handler.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see InputMethodEvent
|
||||
* @see InputMethodRequests
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface InputMethodListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the text is changed.
|
||||
*
|
||||
* @param event the <code>InputMethodEvent</code> indicating the text change
|
||||
*/
|
||||
void inputMethodTextChanged(InputMethodEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the cursor position within the text is changed.
|
||||
*
|
||||
* @param event the <code>InputMethodEvent</code> indicating the change
|
||||
*/
|
||||
void caretPositionChanged(InputMethodEvent event);
|
||||
} // interface InputMethodListener
|
|
@ -1,237 +0,0 @@
|
|||
/* InvocationEvent.java -- call a runnable when dispatched
|
||||
Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.ActiveEvent;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
/**
|
||||
* This event executes {@link Runnable#run()} of a target object when it is
|
||||
* dispatched. This class is used by calls to <code>invokeLater</code> and
|
||||
* <code>invokeAndWait</code>, so client code can use this fact to avoid
|
||||
* writing special-casing AWTEventListener objects.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ActiveEvent
|
||||
* @see EventQueue#invokeLater(Runnable)
|
||||
* @see EventQueue#invokeAndWait(Runnable)
|
||||
* @see AWTEventListener
|
||||
* @since 1.2
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class InvocationEvent extends AWTEvent implements ActiveEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.2+.
|
||||
*/
|
||||
private static final long serialVersionUID = 436056344909459450L;
|
||||
|
||||
/** This is the first id in the range of event ids used by this class. */
|
||||
public static final int INVOCATION_FIRST = 1200;
|
||||
|
||||
/** This is the default id for this event type. */
|
||||
public static final int INVOCATION_DEFAULT = 1200;
|
||||
|
||||
/** This is the last id in the range of event ids used by this class. */
|
||||
public static final int INVOCATION_LAST = 1200;
|
||||
|
||||
/**
|
||||
* This is the <code>Runnable</code> object to call when dispatched.
|
||||
*
|
||||
* @serial the runnable to execute
|
||||
*/
|
||||
protected Runnable runnable;
|
||||
|
||||
/**
|
||||
* This is the object to call <code>notifyAll()</code> on when
|
||||
* the call to <code>run()</code> returns, or <code>null</code> if no
|
||||
* object is to be notified.
|
||||
*
|
||||
* @serial the object to notify
|
||||
*/
|
||||
protected Object notifier;
|
||||
|
||||
/**
|
||||
* This variable is set to <code>true</code> if exceptions are caught
|
||||
* and stored in a variable during the call to <code>run()</code>, otherwise
|
||||
* exceptions are ignored and propagate up.
|
||||
*
|
||||
* @serial true to catch exceptions
|
||||
*/
|
||||
protected boolean catchExceptions;
|
||||
|
||||
/**
|
||||
* This is the caught exception thrown in the <code>run()</code> method. It
|
||||
* is null if exceptions are ignored, the run method hasn't completed, or
|
||||
* there were no exceptions.
|
||||
*
|
||||
* @serial the caught exception, if any
|
||||
*/
|
||||
private Exception exception;
|
||||
|
||||
/**
|
||||
* The timestamp when this event was created.
|
||||
*
|
||||
* @see #getWhen()
|
||||
* @serial the timestamp
|
||||
* @since 1.4
|
||||
*/
|
||||
private final long when = EventQueue.getMostRecentEventTime();
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InvocationEvent</code> with the
|
||||
* specified source and runnable.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param runnable the <code>Runnable</code> object to invoke
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public InvocationEvent(Object source, Runnable runnable)
|
||||
{
|
||||
this(source, INVOCATION_DEFAULT, runnable, null, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InvocationEvent</code> with the
|
||||
* specified source, runnable, and notifier. It will also catch exceptions
|
||||
* if specified. If notifier is non-null, this will call notifyAll() on
|
||||
* the object when the runnable is complete. If catchExceptions is true,
|
||||
* this traps any exception in the runnable, otherwise it lets the exception
|
||||
* propagate up the Event Dispatch thread.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param runnable the <code>Runnable</code> object to invoke
|
||||
* @param notifier the object to notify, or null
|
||||
* @param catchExceptions true to catch exceptions from the runnable
|
||||
*/
|
||||
public InvocationEvent(Object source, Runnable runnable, Object notifier,
|
||||
boolean catchExceptions)
|
||||
{
|
||||
this(source, INVOCATION_DEFAULT, runnable, notifier, catchExceptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>InvocationEvent</code> with the
|
||||
* specified source, runnable, and notifier. It will also catch exceptions
|
||||
* if specified. If notifier is non-null, this will call notifyAll() on
|
||||
* the object when the runnable is complete. If catchExceptions is true,
|
||||
* this traps any exception in the runnable, otherwise it lets the exception
|
||||
* propagate up the Event Dispatch thread. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param runnable the <code>Runnable</code> object to invoke
|
||||
* @param notifier the object to notify, or null
|
||||
* @param catchExceptions true to catch exceptions from the runnable
|
||||
*/
|
||||
protected InvocationEvent(Object source, int id, Runnable runnable,
|
||||
Object notifier, boolean catchExceptions)
|
||||
{
|
||||
super(source, id);
|
||||
this.runnable = runnable;
|
||||
this.notifier = notifier;
|
||||
this.catchExceptions = catchExceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method calls the <code>run()</code> method of the runnable, traps
|
||||
* exceptions if instructed to do so, and calls <code>notifyAll()</code>
|
||||
* on any notifier if all worked successfully.
|
||||
*/
|
||||
public void dispatch()
|
||||
{
|
||||
if (catchExceptions)
|
||||
try
|
||||
{
|
||||
runnable.run();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e;
|
||||
}
|
||||
else
|
||||
runnable.run();
|
||||
|
||||
Object o = notifier;
|
||||
if (o != null)
|
||||
synchronized(o)
|
||||
{
|
||||
o.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the exception that occurred during the execution of
|
||||
* the runnable, or <code>null</code> if not exception was thrown or
|
||||
* exceptions were not caught.
|
||||
*
|
||||
* @return the exception thrown by the runnable
|
||||
*/
|
||||
public Exception getException()
|
||||
{
|
||||
return exception;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the timestamp of when this event was created.
|
||||
*
|
||||
* @return the timestamp of this event
|
||||
* @since 1.4
|
||||
*/
|
||||
public long getWhen()
|
||||
{
|
||||
return when;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a string identifying this event. This is formatted as:
|
||||
* <code>"INVOCATION_DEFAULT,runnable=" + runnable + ",notifier=" + notifier
|
||||
* + ",catchExceptions=" + catchExceptions + ",when=" + getWhen()</code>.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return (id == INVOCATION_DEFAULT ? "INVOCATION_DEFAULT,runnable="
|
||||
: "unknown type,runnable=") + runnable + ",notifier=" + notifier
|
||||
+ ",catchExceptions=" + catchExceptions + ",when=" + when;
|
||||
}
|
||||
} // class InvocationEvent
|
|
@ -1,155 +0,0 @@
|
|||
/* ItemEvent.java -- event for item state changes
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
import java.awt.ItemSelectable;
|
||||
|
||||
/**
|
||||
* This event is generated when a selection item changes state. This is an
|
||||
* abstraction that distills a large number of individual mouse or keyboard
|
||||
* events into a simpler "item selected" and "item deselected" events.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ItemSelectable
|
||||
* @see ItemListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class ItemEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -608708132447206933L;
|
||||
|
||||
/** This is the first id in the event id range used by this class. */
|
||||
public static final int ITEM_FIRST = 701;
|
||||
|
||||
/** This is the last id in the event id range used by this class. */
|
||||
public static final int ITEM_LAST = 701;
|
||||
|
||||
/** This event id indicates a state change occurred. */
|
||||
public static final int ITEM_STATE_CHANGED = 701;
|
||||
|
||||
/** This type indicates that the item was selected. */
|
||||
public static final int SELECTED = 1;
|
||||
|
||||
/** This type indicates that the item was deselected. */
|
||||
public static final int DESELECTED = 2;
|
||||
|
||||
/**
|
||||
* The item affected by this event.
|
||||
*
|
||||
* @serial the item of the selection
|
||||
*/
|
||||
private final Object item;
|
||||
|
||||
/**
|
||||
* The state change direction, one of {@link #SELECTED} or
|
||||
* {@link #DESELECTED}.
|
||||
*
|
||||
* @serial the selection state
|
||||
*/
|
||||
private final int stateChange;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>ItemEvent</code> with the specified
|
||||
* source, id, and state change constant. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param item the item affected by the state change
|
||||
* @param stateChange one of {@link #SELECTED} or {@link #DESELECTED}
|
||||
*/
|
||||
public ItemEvent(ItemSelectable source, int id, Object item, int stateChange)
|
||||
{
|
||||
super(source, id);
|
||||
this.item = item;
|
||||
this.stateChange = stateChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the event source as an <code>ItemSelectable</code>.
|
||||
*
|
||||
* @return the event source as an <code>ItemSelected</code>
|
||||
* @throws ClassCastException if source is changed to a non-ItemSelectable
|
||||
*/
|
||||
public ItemSelectable getItemSelectable()
|
||||
{
|
||||
return (ItemSelectable) source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the item affected by this state change.
|
||||
*
|
||||
* @return the item affected by this state change
|
||||
*/
|
||||
public Object getItem()
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of state change, either {@link #SELECTED} or
|
||||
* {@link #DESELECTED}.
|
||||
*
|
||||
* @return the type of state change
|
||||
*/
|
||||
public int getStateChange()
|
||||
{
|
||||
return stateChange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string identifying this event. This is in the format:
|
||||
* <code>"ITEM_STATE_CHANGED,item=" + item + ",stateChange="
|
||||
* + (getStateChange() == DESELECTED ? "DESELECTED" : "SELECTED")</code>.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return (id == ITEM_STATE_CHANGED ? "ITEM_STATE_CHANGED,item="
|
||||
: "unknown type,item=") + item + ",stateChange="
|
||||
+ (stateChange == SELECTED ? "SELECTED"
|
||||
: stateChange == DESELECTED ? "DESELECTED" : "unknown type");
|
||||
}
|
||||
} // class ItemEvent
|
|
@ -1,61 +0,0 @@
|
|||
/* ItemListener.java -- listen for item events
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to receive events when an
|
||||
* item's selection state changes.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ItemSelectable
|
||||
* @see ItemEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface ItemListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when an item's state is changed.
|
||||
*
|
||||
* @param event the <code>ItemEvent</code> indicating the change
|
||||
*/
|
||||
void itemStateChanged(ItemEvent event);
|
||||
} // interface ItemListener
|
|
@ -1,88 +0,0 @@
|
|||
/* KeyAdapter.java -- convenience class for writing key listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>KeyListener</code> and implements all methods
|
||||
* with empty bodies. This allows a listener interested in implementing only
|
||||
* a subset of the <code>KeyListener</code> interface to extend this class
|
||||
* and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see KeyEvent
|
||||
* @see KeyListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class KeyAdapter implements KeyListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public KeyAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void keyTyped(KeyEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void keyPressed(KeyEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void keyReleased(KeyEvent event)
|
||||
{
|
||||
}
|
||||
} // class KeyAdapter
|
File diff suppressed because it is too large
Load diff
|
@ -1,77 +0,0 @@
|
|||
/* KeyListener.java -- listen for keyboard presses
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to receive keyboard events. To
|
||||
* watch a subset of these events, use a KeyAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see KeyAdapter
|
||||
* @see KeyEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface KeyListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when a key is typed. A key is considered typed
|
||||
* when it and all modifiers have been pressed and released, mapping to
|
||||
* a single virtual key.
|
||||
*
|
||||
* @param event the <code>KeyEvent</code> indicating that a key was typed
|
||||
*/
|
||||
void keyTyped(KeyEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when a key is pressed.
|
||||
*
|
||||
* @param event the <code>KeyEvent</code> indicating the key press
|
||||
*/
|
||||
void keyPressed(KeyEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when a key is released.
|
||||
*
|
||||
* @param event the <code>KeyEvent</code> indicating the key release
|
||||
*/
|
||||
void keyReleased(KeyEvent event);
|
||||
} // interface KeyListener
|
|
@ -1,106 +0,0 @@
|
|||
/* MouseAdapter.java -- convenience class for writing mouse listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>MouseListener</code> and implements all methods
|
||||
* with empty bodies. This allows a listener interested in implementing only
|
||||
* a subset of the <code>MouseListener</code> interface to extend this class
|
||||
* and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see MouseEvent
|
||||
* @see MouseListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class MouseAdapter implements MouseListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public MouseAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mouseClicked(MouseEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mousePressed(MouseEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mouseReleased(MouseEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mouseEntered(MouseEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method in the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mouseExited(MouseEvent event)
|
||||
{
|
||||
}
|
||||
} // class MouseAdapter
|
|
@ -1,432 +0,0 @@
|
|||
/* MouseEvent.java -- a mouse event
|
||||
Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import gnu.java.awt.EventModifier;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
|
||||
/**
|
||||
* This event is generated for a mouse event. There are three main categories
|
||||
* of mouse events: Regular events include pressing, releasing, and clicking
|
||||
* buttons, as well as moving over the boundary of the unobscured portion of
|
||||
* a component. Motion events include movement and dragging. Wheel events are
|
||||
* covered separately by the subclass MouseWheelEvent.
|
||||
*
|
||||
* <p>A mouse event is tied to the unobstructed visible component that the
|
||||
* mouse cursor was over at the time of the action. The button that was
|
||||
* most recently pressed is the only one that shows up in
|
||||
* <code>getModifiers</code>, and is returned by <code>getButton</code>,
|
||||
* while all buttons that are down show up in <code>getModifiersEx</code>.
|
||||
*
|
||||
* <p>Drag events may be cut short if native drag-and-drop operations steal
|
||||
* the event. Likewise, if a mouse drag exceeds the bounds of a window or
|
||||
* virtual device, some platforms may clip the path to fit in the bounds of
|
||||
* the component.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @see MouseAdapter
|
||||
* @see MouseListener
|
||||
* @see MouseMotionAdapter
|
||||
* @see MouseMotionListener
|
||||
* @see MouseWheelListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class MouseEvent extends InputEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -991214153494842848L;
|
||||
|
||||
/** This is the first id in the range of event ids used by this class. */
|
||||
public static final int MOUSE_FIRST = 500;
|
||||
|
||||
/** This is the last id in the range of event ids used by this class. */
|
||||
public static final int MOUSE_LAST = 507;
|
||||
|
||||
/** This event id indicates that the mouse was clicked. */
|
||||
public static final int MOUSE_CLICKED = 500;
|
||||
|
||||
/** This event id indicates that the mouse was pressed. */
|
||||
public static final int MOUSE_PRESSED = 501;
|
||||
|
||||
/** This event id indicates that the mouse was released. */
|
||||
public static final int MOUSE_RELEASED = 502;
|
||||
|
||||
/** This event id indicates that the mouse was moved. */
|
||||
public static final int MOUSE_MOVED = 503;
|
||||
|
||||
/** This event id indicates that the mouse entered a component. */
|
||||
public static final int MOUSE_ENTERED = 504;
|
||||
|
||||
/** This event id indicates that the mouse exited a component. */
|
||||
public static final int MOUSE_EXITED = 505;
|
||||
|
||||
/**
|
||||
* This indicates that no button changed state.
|
||||
*
|
||||
* @see #getButton()
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int NOBUTTON = 0;
|
||||
|
||||
/**
|
||||
* This indicates that button 1 changed state.
|
||||
*
|
||||
* @see #getButton()
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int BUTTON1 = 1;
|
||||
|
||||
/**
|
||||
* This indicates that button 2 changed state.
|
||||
*
|
||||
* @see #getButton()
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int BUTTON2 = 2;
|
||||
|
||||
/**
|
||||
* This indicates that button 3 changed state.
|
||||
*
|
||||
* @see #getButton()
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int BUTTON3 = 3;
|
||||
|
||||
/** This event id indicates that the mouse was dragged over a component. */
|
||||
public static final int MOUSE_DRAGGED = 506;
|
||||
|
||||
/**
|
||||
* This event id indicates that the mouse wheel was rotated.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int MOUSE_WHEEL = 507;
|
||||
|
||||
/**
|
||||
* The X coordinate of the mouse cursor at the time of the event.
|
||||
*
|
||||
* @see #getX()
|
||||
* @serial the x coordinate
|
||||
*/
|
||||
private int x;
|
||||
|
||||
/**
|
||||
* The Y coordinate of the mouse cursor at the time of the event.
|
||||
*
|
||||
* @see #getY()
|
||||
* @serial the y coordinate
|
||||
*/
|
||||
private int y;
|
||||
|
||||
/**
|
||||
* The number of clicks that took place. For MOUSE_CLICKED, MOUSE_PRESSED,
|
||||
* and MOUSE_RELEASED, this will be at least 1; otherwise it is 0.
|
||||
*
|
||||
* see #getClickCount()
|
||||
* @serial the number of clicks
|
||||
*/
|
||||
private final int clickCount;
|
||||
|
||||
/**
|
||||
* Indicates which mouse button changed state. Can only be one of
|
||||
* {@link #NOBUTTON}, {@link #BUTTON1}, {@link #BUTTON2}, or
|
||||
* {@link #BUTTON3}.
|
||||
*
|
||||
* @see #getButton()
|
||||
* @since 1.4
|
||||
*/
|
||||
private int button;
|
||||
|
||||
/**
|
||||
* Whether or not this event should trigger a popup menu.
|
||||
*
|
||||
* @see PopupMenu
|
||||
* @see #isPopupTrigger()
|
||||
* @serial true if this is a popup trigger
|
||||
*/
|
||||
private final boolean popupTrigger;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>MouseEvent</code> with the specified
|
||||
* information. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param when the timestamp of when the event occurred
|
||||
* @param modifiers the modifier keys during the event, in old or new style
|
||||
* @param x the X coordinate of the mouse point
|
||||
* @param y the Y coordinate of the mouse point
|
||||
* @param clickCount the number of mouse clicks for this event
|
||||
* @param popupTrigger true if this event triggers a popup menu
|
||||
* @param button the most recent mouse button to change state
|
||||
* @throws IllegalArgumentException if source is null or button is invalid
|
||||
* @since 1.4
|
||||
*/
|
||||
public MouseEvent(Component source, int id, long when, int modifiers,
|
||||
int x, int y, int clickCount, boolean popupTrigger,
|
||||
int button)
|
||||
{
|
||||
super(source, id, when, modifiers);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.clickCount = clickCount;
|
||||
this.popupTrigger = popupTrigger;
|
||||
this.button = button;
|
||||
if (button < NOBUTTON || button > BUTTON3)
|
||||
throw new IllegalArgumentException();
|
||||
if ((modifiers & EventModifier.OLD_MASK) != 0)
|
||||
{
|
||||
if ((modifiers & BUTTON1_MASK) != 0)
|
||||
this.button = BUTTON1;
|
||||
else if ((modifiers & BUTTON2_MASK) != 0)
|
||||
this.button = BUTTON2;
|
||||
else if ((modifiers & BUTTON3_MASK) != 0)
|
||||
this.button = BUTTON3;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>MouseEvent</code> with the specified
|
||||
* information. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param when the timestamp of when the event occurred
|
||||
* @param modifiers the modifier keys during the event, in old or new style
|
||||
* @param x the X coordinate of the mouse point
|
||||
* @param y the Y coordinate of the mouse point
|
||||
* @param clickCount the number of mouse clicks for this event
|
||||
* @param popupTrigger true if this event triggers a popup menu
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public MouseEvent(Component source, int id, long when, int modifiers,
|
||||
int x, int y, int clickCount, boolean popupTrigger)
|
||||
{
|
||||
this(source, id, when, modifiers, x, y, clickCount, popupTrigger,
|
||||
NOBUTTON);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the X coordinate of the mouse position. This is
|
||||
* relative to the source component.
|
||||
*
|
||||
* @return the x coordinate
|
||||
*/
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the Y coordinate of the mouse position. This is
|
||||
* relative to the source component.
|
||||
*
|
||||
* @return the y coordinate
|
||||
*/
|
||||
public int getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a <code>Point</code> for the x,y position of
|
||||
* the mouse pointer. This is relative to the source component.
|
||||
*
|
||||
* @return a <code>Point</code> for the event position
|
||||
*/
|
||||
public Point getPoint()
|
||||
{
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates the event coordinates by the specified x and y offsets.
|
||||
*
|
||||
* @param dx the value to add to the X coordinate of this event
|
||||
* @param dy the value to add to the Y coordiante of this event
|
||||
*/
|
||||
public void translatePoint(int dx, int dy)
|
||||
{
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the number of mouse clicks associated with this
|
||||
* event.
|
||||
*
|
||||
* @return the number of mouse clicks for this event
|
||||
*/
|
||||
public int getClickCount()
|
||||
{
|
||||
return clickCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns which button, if any, was the most recent to change state. This
|
||||
* will be one of {@link #NOBUTTON}, {@link #BUTTON1}, {@link #BUTTON2}, or
|
||||
* {@link #BUTTON3}.
|
||||
*
|
||||
* @return the button that changed state
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getButton()
|
||||
{
|
||||
return button;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method tests whether or not the event is a popup menu trigger. This
|
||||
* should be checked in both MousePressed and MouseReleased to be
|
||||
* cross-platform compatible, as different systems have different popup
|
||||
* triggers.
|
||||
*
|
||||
* @return true if the event is a popup menu trigger
|
||||
*/
|
||||
public boolean isPopupTrigger()
|
||||
{
|
||||
return popupTrigger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing the modifiers, such as "Shift" or
|
||||
* "Ctrl+Button1".
|
||||
*
|
||||
* XXX Sun claims this can be localized via the awt.properties file - how
|
||||
* do we implement that?
|
||||
*
|
||||
* @param modifiers the old-style modifiers to convert to text
|
||||
* @return a string representation of the modifiers in this bitmask
|
||||
*/
|
||||
public static String getMouseModifiersText(int modifiers)
|
||||
{
|
||||
modifiers &= EventModifier.OLD_MASK;
|
||||
if ((modifiers & BUTTON2_MASK) != 0)
|
||||
modifiers |= BUTTON2_DOWN_MASK;
|
||||
if ((modifiers & BUTTON3_MASK) != 0)
|
||||
modifiers |= BUTTON3_DOWN_MASK;
|
||||
return getModifiersExText(EventModifier.extend(modifiers));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string identifying this event. This is formatted as the field
|
||||
* name of the id type, followed by the (x,y) point, the most recent button
|
||||
* changed, modifiers (if any), extModifiers (if any), and clickCount.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
StringBuffer s = new StringBuffer();
|
||||
switch (id)
|
||||
{
|
||||
case MOUSE_CLICKED:
|
||||
s.append("MOUSE_CLICKED,(");
|
||||
break;
|
||||
case MOUSE_PRESSED:
|
||||
s.append("MOUSE_PRESSED,(");
|
||||
break;
|
||||
case MOUSE_RELEASED:
|
||||
s.append("MOUSE_RELEASED,(");
|
||||
break;
|
||||
case MOUSE_MOVED:
|
||||
s.append("MOUSE_MOVED,(");
|
||||
break;
|
||||
case MOUSE_ENTERED:
|
||||
s.append("MOUSE_ENTERED,(");
|
||||
break;
|
||||
case MOUSE_EXITED:
|
||||
s.append("MOUSE_EXITED,(");
|
||||
break;
|
||||
case MOUSE_DRAGGED:
|
||||
s.append("MOUSE_DRAGGED,(");
|
||||
break;
|
||||
case MOUSE_WHEEL:
|
||||
s.append("MOUSE_WHEEL,(");
|
||||
break;
|
||||
default:
|
||||
s.append("unknown type,(");
|
||||
}
|
||||
s.append(x).append(',').append(y).append("),button=").append(button);
|
||||
if ((modifiers & EventModifier.NEW_MASK) != 0)
|
||||
{
|
||||
int mod = modifiers;
|
||||
if ((mod & (ALT_DOWN_MASK | BUTTON2_DOWN_MASK)) != 0)
|
||||
mod |= ALT_DOWN_MASK | BUTTON2_DOWN_MASK;
|
||||
if ((mod & (META_DOWN_MASK | BUTTON3_DOWN_MASK)) != 0)
|
||||
mod |= META_DOWN_MASK | BUTTON3_DOWN_MASK;
|
||||
s.append(",modifiers=").append(getModifiersExText(mod));
|
||||
}
|
||||
if (modifiers != 0)
|
||||
s.append(",extModifiers=").append(getModifiersExText(modifiers));
|
||||
return s.append(",clickCount=").append(clickCount).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads in the object from a serial stream.
|
||||
*
|
||||
* @param s the stream to read from
|
||||
* @throws IOException if deserialization fails
|
||||
* @throws ClassNotFoundException if deserialization fails
|
||||
* @serialData default, except that the modifiers are converted to new style
|
||||
*/
|
||||
private void readObject(ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
if ((modifiers & EventModifier.OLD_MASK) != 0)
|
||||
{
|
||||
if ((modifiers & BUTTON1_MASK) != 0)
|
||||
button = BUTTON1;
|
||||
else if ((modifiers & BUTTON2_MASK) != 0)
|
||||
button = BUTTON2;
|
||||
else if ((modifiers & BUTTON3_MASK) != 0)
|
||||
button = BUTTON3;
|
||||
modifiers = EventModifier.extend(modifiers);
|
||||
}
|
||||
}
|
||||
} // class MouseEvent
|
|
@ -1,94 +0,0 @@
|
|||
/* MouseListener.java -- listen for mouse clicks and crossing component edges
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to receive mouse events other than
|
||||
* simple motion events. This includes clicks (but not mouse wheel events),
|
||||
* and crossing component boundaries without change in button status. To
|
||||
* track moves and drags, use MouseMotionListener, and to track wheel events,
|
||||
* use MouseWheelListener. To watch a subset of these events, use a
|
||||
* MouseAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see MouseAdapter
|
||||
* @see MouseEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface MouseListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the mouse is clicked (pressed and released
|
||||
* in short succession) on a component.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> indicating the click
|
||||
*/
|
||||
void mouseClicked(MouseEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the mouse is pressed over a component.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> for the press
|
||||
*/
|
||||
void mousePressed(MouseEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the mouse is released over a component.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> for the release
|
||||
*/
|
||||
void mouseReleased(MouseEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the mouse enters a component.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> for the entry
|
||||
*/
|
||||
void mouseEntered(MouseEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the mouse exits a component.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> for the exit
|
||||
*/
|
||||
void mouseExited(MouseEvent event);
|
||||
} // interface MouseListener
|
|
@ -1,79 +0,0 @@
|
|||
/* MouseMotionAdapter.java -- convenience class for mouse motion listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>MouseMotionListener</code> and implements all
|
||||
* methods with empty bodies. This allows a listener interested in
|
||||
* implementing only a subset of the <code>MouseMotionListener</code>
|
||||
* interface to extend this class and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see MouseEvent
|
||||
* @see MouseMotionListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class MouseMotionAdapter implements MouseMotionListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public MouseMotionAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method in the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mouseDragged(MouseEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method in the interface with an empty body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void mouseMoved(MouseEvent event)
|
||||
{
|
||||
}
|
||||
} // class MouseMotionAdapter
|
|
@ -1,72 +0,0 @@
|
|||
/* MouseMotionListener.java -- listen to mouse motion events
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to be notified of mouse movements.
|
||||
* This includes moves and drags, but not crossing component boundaries. To
|
||||
* track other mouse events, use MouseListener or MouseWheelListener. To
|
||||
* watch a subset of these events, use a MouseMotionAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see MouseMotionAdapter
|
||||
* @see MouseEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface MouseMotionListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the mouse is moved over a component
|
||||
* while a button has been pressed.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> indicating the motion
|
||||
*/
|
||||
void mouseDragged(MouseEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the mouse is moved over a component
|
||||
* while no button is pressed.
|
||||
*
|
||||
* @param event the <code>MouseEvent</code> indicating the motion
|
||||
*/
|
||||
void mouseMoved(MouseEvent event);
|
||||
} // interface MouseMotionListener
|
|
@ -1,226 +0,0 @@
|
|||
/* MouseWheelEvent.java -- a mouse wheel event
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* This event is generated for a mouse wheel rotation. The wheel (the middle
|
||||
* mouse button on most modern mice) can be rotated towards or away from the
|
||||
* user, and is ofteh used for scrolling.
|
||||
*
|
||||
* <p>Because of the special use for scrolling components, MouseWheelEvents
|
||||
* often affect a different component than the one located at the point of
|
||||
* the event. If the component under the mouse cursor does not accept wheel
|
||||
* events, the event is passed to the first ancestor container which does. This
|
||||
* is often a ScrollPane, which knows how to scroll. If an AWT component is
|
||||
* built from a native widget that knows how to use mouse wheel events, that
|
||||
* component will consume the event.
|
||||
*
|
||||
* <p>The two most common scroll types are "units" (lines at a time) or
|
||||
* "blocks" (pages at a time). The initial setting is taken from the platform,
|
||||
* although the user can adjust the setting at any time.
|
||||
*
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @see MouseWheelListener
|
||||
* @see ScrollPane
|
||||
* @see ScrollPane#setWheelScrollingEnabled(boolean)
|
||||
* @see JScrollPane
|
||||
* @see JScrollPane#setWheelScrollingEnabled(boolean)
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class MouseWheelEvent extends MouseEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.4+.
|
||||
*/
|
||||
private static final long serialVersionUID = 6459879390515399677L;
|
||||
|
||||
/**
|
||||
* Indicates scrolling by units (lines).
|
||||
*
|
||||
* @see #getScrollType()
|
||||
*/
|
||||
public static final int WHEEL_UNIT_SCROLL = 0;
|
||||
|
||||
/**
|
||||
* Indicates scrolling by blocks (pages).
|
||||
*
|
||||
* @see #getScrollType()
|
||||
*/
|
||||
public static final int WHEEL_BLOCK_SCROLL = 1;
|
||||
|
||||
/**
|
||||
* Indicates what scroll type should take place. This should be limited
|
||||
* to {@link #WHEEL_UNIT_SCROLL} and {@link #WHEEL_BLOCK_SCROLL}.
|
||||
*
|
||||
* @serial the scroll type
|
||||
*/
|
||||
private final int scrollType;
|
||||
|
||||
/**
|
||||
* Indicates the scroll amount. This is only meaningful if scrollType is
|
||||
* WHEEL_UNIT_SCROLL.
|
||||
*
|
||||
* @serial the number of lines to scroll
|
||||
*/
|
||||
private final int scrollAmount;
|
||||
|
||||
/**
|
||||
* Indicates how far the mouse wheel was rotated.
|
||||
*
|
||||
* @serial the rotation amount
|
||||
*/
|
||||
private final int wheelRotation;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>MouseWheelEvent</code> with the
|
||||
* specified information. Note that an invalid id leads to unspecified
|
||||
* results.
|
||||
*
|
||||
* @param source the source of the event
|
||||
* @param id the event id
|
||||
* @param when the timestamp of when the event occurred
|
||||
* @param modifiers any modifier bits for this event
|
||||
* @param x the X coordinate of the mouse point
|
||||
* @param y the Y coordinate of the mouse point
|
||||
* @param clickCount the number of mouse clicks for this event
|
||||
* @param popupTrigger true if this event triggers a popup menu
|
||||
* @param scrollType one of {@link #WHEEL_UNIT_SCROLL},
|
||||
* {@link #WHEEL_BLOCK_SCROLL}
|
||||
* @param scrollAmount the number of units to scroll, ignored for block type
|
||||
* @param wheelRotation the number of rotation "clicks"
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @see MouseEvent#MouseEvent(Component, int, long, int, int, int, int,
|
||||
* boolean)
|
||||
*/
|
||||
public MouseWheelEvent(Component source, int id, long when, int modifiers,
|
||||
int x, int y, int clickCount, boolean popupTrigger,
|
||||
int scrollType, int scrollAmount, int wheelRotation)
|
||||
{
|
||||
super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
|
||||
this.scrollType = scrollType;
|
||||
this.scrollAmount = scrollAmount;
|
||||
this.wheelRotation = wheelRotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the scrolling pattern this event requests. Legal
|
||||
* values are WHEEL_UNIT_SCROLL and WHEEL_BLOCK_SCROLL.
|
||||
*
|
||||
* @return the scroll type
|
||||
* @see Adjustable#getUnitIncrement()
|
||||
* @see Adjustable#getBlockIncrement()
|
||||
* @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
|
||||
* @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int)
|
||||
*/
|
||||
public int getScrollType()
|
||||
{
|
||||
return scrollType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of units to scroll in response to this event. This
|
||||
* only makes sense when the scroll type is WHEEL_UNIT_SCROLL.
|
||||
*
|
||||
* @return the number of scroll units, if defined
|
||||
* @see #getScrollType()
|
||||
*/
|
||||
public int getScrollAmount()
|
||||
{
|
||||
return scrollAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of "clicks" the wheel was rotated. Negative values move
|
||||
* up (away) from the user, positive values move down (towards) the user.
|
||||
*
|
||||
* @return the number of rotation clicks
|
||||
*/
|
||||
public int getWheelRotation()
|
||||
{
|
||||
return wheelRotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a convenience method which aids in a common listener for scrolling
|
||||
* a scrollpane (although this is already built into ScrollPane and
|
||||
* JScrollPane). This method only makes sense when getScrollType() returns
|
||||
* WHEEL_UNIT_SCROLL.
|
||||
*
|
||||
* <p>This accounts for direction of scroll and amount of wheel movement, as
|
||||
* interpreted by the platform settings.
|
||||
*
|
||||
* @return the number of units to scroll
|
||||
* @see #getScrollType()
|
||||
* @see #getScrollAmount()
|
||||
* @see MouseWheelListener
|
||||
* @see Adjustable
|
||||
* @see Adjustable#getUnitIncrement()
|
||||
* @see Scrollable
|
||||
* @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
|
||||
* @see ScrollPane
|
||||
* @see ScrollPane#setWheelScrollingEnabled(boolean)
|
||||
* @see JScrollPane
|
||||
* @see JScrollPane#setWheelScrollingEnabled(boolean)
|
||||
*/
|
||||
public int getUnitsToScroll()
|
||||
{
|
||||
return wheelRotation * scrollAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string identifying this event. For mouse wheel events, this
|
||||
* is <code>super.paramString() + ",scrollType=WHEEL_" +
|
||||
* (getScrollType() == WHEEL_UNIT_SCROLL ? "UNIT" : "BLOCK")
|
||||
* + "_SCROLL,scrollAmount=" + getScrollAmount() + ",wheelRotation="
|
||||
* + getWheelRotation()</code>.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return super.paramString() + ",scrollType="
|
||||
+ (scrollType == WHEEL_UNIT_SCROLL ? "WHEEL_UNIT_SCROLL"
|
||||
: scrollType == WHEEL_BLOCK_SCROLL ? "WHEEL_BLOCK_SCROLL"
|
||||
: "unknown scroll type")
|
||||
+ ",scrollAmount=" + scrollAmount + ",wheelRotation=" + wheelRotation;
|
||||
}
|
||||
} // class MouseWheelEvent
|
|
@ -1,60 +0,0 @@
|
|||
/* MouseWheelListener.java -- listen for mouse wheel events
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to receive mouse wheel events. For
|
||||
* other events, use MouseListener or MouseMotionListener.
|
||||
*
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @see MouseWheelEvent
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface MouseWheelListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the mouse wheel is rotated.
|
||||
*
|
||||
* @param event the <code>MouseWheelEvent</code> indicating the rotation
|
||||
*/
|
||||
void mouseWheelMoved(MouseWheelEvent event);
|
||||
} // interface MouseWheelListener
|
|
@ -1,127 +0,0 @@
|
|||
/* PaintEvent.java -- an area of the screen needs to be repainted
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
/**
|
||||
* This event is generated when an area of the screen needs to be painted.
|
||||
* This event is not meant for users, but exists to allow proper serialization
|
||||
* behavior in the EventQueue with user-accessible events.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class PaintEvent extends ComponentEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 1267492026433337593L;
|
||||
|
||||
/** This is the first id in the range of event ids used by this class. */
|
||||
public static final int PAINT_FIRST = 800;
|
||||
|
||||
/** This is the last id in the range of event ids used by this class. */
|
||||
public static final int PAINT_LAST = 801;
|
||||
|
||||
/** This id is for paint event types. */
|
||||
public static final int PAINT = 800;
|
||||
|
||||
/** This id is for update event types. */
|
||||
public static final int UPDATE = 801;
|
||||
|
||||
/**
|
||||
* This is the rectange to be painted or updated.
|
||||
*
|
||||
* @see #getUpdateRect()
|
||||
* @see #setUpdateRect(Rectangle)
|
||||
* @serial the non-null rectangle to be painted
|
||||
*/
|
||||
private Rectangle updateRect;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>PaintEvent</code> with the specified
|
||||
* source, id, and update region. Note that an invalid id leads to
|
||||
* unspecified results.
|
||||
*
|
||||
* @param source the event source
|
||||
* @param id the event id
|
||||
* @param updateRect the rectangle to repaint
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public PaintEvent(Component source, int id, Rectangle updateRect)
|
||||
{
|
||||
super(source, id);
|
||||
this.updateRect = updateRect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rectange to be updated for this event.
|
||||
*
|
||||
* @return the rectangle to update
|
||||
*/
|
||||
public Rectangle getUpdateRect()
|
||||
{
|
||||
return updateRect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rectangle to be updated for this event.
|
||||
*
|
||||
* @param updateRect the new update rectangle for this event
|
||||
*/
|
||||
public void setUpdateRect(Rectangle updateRect)
|
||||
{
|
||||
this.updateRect = updateRect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string identifying this event.
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return (id == PAINT ? "PAINT,updateRect=" : id == UPDATE
|
||||
? "UPDATE,updateRect=" : "unknown type,updateRect=") + updateRect;
|
||||
}
|
||||
} // class PaintEvent
|
|
@ -1,92 +0,0 @@
|
|||
/* TextEvent.java -- event for text changes
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.AWTEvent;
|
||||
|
||||
/**
|
||||
* This event is generated when a text box changes contents. This is an
|
||||
* abstraction that distills a large number of individual mouse or keyboard
|
||||
* events into a simpler "text changed" event.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see TextComponent
|
||||
* @see TextListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class TextEvent extends AWTEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = 6269902291250941179L;
|
||||
|
||||
/** This is the first id in the range of event ids used by this class. */
|
||||
public static final int TEXT_FIRST = 900;
|
||||
|
||||
/** This is the last id in the range of event ids used by this class. */
|
||||
public static final int TEXT_LAST = 900;
|
||||
|
||||
/** This event id indicates that the text of an object has changed. */
|
||||
public static final int TEXT_VALUE_CHANGED = 900;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>TextEvent</code> with the specified
|
||||
* source and id. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the (TextComponent) object that generated this event
|
||||
* @param id the event id
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public TextEvent(Object source, int id)
|
||||
{
|
||||
super(source, id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string identifying this event. This is "TEXT_VALUE_CHANGED".
|
||||
*
|
||||
* @return a string identifying this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
return id == TEXT_VALUE_CHANGED ? "TEXT_VALUE_CHANGED" : "unknown type";
|
||||
}
|
||||
} // class TextEvent
|
|
@ -1,60 +0,0 @@
|
|||
/* TextListener.java -- listen for text changes
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to be notified when text changes
|
||||
* in a component.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see TextEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface TextListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the text being monitored changes.
|
||||
*
|
||||
* @param event the <code>TextEvent</code> indicating the change
|
||||
*/
|
||||
void textValueChanged(TextEvent event);
|
||||
} // interface TextListener
|
|
@ -1,156 +0,0 @@
|
|||
/* WindowAdapter.java -- convenience class for writing window listeners
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
/**
|
||||
* This class implements <code>WindowListener</code>,
|
||||
* <code>WindowStateListener</code>, and <code>WindowFocusListener</code>, and
|
||||
* implements all methods with empty bodies. This allows a listener
|
||||
* interested in listening to only a subset of any <code>WindowEvent</code>
|
||||
* actions to extend this class and override only the desired methods.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see ComponentEvent
|
||||
* @see ComponentListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public abstract class WindowAdapter
|
||||
implements WindowListener, WindowStateListener, WindowFocusListener
|
||||
{
|
||||
/**
|
||||
* Do nothing default constructor for subclasses.
|
||||
*/
|
||||
public WindowAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowOpened(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowClosing(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowClosed(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowIconified(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowDeiconified(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowActivated(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
*/
|
||||
public void windowDeactivated(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
* @since 1.4
|
||||
*/
|
||||
public void windowStateChanged(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
* @since 1.4
|
||||
*/
|
||||
public void windowGainedFocus(WindowEvent event)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements this method from the interface with an empty method body.
|
||||
*
|
||||
* @param event the event, ignored in this implementation
|
||||
* @since 1.4
|
||||
*/
|
||||
public void windowLostFocus(WindowEvent event)
|
||||
{
|
||||
}
|
||||
} // class WindowAdapter
|
|
@ -1,311 +0,0 @@
|
|||
/* WindowEvent.java -- window change event
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.awt.Window;
|
||||
|
||||
/**
|
||||
* This event is generated when there is a change in a window. This includes
|
||||
* creation, closing, iconification, activation, and focus changes. There
|
||||
* are three listeners, for three types of events: WindowListeners deal with
|
||||
* the lifecycle of a window, WindowStateListeners deal with window state
|
||||
* like maximization, and WindowFocusListeners deal with focus switching to
|
||||
* or from a window.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see WindowAdapter
|
||||
* @see WindowListener
|
||||
* @see WindowFocusListener
|
||||
* @see WindowStateListener
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public class WindowEvent extends ComponentEvent
|
||||
{
|
||||
/**
|
||||
* Compatible with JDK 1.1+.
|
||||
*/
|
||||
private static final long serialVersionUID = -1567959133147912127L;
|
||||
|
||||
/** This is the first id in the range of event ids used by this class. */
|
||||
public static final int WINDOW_FIRST = 200;
|
||||
|
||||
/** This is the id for a window that is opened. */
|
||||
public static final int WINDOW_OPENED = 200;
|
||||
|
||||
/** This is the id for a window that is about to close. */
|
||||
public static final int WINDOW_CLOSING = 201;
|
||||
|
||||
/** This is the id for a window that finished closing. */
|
||||
public static final int WINDOW_CLOSED = 202;
|
||||
|
||||
/** This is the id for a window that is iconified. */
|
||||
public static final int WINDOW_ICONIFIED = 203;
|
||||
|
||||
/** This is the id for a window that is de-iconified. */
|
||||
public static final int WINDOW_DEICONIFIED = 204;
|
||||
|
||||
/** This is the id for a window that is activated. */
|
||||
public static final int WINDOW_ACTIVATED = 205;
|
||||
|
||||
/** This is the id for a window that is de-activated. */
|
||||
public static final int WINDOW_DEACTIVATED = 206;
|
||||
|
||||
/**
|
||||
* This is the id for a window becoming the focused window.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int WINDOW_GAINED_FOCUS = 207;
|
||||
|
||||
/**
|
||||
* This is the id for a window losing all focus.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int WINDOW_LOST_FOCUS = 208;
|
||||
|
||||
/**
|
||||
* This is the id for a window state change, such as maximization.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public static final int WINDOW_STATE_CHANGED = 209;
|
||||
|
||||
/** This is the last id in the range of event ids used by this class. */
|
||||
public static final int WINDOW_LAST = 209;
|
||||
|
||||
/**
|
||||
* The other Window involved in a focus or activation change. For
|
||||
* WINDOW_ACTIVATED and WINDOW_GAINED_FOCUS events, this is the window that
|
||||
* lost focus; for WINDOW_DEACTIVATED and WINDOW_LOST_FOCUS, this is the
|
||||
* window that stole focus; and for other events (or when native
|
||||
* implementation does not have the data available), this is null.
|
||||
*
|
||||
* @see #getOppositeWindow()
|
||||
* @serial the opposite window, or null
|
||||
* @since 1.4
|
||||
*/
|
||||
private final Window opposite;
|
||||
|
||||
/**
|
||||
* The former state of the window.
|
||||
*
|
||||
* @serial bitmask of the old window state
|
||||
* @since 1.4
|
||||
*/
|
||||
private final int oldState;
|
||||
|
||||
/**
|
||||
* The present state of the window.
|
||||
*
|
||||
* @serial bitmask of the new window state
|
||||
* @since 1.4
|
||||
*/
|
||||
private final int newState;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>WindowEvent</code> with the specified
|
||||
* parameters. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the window that generated this event
|
||||
* @param id the event id
|
||||
* @param opposite the window that received the opposite event, or null
|
||||
* @param oldState the previous state of this window
|
||||
* @param newState the new state of this window
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public WindowEvent(Window source, int id, Window opposite,
|
||||
int oldState, int newState)
|
||||
{
|
||||
super(source, id);
|
||||
this.opposite = opposite;
|
||||
this.oldState = oldState;
|
||||
this.newState = newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>WindowEvent</code> with the specified
|
||||
* parameters. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the window that generated this event
|
||||
* @param id the event id
|
||||
* @param opposite the window that received the opposite event, or null
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public WindowEvent(Window source, int id, Window opposite)
|
||||
{
|
||||
this(source, id, opposite, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>WindowEvent</code> with the specified
|
||||
* parameters. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the window that generated this event
|
||||
* @param id the event id
|
||||
* @param oldState the previous state of this window
|
||||
* @param newState the new state of this window
|
||||
* @throws IllegalArgumentException if source is null
|
||||
* @since 1.4
|
||||
*/
|
||||
public WindowEvent(Window source, int id, int oldState, int newState)
|
||||
{
|
||||
this(source, id, null, oldState, newState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a new instance of <code>WindowEvent</code> with the specified
|
||||
* parameters. Note that an invalid id leads to unspecified results.
|
||||
*
|
||||
* @param source the window that generated this event
|
||||
* @param id the event id
|
||||
* @throws IllegalArgumentException if source is null
|
||||
*/
|
||||
public WindowEvent(Window source, int id)
|
||||
{
|
||||
this(source, id, null, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the event source as a <code>Window</code>. If the source has
|
||||
* subsequently been modified to a non-Window, this returns null.
|
||||
*
|
||||
* @return the event source as a <code>Window</code>
|
||||
*/
|
||||
public Window getWindow()
|
||||
{
|
||||
return source instanceof Window ? (Window) source : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the opposite window if this window was involved in an activation
|
||||
* or focus change. For WINDOW_ACTIVATED and WINDOW_GAINED_FOCUS events,
|
||||
* this is the window that lost focus; for WINDOW_DEACTIVATED and
|
||||
* WINDOW_LOST_FOCUS, this is the window that stole focus; and for other
|
||||
* events (or when native implementation does not have the data available),
|
||||
* this is null.
|
||||
*
|
||||
* @return the opposite window, or null
|
||||
* @since 1.4
|
||||
*/
|
||||
public Window getOppositeWindow()
|
||||
{
|
||||
return opposite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of this window before the event. This is the bitwise
|
||||
* or of fields in Frame: NORMAL, ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT,
|
||||
* and MAXIMIZED_BOTH.
|
||||
*
|
||||
* @return the former state
|
||||
* @see Frame#getExtendedState()
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getOldState()
|
||||
{
|
||||
return oldState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state of this window after the event. This is the bitwise
|
||||
* or of fields in Frame: NORMAL, ICONIFIED, MAXIMIZED_HORIZ, MAXIMIZED_VERT,
|
||||
* and MAXIMIZED_BOTH.
|
||||
*
|
||||
* @return the updated state
|
||||
* @see Frame#getExtendedState()
|
||||
* @since 1.4
|
||||
*/
|
||||
public int getNewState()
|
||||
{
|
||||
return newState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string that identifies this event. This is formatted as the
|
||||
* field name of the id, followed by the opposite window, old state, and
|
||||
* new state.
|
||||
*
|
||||
* @return a string that identifies this event
|
||||
*/
|
||||
public String paramString()
|
||||
{
|
||||
StringBuffer s = new StringBuffer();
|
||||
switch (id)
|
||||
{
|
||||
case WINDOW_OPENED:
|
||||
s.append("WINDOW_OPENED,opposite=");
|
||||
break;
|
||||
case WINDOW_CLOSING:
|
||||
s.append("WINDOW_CLOSING,opposite=");
|
||||
break;
|
||||
case WINDOW_CLOSED:
|
||||
s.append("WINDOW_CLOSED,opposite=");
|
||||
break;
|
||||
case WINDOW_ICONIFIED:
|
||||
s.append("WINDOW_ICONIFIED,opposite=");
|
||||
break;
|
||||
case WINDOW_DEICONIFIED:
|
||||
s.append("WINDOW_DEICONIFIED,opposite=");
|
||||
break;
|
||||
case WINDOW_ACTIVATED:
|
||||
s.append("WINDOW_ACTIVATED,opposite=");
|
||||
break;
|
||||
case WINDOW_DEACTIVATED:
|
||||
s.append("WINDOW_DEACTIVATED,opposite=");
|
||||
break;
|
||||
case WINDOW_GAINED_FOCUS:
|
||||
s.append("WINDOW_GAINED_FOCUS,opposite=");
|
||||
break;
|
||||
case WINDOW_LOST_FOCUS:
|
||||
s.append("WINDOW_LOST_FOCUS,opposite=");
|
||||
break;
|
||||
case WINDOW_STATE_CHANGED:
|
||||
s.append("WINDOW_STATE_CHANGED,opposite=");
|
||||
break;
|
||||
default:
|
||||
s.append("unknown type,opposite=");
|
||||
}
|
||||
return s.append(opposite).append(",oldState=").append(oldState)
|
||||
.append(",newState=").append(newState).toString();
|
||||
}
|
||||
} // class WindowEvent
|
|
@ -1,68 +0,0 @@
|
|||
/* WindowFocusListener.java -- listens for window focus events
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to monitor events for window
|
||||
* focus changes. To watch a subset of these events, use a WindowAdapter.
|
||||
*
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @see WindowAdapter
|
||||
* @see WindowEvent
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface WindowFocusListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when a window gains focus.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the focus change
|
||||
*/
|
||||
void windowGainedFocus(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when a window loses focus.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the focus change
|
||||
*/
|
||||
void windowLostFocus(WindowEvent event);
|
||||
} // interface WindowFocusListener
|
|
@ -1,107 +0,0 @@
|
|||
/* WindowListener.java -- listens for window events
|
||||
Copyright (C) 1999, 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to monitor events for window
|
||||
* changes. To watch a subset of these events, use a WindowAdapter.
|
||||
*
|
||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
||||
* @see WindowAdapter
|
||||
* @see WindowEvent
|
||||
* @since 1.1
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface WindowListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the window is made visible.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the change
|
||||
*/
|
||||
void windowOpened(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the user calls the system menu close
|
||||
* function, giving the program a chance to cancel the close.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the close attempt
|
||||
*/
|
||||
void windowClosing(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the window is closed.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the dispose
|
||||
*/
|
||||
void windowClosed(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the window is iconified.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the iconification
|
||||
* @see Frame#setIconImage(Image)
|
||||
*/
|
||||
void windowIconified(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the window is deiconified.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the deiconification
|
||||
*/
|
||||
void windowDeiconified(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when a window is activated. Only Frames and Dialogs
|
||||
* can be active, and the active window always contains the component with
|
||||
* focus.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the activation
|
||||
*/
|
||||
void windowActivated(WindowEvent event);
|
||||
|
||||
/**
|
||||
* This method is called when the window is deactivated.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the deactivation
|
||||
*/
|
||||
void windowDeactivated(WindowEvent event);
|
||||
} // interface WindowListener
|
|
@ -1,62 +0,0 @@
|
|||
/* WindowStateListener.java -- listens for window state changes
|
||||
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
GNU Classpath is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU Classpath is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU Classpath; see the file COPYING. If not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301 USA.
|
||||
|
||||
Linking this library statically or dynamically with other modules is
|
||||
making a combined work based on this library. Thus, the terms and
|
||||
conditions of the GNU General Public License cover the whole
|
||||
combination.
|
||||
|
||||
As a special exception, the copyright holders of this library give you
|
||||
permission to link this library with independent modules to produce an
|
||||
executable, regardless of the license terms of these independent
|
||||
modules, and to copy and distribute the resulting executable under
|
||||
terms of your choice, provided that you also meet, for each linked
|
||||
independent module, the terms and conditions of the license of that
|
||||
module. An independent module is a module which is not derived from
|
||||
or based on this library. If you modify this library, you may extend
|
||||
this exception to your version of the library, but you are not
|
||||
obligated to do so. If you do not wish to do so, delete this
|
||||
exception statement from your version. */
|
||||
|
||||
|
||||
package java.awt.event;
|
||||
|
||||
import java.util.EventListener;
|
||||
|
||||
/**
|
||||
* This interface is for classes that wish to monitor events for window
|
||||
* state changes.
|
||||
*
|
||||
* @author Eric Blake (ebb9@email.byu.edu)
|
||||
* @see WindowAdapter
|
||||
* @see WindowEvent
|
||||
* @since 1.4
|
||||
* @status updated to 1.4
|
||||
*/
|
||||
public interface WindowStateListener extends EventListener
|
||||
{
|
||||
/**
|
||||
* This method is called when the window state is changed, because of
|
||||
* iconification or maximization.
|
||||
*
|
||||
* @param event the <code>WindowEvent</code> indicating the change
|
||||
*/
|
||||
void windowStateChanged(WindowEvent event);
|
||||
} // interface WindowStateListener
|
Loading…
Add table
Add a link
Reference in a new issue