@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(); }
@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(); }
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); } }
@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(); }
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; }
protected void processTextEvent(TextEvent e) { for (TextListener listener : textListeners.getUserListeners()) { switch (e.getID()) { case TextEvent.TEXT_VALUE_CHANGED: listener.textValueChanged(e); break; } } }
@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(); }
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 ); } } }); }
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); } }
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); } }
@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); } }