Java 类java.awt.event.TextListener 实例源码

项目:jvm-stm    文件:TextComponent.java   
/**
 * Adds a new listener to the list of text listeners for this
 * component.
 *
 * @param listener The listener to be added.
 */
public synchronized void addTextListener(TextListener listener)
{
  textListener = AWTEventMulticaster.add(textListener, listener);

  enableEvents(AWTEvent.TEXT_EVENT_MASK);  
}
项目:cn1    文件:TextComponent.java   
protected void processTextEvent(TextEvent e) {
    for (TextListener listener : textListeners.getUserListeners()) {
        switch (e.getID()) {
            case TextEvent.TEXT_VALUE_CHANGED:
                listener.textValueChanged(e);
                break;
        }
    }
}
项目:cn1    文件:TextComponentTest.java   
public void testAddRemoveTextListener() {
    textComp.addTextListener(listener);
    assertSame(listener, textComp.textListener);
    TextListener newListener = new MyTextListener();
    textComp.addTextListener(newListener);
    assertTrue("if there are several listeners multicaster is used",
               textComp.textListener instanceof AWTEventMulticaster);
    AWTEventMulticaster aem = (AWTEventMulticaster) textComp.textListener;
    assertSame(listener, aem.a);
    textComp.removeTextListener(listener);
    assertTrue("if there is only one listener then it is used",
               textComp.textListener instanceof MyTextListener);
    assertSame(newListener, textComp.textListener);
    textComp.removeTextListener(newListener);
    assertNull(textComp.textListener);

}
项目:SPIM_Registration    文件:GenericLoadParseQueryXML.java   
protected void addListeners( final GenericDialog gd, final TextField tf, final Label label1, final Label label2  )
{
    final GenericLoadParseQueryXML< ?,?,?,?,?,? > lpq = this;

    // using TextListener instead
    tf.addTextListener( new TextListener()
    {   
        @Override
        public void textValueChanged( final TextEvent t )
        {
            if ( t.getID() == TextEvent.TEXT_VALUE_CHANGED )
            {
                final String xmlFilename = tf.getText();

                // try parsing if it ends with XML
                tryParsing( xmlFilename, false );

                label1.setText( lpq.message1 );
                label2.setText( lpq.message2 );
                label1.setForeground( lpq.color );
                label2.setForeground( lpq.color );
            }
        }
    });
}
项目:freeVM    文件:TextComponentTest.java   
public void testAddRemoveTextListener() {
    textComp.addTextListener(listener);
    assertSame(listener, textComp.textListener);
    TextListener newListener = new MyTextListener();
    textComp.addTextListener(newListener);
    assertTrue("if there are several listeners multicaster is used",
               textComp.textListener instanceof AWTEventMulticaster);
    AWTEventMulticaster aem = (AWTEventMulticaster) textComp.textListener;
    assertSame(listener, aem.a);
    textComp.removeTextListener(listener);
    assertTrue("if there is only one listener then it is used",
               textComp.textListener instanceof MyTextListener);
    assertSame(newListener, textComp.textListener);
    textComp.removeTextListener(newListener);
    assertNull(textComp.textListener);

}
项目:freeVM    文件:TextComponentTest.java   
public void testAddRemoveTextListener() {
    textComp.addTextListener(listener);
    assertSame(listener, textComp.textListener);
    TextListener newListener = new MyTextListener();
    textComp.addTextListener(newListener);
    assertTrue("if there are several listeners multicaster is used",
               textComp.textListener instanceof AWTEventMulticaster);
    AWTEventMulticaster aem = (AWTEventMulticaster) textComp.textListener;
    assertSame(listener, aem.a);
    textComp.removeTextListener(listener);
    assertTrue("if there is only one listener then it is used",
               textComp.textListener instanceof MyTextListener);
    assertSame(newListener, textComp.textListener);
    textComp.removeTextListener(newListener);
    assertNull(textComp.textListener);

}
项目:openjdk-jdk10    文件:TextComponentOperator.java   
/**
 * Maps {@code TextComponent.addTextListener(TextListener)} through queue
 */
