当前位置: 首页>>代码示例>>Java>>正文


Java TextListener类代码示例

本文整理汇总了Java中java.awt.event.TextListener的典型用法代码示例。如果您正苦于以下问题:Java TextListener类的具体用法?Java TextListener怎么用?Java TextListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextListener类属于java.awt.event包,在下文中一共展示了TextListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTextListener

import java.awt.event.TextListener; //导入依赖的package包/类
/**
 * 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);  
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:13,代码来源:TextComponent.java

示例2: processTextEvent

import java.awt.event.TextListener; //导入依赖的package包/类
protected void processTextEvent(TextEvent e) {
    for (TextListener listener : textListeners.getUserListeners()) {
        switch (e.getID()) {
            case TextEvent.TEXT_VALUE_CHANGED:
                listener.textValueChanged(e);
                break;
        }
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:TextComponent.java

示例3: testAddRemoveTextListener

import java.awt.event.TextListener; //导入依赖的package包/类
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);

}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:TextComponentTest.java

示例4: addListeners

import java.awt.event.TextListener; //导入依赖的package包/类
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 );
			}
		}
	});
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:26,代码来源:GenericLoadParseQueryXML.java

示例5: addTextListener

import java.awt.event.TextListener; //导入依赖的package包/类
/**
 * 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);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例6: removeTextListener

import java.awt.event.TextListener; //导入依赖的package包/类
/**
 * 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);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:TextComponentOperator.java

示例7: addTextListener

import java.awt.event.TextListener; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:vilie,项目名称:javify,代码行数:13,代码来源:TextComponent.java

示例8: fireTextEvent

import java.awt.event.TextListener; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:12,代码来源:FindReplaceUtility.java

示例9: createViewOne

import java.awt.event.TextListener; //导入依赖的package包/类
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;
}
 
开发者ID:captainsoft,项目名称:terminal-angel-disease,代码行数:16,代码来源:SettingsPanel.java

示例10: NamesFormularPanel

import java.awt.event.TextListener; //导入依赖的package包/类
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);
}
 
开发者ID:captainsoft,项目名称:terminal-angel-disease,代码行数:33,代码来源:NamesFormularPanel.java

示例11: textValueChanged

import java.awt.event.TextListener; //导入依赖的package包/类
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);
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:AWTEventMulticaster.java

示例12: getListeners

import java.awt.event.TextListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (TextListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getTextListeners();
    }
    return super.getListeners(listenerType);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:9,代码来源:TextComponent.java

示例13: testGetListeners

import java.awt.event.TextListener; //导入依赖的package包/类
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]);

}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:TextComponentTest.java

示例14: testGetTextListeners

import java.awt.event.TextListener; //导入依赖的package包/类
public void testGetTextListeners() {
    TextListener[] listeners = textComp.getTextListeners();
    assertEquals(0, listeners.length);
    textComp.addTextListener(listener);
    assertEquals(1, (listeners = textComp.getTextListeners()).length);
    assertSame(listener, listeners[0]);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:8,代码来源:TextComponentTest.java

示例15: addTextListener

import java.awt.event.TextListener; //导入依赖的package包/类
/**
 * 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);
    }
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:20,代码来源:TreeView.java


注:本文中的java.awt.event.TextListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。