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

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

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

JTextField.select介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public void focusGained(FocusEvent e) {
  // make sure nothing is selected
  searchTextField.select(1, 1);
}

代码示例来源:origin: robward-scisys/sldeditor

/**
 * Copy text.
 *
 * <p>Copy all sample text to the system clipboard. Remember the current caret position
 * (selection) and restore that afterwards.
 */
public void copyText() {
  int end;
  int start; // text positions for caret and/or selection
  end = selectedCharField.getSelectionEnd(); // remember current position in text
  start = selectedCharField.getSelectionStart();
  selectedCharField.selectAll(); // select all text in the dialog box
  selectedCharField.copy(); // place that text onto the clipboard
  selectedCharField.select(start, end); // restore previous caret position
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

@Override
public void focusLost(FocusEvent e) {
  searchField.select(0, 0);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

@Override
public void focusLost(FocusEvent e) {
  searchField.select(0, 0);
}

代码示例来源:origin: jpcsp/jpcsp

@Override
  public void run() {
    // automatically select text after '0x'
    tf.select(2, tf.getText().length());
  }
});

代码示例来源:origin: jpcsp/jpcsp

@Override
  public void run() {
    // automatically select text after '0x'
    tf.select(2, tf.getText().length());
  }
});

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

public void setVisible(boolean visible) {
  super.setVisible(visible);
  columnNameTextField.requestFocus();
  columnNameTextField.select(0, columnNameTextField.getText().length());                
}

代码示例来源:origin: realXuJiang/bigtable-sql

public void setVisible(boolean visible) {
  super.setVisible(visible);
  columnNameTextField.requestFocus();
  columnNameTextField.select(0, columnNameTextField.getText().length());                
}

代码示例来源:origin: freeplane/freeplane

private void selectText() {
  textField.requestFocusInWindow();
  textField.select(0, textField.getDocument().getLength());
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

public void run() {
    ((JTextField) e.getSource()).select(0, 0);
  }
});

代码示例来源:origin: cmu-phil/tetrad

/**
 * Highlights the next selection.
 */
private void highlightNextSelection() {
  System.out.println("Highlighting next selection.");
  if (!this.selections.isEmpty()) {
    Selection sel = this.selections.get(0);
    this.expression.setSelectionColor(SELECTION);
    this.expression.select(sel.x, sel.y);
    this.expression.grabFocus();
  }
}

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

@Override
public void focusLost(FocusEvent event)
{
  if (isChanged())
  {
    notifyUpdateListener();
    setChanged(false);
  }
  text.select(0, 0);
}

代码示例来源:origin: cmu-phil/tetrad

/**
 * @return the expression.
 *
 * @throws java.text.ParseException - If the values in the editor are not well-formed.
 */
public Equation getEquation() throws ParseException {
  if (!NamingProtocol.isLegalName(this.variable.getText())) {
    this.variable.setSelectionColor(Color.RED);
    this.variable.select(0, this.variable.getText().length());
    this.variable.grabFocus();
    throw new ParseException(NamingProtocol.getProtocolDescription(), 1);
  }
  String equation = this.variable.getText() + "=" + this.expression.getText();
  try {
    return this.parser.parseEquation(equation);
  } catch (ParseException ex) {
    this.expression.setSelectionColor(Color.RED);
    this.expression.select(ex.getErrorOffset() - 1, this.expression.getText().length());
    this.expression.grabFocus();
    throw ex;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-wizards

/** Creates new NameIconLocationPanel */
public NameIconLocationPanel(final WizardDescriptor setting, final DataModel data) {
  super(setting);
  this.data = data;
  initComponents();
  initAccessibility();
  if (data.getPackageName() != null) {
    packageName.setSelectedItem(data.getPackageName());
  }
  putClientProperty("NewFileWizard_Title", getMessage("LBL_ActionWizardTitle"));
  className.select(0, className.getText().length());
  updateListener = new UIUtil.DocumentAdapter() {
    public void insertUpdate(DocumentEvent e) {
      updateData();
    }
  };
}

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java16

comboBoxEditorComponent.select(prefix.length(), newSelection.length());

代码示例来源:origin: net.java.dev.glazedlists/glazedlists_java15

comboBoxEditorComponent.select(prefix.length(), newSelection.length());

代码示例来源:origin: com.haulmont.thirdparty/glazedlists

comboBoxEditorComponent.select(prefix.length(), newSelection.length());

代码示例来源:origin: hneemann/Digital

Screen.setLocation(this, pos, true);
textField.requestFocus();
textField.select(0, Integer.MAX_VALUE);

相关文章

微信公众号

最新文章

更多

JTextField类方法