javax.swing.JTextField.addCaretListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中javax.swing.JTextField.addCaretListener()方法的一些代码示例,展示了JTextField.addCaretListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.addCaretListener()方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:addCaretListener

JTextField.addCaretListener介绍

暂无

代码示例

代码示例来源:origin: org.japura/japura-gui

/**
 * @see JTextField#addCaretListener(CaretListener)
 */
public void addCaretListener(CaretListener listener) {
 getField().addCaretListener(listener);
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private void initSearchBar() {
  searchBar = new JTextField();
  searchBar.putClientProperty("JTextField.variant", "search");
  searchBar.addCaretListener(new CaretListener() {
    @Override
    public void caretUpdate(CaretEvent e) {
      updateListItems();
    }
  });
}

代码示例来源:origin: stackoverflow.com

public class A extends JFrame implements CaretListener
{
 //Assume you have a text field.
 public A()
 {
  JTextField field = new JTextField("bla bla");
  field.addCaretListener(this);
  .....
 }

 public void caretUpdate(CaretEvent e)
 {          
  int index = e.getDot();
  .....
 }
}

代码示例来源:origin: worstcase/gumshoe

private JPanel createCountPanel() {
  topCount.setColumns(3);
  bottomCount.setColumns(3);
  // lighten/darken words to help make filter intent more clear
  topLabel1.setEnabled(false);
  topLabel2.setEnabled(false);
  bothLabel.setEnabled(false);
  bottomLabel1.setEnabled(false);
  bottomLabel2.setEnabled(false);
  topCount.addCaretListener(new CaretListener() {
    @Override
    public void caretUpdate(CaretEvent e) {
      final boolean topPositive = isPositive(topCount);
      topLabel1.setEnabled(topPositive);
      topLabel2.setEnabled(topPositive);
      bothLabel.setEnabled(topPositive && isPositive(bottomCount));
    } });
  bottomCount.addCaretListener(new CaretListener() {
    @Override
    public void caretUpdate(CaretEvent e) {
      final boolean bottomPositive = isPositive(bottomCount);
      bottomLabel1.setEnabled(bottomPositive);
      bottomLabel2.setEnabled(bottomPositive);
      bothLabel.setEnabled(bottomPositive && isPositive(topCount));
    } });
  return flow(new JLabel("Drop all frames except the"),
      topLabel1, topCount, bothLabel, bottomLabel1, bottomCount);
}

代码示例来源:origin: edu.stanford.protege/org.coode.owlviz

JPanel entryPanel = new JPanel(new BorderLayout(12, 12));
pathNameField = new JTextField();
pathNameField.addCaretListener(new CaretListener() {

代码示例来源:origin: org.codehaus.mevenide/nb-project

field.addCaretListener(caretListener);
      return;
    } else {
  field.setText(completed);
field.addCaretListener(caretListener);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

m_TextURL.addCaretListener(this);
panel2.add(m_TextURL);

代码示例来源:origin: Waikato/weka-trunk

m_TextURL.addCaretListener(this);
panel2.add(m_TextURL);

代码示例来源:origin: org.codehaus.izpack/izpack-panel

/**
 * Creates the items that make up this field. All fields are stored in <code>inputFields</code>.
 */
private void createItems()
{
  FieldLayout layout = field.getLayout();
  for (Object item : layout.getLayout())
  {
    if (item instanceof FieldSpec)
    {
      FieldSpec spec = (FieldSpec) item;
      JTextField field = new RuleTextField(spec);
      inputFields.add(field);
      field.addFocusListener(this);
      field.addKeyListener(this);
      field.addCaretListener(this);
      add(field);
    }
    else
    {
      add(new JLabel((String) item));
    }
  }
}

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

fileChoosePanel.getTextField().addCaretListener(new CaretListener() {
  @Override
  public void caretUpdate(CaretEvent ce) {

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

private JPanel populateOnServerPanel(final DefaultWizardPage page) {
  JPanel p = ViewUtil.getClearPanel();
  ViewUtil.applyVerticalBoxLayout(p);
  serverPathField = new JTextField();
  ViewUtil.clear(serverPathField);
  serverPathField.addCaretListener(new CaretListener() {
    @Override
    public void caretUpdate(CaretEvent ce) {
      if (serverPathField.getText().isEmpty()) {
        page.fireButtonEvent(ButtonEvent.DISABLE_BUTTON, ButtonNames.NEXT);
      } else {
        page.fireButtonEvent(ButtonEvent.ENABLE_BUTTON, ButtonNames.NEXT);
      }
    }
  });
  JPanel container = ViewUtil.getClearPanel();
  ViewUtil.clear(container);
  ViewUtil.applyHorizontalBoxLayout(container);
  container.add(serverPathField);
  p.add(ViewUtil.alignLeft(container));
  return p;
}

代码示例来源:origin: GoldenGnu/jeveassets

jTextField.addCaretListener(listener);

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

if (theEditor instanceof JTextField) {
 ((JTextField) m_combo.getEditor().getEditorComponent())
  .addCaretListener(new CaretListener() {

代码示例来源:origin: onyxbits/dummydroid

@Override
public void edit(FormData formData) {
  super.edit(formData);
  username.setText(formData.getUsername());
  password.setText(formData.getPassword());
  username.removeCaretListener(this);
  username.addCaretListener(this);
  password.removeCaretListener(this);
  password.addCaretListener(this);
  stopIfEmpty();
}

代码示例来源:origin: Waikato/weka-trunk

if (theEditor instanceof JTextField) {
 ((JTextField) m_combo.getEditor().getEditorComponent())
  .addCaretListener(new CaretListener() {

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

if (theEditor instanceof JTextField) {
 ((JTextField) m_combo.getEditor().getEditorComponent())
  .addCaretListener(new CaretListener() {

代码示例来源:origin: Waikato/weka-trunk

if (theEditor instanceof JTextField) {
 ((JTextField) m_combo.getEditor().getEditorComponent())
  .addCaretListener(new CaretListener() {

代码示例来源:origin: blurpy/kouchat

msgTF.addCaretListener(this);
msgTF.addKeyListener(this);

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

field.addCaretListener(this);
return field;

代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2

field.addCaretListener(this);
return field;

相关文章

JTextField类方法