public void addTextListener(final TextListener textListener) {
    runMapping(new MapVoidAction("addTextListener") {
        @Override
        public void map() {
            ((TextComponent) getSource()).addTextListener(textListener);
        }
    });
}
项目:openjdk-jdk10    文件:TextComponentOperator.java   
/**
 * Maps {@code TextComponent.removeTextListener(TextListener)} through queue
 */
public void removeTextListener(final TextListener textListener) {
    runMapping(new MapVoidAction("removeTextListener") {
        @Override
        public void map() {
            ((TextComponent) getSource()).removeTextListener(textListener);
        }
    });
}
项目:openjdk9    文件:TextComponentOperator.java   
/**
 * Maps {@code TextComponent.addTextListener(TextListener)} through queue
 */
public void addTextListener(final TextListener textListener) {
    runMapping(new MapVoidAction("addTextListener") {
        @Override
        public void map() {
            ((TextComponent) getSource()).addTextListener(textListener);
        }
    });
}
项目:openjdk9    文件:TextComponentOperator.java   
/**
 * Maps {@code TextComponent.removeTextListener(TextListener)} through queue
 */
public void removeTextListener(final TextListener textListener) {
    runMapping(new MapVoidAction("removeTextListener") {
        @Override
        public void map() {
            ((TextComponent) getSource()).removeTextListener(textListener);
        }
    });
}
项目:javify    文件:TextComponent.java   
/**
 * Adds a new listener to the list of text listeners for this
 * component.
 *
 * @param listener The listener to be added.
 */
public synchronized void addTextListener(TextListener listener)
{
  textListener = AWTEventMulticaster.add(textListener, listener);

  enableEvents(AWTEvent.TEXT_EVENT_MASK);
}
项目:groovy    文件:FindReplaceUtility.java   
private static void fireTextEvent() {
    EventListener[] lstrs =
            EVENT_LISTENER_LIST.getListeners(TextListener.class);
    if (lstrs != null && lstrs.length > 0) {
        TextEvent te =
                new TextEvent(FIND_REPLACE_DIALOG, TextEvent.TEXT_VALUE_CHANGED);
        for (int i = 0; i < lstrs.length; i++) {
            ((TextListener) lstrs[i]).textValueChanged(te);
        }
    }
}
项目:terminal-angel-disease    文件:SettingsPanel.java   
private JPanel createViewOne(MenuController menuController) {
    JPanel pnl = createFormularPanel();
    //
    TextListener textActionListener = new TextListener() {

        public void textValueChanged(TextEvent e) {
            enableButtons();            
        }           
    };
    namesInputForm = new NamesFormularPanel(menuController.trans, textActionListener);
    namesInputForm.setLocation(2, 10);
    pnl.add(namesInputForm);    
    //
    return pnl;
}
项目:terminal-angel-disease    文件:NamesFormularPanel.java   
public NamesFormularPanel(Translator trans, TextListener al) {
    super();               
    //
    setLayout(null);
    setSize(new Dimension(224, 90));
    setBackground(Color.WHITE);
    setForeground(Color.BLACK);
    //
    // text input fields
    nameOfPlayerTxtField = new TextField();
    nameOfPlayerTxtField.addTextListener(al);
    nameOfPlayerTxtField.setFont(systemFont);
    nameOfPlayerTxtField.setBounds(5, 5, 210, 22);
    add(nameOfPlayerTxtField);
    //
    nameOfPartyTxtField = new TextField();
    nameOfPartyTxtField.addTextListener(al);
    nameOfPartyTxtField.setFont(systemFont);               
    nameOfPartyTxtField.setBounds(5, 50, 210, 22);
    add(nameOfPartyTxtField);   
    //
    // ... and their labels
    JLabel lbl = new JLabel(trans.word("menu.settings.namePlayer"));
    lbl.setBounds(5, 25, 210, 20);
    lbl.setFont(SettingsPanel.cursiveFont);
    add(lbl);
    //
    lbl = new JLabel(trans.word("menu.settings.nameParty"));
    lbl.setBounds(5, 70, 210, 20);
    lbl.setFont(SettingsPanel.cursiveFont);
    add(lbl);
}
项目:cn1    文件:AWTEventMulticaster.java   
public void textValueChanged(TextEvent e) {
    if ((a != null) && (a instanceof TextListener)) {
        ((TextListener) a).textValueChanged(e);
    }
    if ((b != null) && (b instanceof TextListener)) {
        ((TextListener) b).textValueChanged(e);
    }
}
项目:cn1    文件:TextComponent.java   
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (TextListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getTextListeners();
    }
    return super.getListeners(listenerType);
}
项目:cn1    文件:TextComponentTest.java   
public void testGetListeners() {
    Class<TextListener> cls = TextListener.class;
    EventListener[] listeners = textComp.getListeners(cls);
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getListeners(cls)).length);
    assertSame(listener, listeners[0]);

}
项目:cn1    文件:TextComponentTest.java   
public void testGetTextListeners() {
    TextListener[] listeners = textComp.getTextListeners();
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getTextListeners()).length);
    assertSame(listener, listeners[0]);
}
项目:JamVM-PH    文件:TextComponent.java   
/**
 * Adds a new listener to the list of text listeners for this
 * component.
 *
 * @param listener The listener to be added.
 */
