java.awt.event.TextListener Java Examples

The following examples show how to use java.awt.event.TextListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GenericLoadParseQueryXML.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
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 );
			}
		}
	});
}
 
Example #2
Source File: TextComponentOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
        }
    });
}
 
Example #3
Source File: TextComponentOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
        }
    });
}
 
Example #4
Source File: FindReplaceUtility.java    From groovy with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example #5
Source File: AutomaticBoundingBox.java    From SPIM_Registration with GNU General Public License v2.0 5 votes vote down vote up
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 );
			}
		} );
}
 
Example #6
Source File: FindReplaceUtility.java    From groovy with Apache License 2.0 4 votes vote down vote up
public static void addTextListener(TextListener tl) {
    EVENT_LISTENER_LIST.add(TextListener.class, tl);
}
 
Example #7
Source File: FindReplaceUtility.java    From groovy with Apache License 2.0 4 votes vote down vote up
public static void removeTextListener(TextListener tl) {
    EVENT_LISTENER_LIST.remove(TextListener.class, tl);
}