本文整理汇总了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();
}
示例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();
}
示例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);
}
}
示例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();
}
示例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;
}
示例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;
}
}
}
示例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();
}
示例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 );
}
}
});
}
示例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);
}
}
示例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);
}
}
示例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);
}
}