public synchronized void addTextListener(TextListener listener)
{
  textListener = AWTEventMulticaster.add(textListener, listener);

  enableEvents(AWTEvent.TEXT_EVENT_MASK);  
}
项目:SplitCharater    文件:TreeView.java   
/**
 * Adds a TextListener event listener.
 *
 * @param listener  The listener to add.
 *
 * @see #removeTextListener
 */
public void addTextListener(TextListener listener) {

    // is there anything to do?
    if (listener == null)
        return;

    if (textListeners == null)
       textListeners = new Vector();

    // add listener
    textListeners.addElement(listener);
    }
项目:SplitCharater    文件:TreeView.java   
/**
 * Removes a TextListener event listener.
 *
 * @param listener  The listener to remove.
 *
 * @see #addTextListener
 */
public void removeTextListener(TextListener listener) {

    // is there anything to do?
    if (listener == null || textListeners == null)
        return;

    // add listener
    textListeners.removeElement(listener);
    }
项目:SplitCharater    文件:TreeView.java   
/**
 * This function delivers TextListener events, when the ok
 * button is clicked.
 *
 * @param evt The event to deliver.
 */
protected void deliverEvent(EventObject evt) {

    if (evt instanceof TextEvent) {
        TextEvent event = (TextEvent)evt;

        Vector l;
        synchronized (textListeners) { l = (Vector)textListeners.clone(); }

        int size = l.size();
        for (int i = 0; i < size; i++)
            ((TextListener)l.elementAt(i)).textValueChanged(event);
        }
    }
项目:SPIM_Registration    文件:AutomaticBoundingBox.java   
protected void addListeners(
        final GenericDialog gd,
        final Vector<?> tf,
        final Label label,
        final long[] dim )
{
    final TextField downsample = (TextField)tf.get( 2 );

    downsample.addTextListener(
        new TextListener()
        {
            @Override
            public void textValueChanged(TextEvent arg0)
            {
                int downsampling = Integer.parseInt( downsample.getText() );

                final long numPixels = numPixels( dim, downsampling );
                final long megabytes = (numPixels * 4) / (1024*1024);

                label.setText( "Image size for segmentation: " + 
                        (dim[ 0 ])/downsampling + " x " + 
                        (dim[ 1 ])/downsampling + " x " + 
                        (dim[ 2 ])/downsampling + " pixels, " + megabytes + " MB" );
                label.setForeground( GUIHelper.good );
            }
        } );
}
项目:classpath    文件:TextComponent.java   
/**
 * Adds a new listener to the list of text listeners for this
 * component.
 *
 * @param listener The listener to be added.
 */
