/**
* Deserializes this component. This regenerates all serializable listeners
* which were registered originally.
*
* @param s the stream to read from
* @throws ClassNotFoundException if deserialization fails
* @throws IOException if the stream fails
*/
private void readObject(ObjectInputStream s)
throws ClassNotFoundException, IOException
{
s.defaultReadObject();
String key = (String) s.readObject();
while (key != null)
{
Object listener = s.readObject();
if ("componentL".equals(key))
addComponentListener((ComponentListener) listener);
else if ("focusL".equals(key))
addFocusListener((FocusListener) listener);
else if ("keyL".equals(key))
addKeyListener((KeyListener) listener);
else if ("mouseL".equals(key))
addMouseListener((MouseListener) listener);
else if ("mouseMotionL".equals(key))
addMouseMotionListener((MouseMotionListener) listener);
else if ("inputMethodL".equals(key))
addInputMethodListener((InputMethodListener) listener);
else if ("hierarchyL".equals(key))
addHierarchyListener((HierarchyListener) listener);
else if ("hierarchyBoundsL".equals(key))
addHierarchyBoundsListener((HierarchyBoundsListener) listener);
else if ("mouseWheelL".equals(key))
addMouseWheelListener((MouseWheelListener) listener);
key = (String) s.readObject();
}
}
java类java.awt.event.InputMethodListener的实例源码
Component.java 文件源码
项目:classpath
阅读 25
收藏 0
点赞 0
评论 0
StandaloneAppletWindow.java 文件源码
项目:classpath
阅读 25
收藏 0
点赞 0
评论 0
/**
* This method is called when the text is changed.
*
* @param event the <code>InputMethodEvent</code> indicating the text change
*/
public void inputMethodTextChanged(InputMethodEvent event)
{
if (applet != null)
{
InputMethodListener[] l = applet.getInputMethodListeners();
for (int i = 0; i < l.length; i++)
l[i].inputMethodTextChanged(event);
}
}
StandaloneAppletWindow.java 文件源码
项目:classpath
阅读 35
收藏 0
点赞 0
评论 0
/**
* This method is called when the cursor position within the text is changed.
*
* @param event the <code>InputMethodEvent</code> indicating the change
*/
public void caretPositionChanged(InputMethodEvent event)
{
if (applet != null)
{
InputMethodListener[] l = applet.getInputMethodListeners();
for (int i = 0; i < l.length; i++)
l[i].caretPositionChanged(event);
}
}
PluginAppletWindow.java 文件源码
项目:classpath
阅读 21
收藏 0
点赞 0
评论 0
/**
* This method is called when the text is changed.
*
* @param event the <code>InputMethodEvent</code> indicating the text change
*/
public void inputMethodTextChanged(InputMethodEvent event)
{
if (applet != null)
{
InputMethodListener[] l = applet.getInputMethodListeners();
for (int i = 0; i < l.length; i++)
l[i].inputMethodTextChanged(event);
}
}
PluginAppletWindow.java 文件源码
项目:classpath
阅读 30
收藏 0
点赞 0
评论 0
/**
* This method is called when the cursor position within the text is changed.
*
* @param event the <code>InputMethodEvent</code> indicating the change
*/
public void caretPositionChanged(InputMethodEvent event)
{
if (applet != null)
{
InputMethodListener[] l = applet.getInputMethodListeners();
for (int i = 0; i < l.length; i++)
l[i].caretPositionChanged(event);
}
}
AWTEventMulticaster.java 文件源码
项目:freeVM
阅读 29
收藏 0
点赞 0
评论 0
public void caretPositionChanged(InputMethodEvent e) {
if ((a != null) && (a instanceof InputMethodListener)) {
((InputMethodListener) a).caretPositionChanged(e);
}
if ((b != null) && (b instanceof InputMethodListener)) {
((InputMethodListener) b).caretPositionChanged(e);
}
}
AWTEventMulticaster.java 文件源码
项目:freeVM
阅读 26
收藏 0
点赞 0
评论 0
public void inputMethodTextChanged(InputMethodEvent e) {
if ((a != null) && (a instanceof InputMethodListener)) {
((InputMethodListener) a).inputMethodTextChanged(e);
}
if ((b != null) && (b instanceof InputMethodListener)) {
((InputMethodListener) b).inputMethodTextChanged(e);
}
}
Component.java 文件源码
项目:freeVM
阅读 33
收藏 0
点赞 0
评论 0
private void processInputMethodEventImpl(InputMethodEvent e,
Collection<InputMethodListener> c) {
for (InputMethodListener listener : c) {
switch (e.getID()) {
case InputMethodEvent.CARET_POSITION_CHANGED:
listener.caretPositionChanged(e);
break;
case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
listener.inputMethodTextChanged(e);
break;
}
}
}
TextUtils.java 文件源码
项目:freeVM
阅读 37
收藏 0
点赞 0
评论 0
public static void processIMEvent(final InputMethodListener listener,
final InputMethodEvent e) {
if (e.getID() == InputMethodEvent.CARET_POSITION_CHANGED) {
listener.caretPositionChanged(e);
}
if (e.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
listener.inputMethodTextChanged(e);
}
}
JTextComponentTest.java 文件源码
项目:freeVM
阅读 56
收藏 0
点赞 0
评论 0
public void testAddInputMethodListener() {
SimpleInputMethodListener listener1 = new SimpleInputMethodListener("1");
SimpleInputMethodListener listener2 = new SimpleInputMethodListener("2");
SimpleInputMethodListener listener3 = new SimpleInputMethodListener("3");
jtc.addInputMethodListener(listener1);
jtc.addInputMethodListener(listener2);
jtc.addInputMethodListener(listener3);
InputMethodListener listeners[] = jtc.getInputMethodListeners();
assertEquals(listener1, listeners[0]);
assertEquals(listener2, listeners[1]);
assertEquals(listener3, listeners[2]);
assertEquals(3, listeners.length);
}