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

下面列出了怎么用java.awt.event.TextListener的API类实例代码及写法,或者点击链接到github查看源代码。

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 );
			}
		}
	});
}
 
源代码2 项目: openjdk-jdk9   文件: 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);
        }
    });
}
 
源代码3 项目: openjdk-jdk9   文件: 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);
        }
    });
}
 
源代码4 项目: 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);
        }
    }
}
 
源代码5 项目: 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 );
			}
		} );
}
 
源代码6 项目: groovy   文件: FindReplaceUtility.java
public static void addTextListener(TextListener tl) {
    EVENT_LISTENER_LIST.add(TextListener.class, tl);
}
 
源代码7 项目: groovy   文件: FindReplaceUtility.java
public static void removeTextListener(TextListener tl) {
    EVENT_LISTENER_LIST.remove(TextListener.class, tl);
}