public synchronized void addTextListener(TextListener listener)
{
  textListener = AWTEventMulticaster.add(textListener, listener);

  enableEvents(AWTEvent.TEXT_EVENT_MASK);
}
项目:freeVM    文件:AWTEventMulticaster.java   
public void textValueChanged(TextEvent e) {
    if ((a != null) && (a instanceof TextListener)) {
        ((TextListener) a).textValueChanged(e);
    }
    if ((b != null) && (b instanceof TextListener)) {
        ((TextListener) b).textValueChanged(e);
    }
}
项目:freeVM    文件:TextComponent.java   
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (TextListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getTextListeners();
    }
    return super.getListeners(listenerType);
}
项目:freeVM    文件:TextComponent.java   
protected void processTextEvent(TextEvent e) {
    for (TextListener listener : textListeners.getUserListeners()) {
        switch (e.getID()) {
            case TextEvent.TEXT_VALUE_CHANGED:
                listener.textValueChanged(e);
                break;
        }
    }
}
项目:freeVM    文件:TextComponentTest.java   
public void testGetListeners() {
    Class<TextListener> cls = TextListener.class;
    EventListener[] listeners = textComp.getListeners(cls);
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getListeners(cls)).length);
    assertSame(listener, listeners[0]);

}
项目:freeVM    文件:TextComponentTest.java   
public void testGetTextListeners() {
    TextListener[] listeners = textComp.getTextListeners();
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getTextListeners()).length);
    assertSame(listener, listeners[0]);
}
项目:freeVM    文件:AWTEventMulticaster.java   
public void textValueChanged(TextEvent e) {
    if ((a != null) && (a instanceof TextListener)) {
        ((TextListener) a).textValueChanged(e);
    }
    if ((b != null) && (b instanceof TextListener)) {
        ((TextListener) b).textValueChanged(e);
    }
}
项目:freeVM    文件:TextComponent.java   
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (TextListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getTextListeners();
    }
    return super.getListeners(listenerType);
}
项目:freeVM    文件:TextComponent.java   
protected void processTextEvent(TextEvent e) {
    for (TextListener listener : textListeners.getUserListeners()) {
        switch (e.getID()) {
            case TextEvent.TEXT_VALUE_CHANGED:
                listener.textValueChanged(e);
                break;
        }
    }
}
项目:freeVM    文件:TextComponentTest.java   
public void testGetListeners() {
    Class<TextListener> cls = TextListener.class;
    EventListener[] listeners = textComp.getListeners(cls);
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getListeners(cls)).length);
    assertSame(listener, listeners[0]);

}
项目:freeVM    文件:TextComponentTest.java   
public void testGetTextListeners() {
    TextListener[] listeners = textComp.getTextListeners();
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getTextListeners()).length);
    assertSame(listener, listeners[0]);
}
项目:javify    文件:TextComponent.java   
/**
 * Returns all text listeners registered to this object.
 */
public TextListener[] getTextListeners()
{
  return (TextListener[]) getListeners(TextListener.class);
}
项目:jvm-stm    文件:TextComponent.java   
/**
 * Returns all text listeners registered to this object.
 */
public TextListener[] getTextListeners()
{
  return (TextListener[]) getListeners(TextListener.class);
}
项目:groovy    文件:FindReplaceUtility.java   
public static void addTextListener(TextListener tl) {
    EVENT_LISTENER_LIST.add(TextListener.class, tl);
}
项目:groovy    文件:FindReplaceUtility.java   
public static void removeTextListener(TextListener tl) {
    EVENT_LISTENER_LIST.remove(TextListener.class, tl);
}
项目:cn1    文件:AWTEventMulticaster.java   
public static TextListener add(TextListener a, TextListener b) {
    return (TextListener) addInternal(a, b);
}
项目:cn1    文件:AWTEventMulticaster.java   
public static TextListener remove(TextListener l, TextListener oldl) {
    return (TextListener) removeInternal(l, oldl);
}