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


Java TextEvent类代码示例

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


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

示例1: replaceRange

import java.awt.event.TextEvent; //导入依赖的package包/类
@Override
public void replaceRange(final String text, final int start,
                         final int end) {
    synchronized (getDelegateLock()) {
        // JTextArea.replaceRange() posts two different events.
        // Since we make no differences between text events,
        // the document listener has to be disabled while
        // JTextArea.replaceRange() is called.
        final Document document = getTextComponent().getDocument();
        document.removeDocumentListener(this);
        getDelegate().getView().replaceRange(text, start, end);
        revalidate();
        postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED));
        document.addDocumentListener(this);
    }
    repaintPeer();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:LWTextAreaPeer.java

示例2: setText

import java.awt.event.TextEvent; //导入依赖的package包/类
@Override
public final void setText(final String text) {
    synchronized (getDelegateLock()) {
        // JTextArea.setText() posts two different events (remove & insert).
        // Since we make no differences between text events,
        // the document listener has to be disabled while
        // JTextArea.setText() is called.
        final Document document = getTextComponent().getDocument();
        document.removeDocumentListener(this);
        getTextComponent().setText(text);
        revalidate();
        if (firstChangeSkipped) {
            postEvent(new TextEvent(getTarget(),
                                    TextEvent.TEXT_VALUE_CHANGED));
        }
        document.addDocumentListener(this);
    }
    repaintPeer();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:LWTextComponentPeer.java

示例3: setXAWTTextField

import java.awt.event.TextEvent; //导入依赖的package包/类
private void setXAWTTextField(String txt) {
    text = txt;
    if (xtext != null)  {
        // JTextField.setText() posts two different events (remove & insert).
        // Since we make no differences between text events,
        // the document listener has to be disabled while
        // JTextField.setText() is called.
        xtext.getDocument().removeDocumentListener(xtext);
        xtext.setText(txt);
        if (firstChangeSkipped) {
            postEvent(new TextEvent(target, TextEvent.TEXT_VALUE_CHANGED));
        }
        xtext.getDocument().addDocumentListener(xtext);
        xtext.setCaretPosition(0);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:XTextFieldPeer.java

示例4: replaceRange

import java.awt.event.TextEvent; //导入依赖的package包/类
@Override
public void replaceRange(final String text, final int start,
                         final int end) {
    synchronized (getDelegateLock()) {
        // JTextArea.replaceRange() posts two different events.
        // Since we make no differences between text events,
        // the document listener has to be disabled while
        // JTextArea.replaceRange() is called.
        final Document document = getTextComponent().getDocument();
        document.removeDocumentListener(this);
        getTextComponent().replaceRange(text, start, end);
        revalidate();
        postEvent(new TextEvent(getTarget(), TextEvent.TEXT_VALUE_CHANGED));
        document.addDocumentListener(this);
    }
    repaintPeer();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:LWTextAreaPeer.java

示例5: setXAWTTextField

import java.awt.event.TextEvent; //导入依赖的package包/类
protected boolean setXAWTTextField(String txt) {
    text = txt;
    if (xtext != null)  {
        // JTextField.setText() posts two different events (remove & insert).
        // Since we make no differences between text events,
        // the document listener has to be disabled while
        // JTextField.setText() is called.
        xtext.getDocument().removeDocumentListener(xtext);
        xtext.setText(txt);
        if (firstChangeSkipped) {
            postEvent(new TextEvent(target, TextEvent.TEXT_VALUE_CHANGED));
        }
        xtext.getDocument().addDocumentListener(xtext);
        xtext.setCaretPosition(0);
    }
    return true;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:18,代码来源:XTextFieldPeer.java

示例6: processTextEvent

import java.awt.event.TextEvent; //导入依赖的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

示例7: setText

import java.awt.event.TextEvent; //导入依赖的package包/类
@Override
public final void setText(final String l) {
    synchronized (getDelegateLock()) {
        // JTextArea.setText() posts two different events (remove & insert).
        // Since we make no differences between text events,
        // the document listener has to be disabled while
        // JTextArea.setText() is called.
        final Document document = getTextComponent().getDocument();
        document.removeDocumentListener(this);
        getTextComponent().setText(l);
        revalidate();
        if (firstChangeSkipped) {
            postEvent(new TextEvent(getTarget(),
                                    TextEvent.TEXT_VALUE_CHANGED));
        }
        document.addDocumentListener(this);
    }
    repaintPeer();
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:20,代码来源:LWTextComponentPeer.java

示例8: addListeners

import java.awt.event.TextEvent; //导入依赖的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

示例9: textValueChanged

import java.awt.event.TextEvent; //导入依赖的package包/类
public void textValueChanged(TextEvent e) {
	if (e.getSource().equals(sampleCodeFilePathField)) {
		sampleCodeListPath = sampleCodeFilePathField.getText();
		if (StringUtil.notEmpty(sampleCodeListPath)) {
			chosenNameCategory=-1;
		//	scanTabbedDocument();
			scanTabbedDocument();
		//	processNameCategories();
			//initialize(sampleCodeListPath);
		}	
		categoryChoice.removeAll();
		if (nameCategories!=null) {			
			for (int i=0; i<nameCategories.length; i++) 
				if (!StringUtil.blank(nameCategories[i])) {
					categoryChoice.add(nameCategories[i]);
				}
		}
		categoryChoice.repaint();
		//				categoryChoice = dialog.addPopUpMenu("Names to use:", xmlProcessor.getNameCategoryDescriptions(), tagNumber);

	}
}
 
开发者ID:MesquiteProject,项目名称:Chromaseq,代码行数:23,代码来源:SequenceNameFromTabbedFile.java

示例10: textValueChanged

import java.awt.event.TextEvent; //导入依赖的package包/类
public void textValueChanged(TextEvent e) {
	if (e.getSource().equals(sampleCodeFilePathField)) {
		sampleCodeListPath = sampleCodeFilePathField.getText();
		if (StringUtil.notEmpty(sampleCodeListPath)) {
			initialize(sampleCodeListPath);
		}	
		categoryChoice.removeAll();
		if (xmlProcessor.isValid()) {			
			String[] choices = xmlProcessor.getNameCategoryDescriptions();
			for (int i=0; i<choices.length; i++) 
				if (!StringUtil.blank(choices[i])) {
					categoryChoice.add(choices[i]);
				}
		}
		categoryChoice.repaint();
		//				categoryChoice = dialog.addPopUpMenu("Names to use:", xmlProcessor.getNameCategoryDescriptions(), tagNumber);

	}
}
 
开发者ID:MesquiteProject,项目名称:Chromaseq,代码行数:20,代码来源:SequenceNameFromXMLFile.java

示例11: textValueChanged

import java.awt.event.TextEvent; //导入依赖的package包/类
@Override
      public void textValueChanged(final TextEvent e) {
	try {
		final TextField source = (TextField) e.getSource();
		if (scale == source && (scale.isFocusOwner() || bar.isFocusOwner())) {
			final double sc = Double.parseDouble(scale.getText()) / 100;
			// update both
			width.setText(Integer.toString((int) (sc * initial_width + 0.5)));
			height.setText(Integer.toString((int) (sc * initial_height + 0.5)));
		} else if (width == source && width.isFocusOwner()) {
			/*
			final int width = Integer.toString((int) (width.getText() + 0.5));
			final double sc = width / (double)initial_width;
			scale.setText(Integer.toString((int)(sc * 100 + 0.5)));
			height.setText(Integer.toString((int)(sc * initial_height + 0.5)));
			*/
			set(width, height, initial_width, initial_height);
		} else if (height == source && height.isFocusOwner()) {
			set(height, width, initial_height, initial_width);
		}
	} catch (final NumberFormatException nfe) {
		Utils.logAll("Unparsable number: " + nfe.getMessage());
	} catch (final Exception ee) {
		IJError.print(ee);
	}
}
 
开发者ID:trakem2,项目名称:TrakEM2,代码行数:27,代码来源:Display.java


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