本文整理了Java中javax.swing.JTextField.setCaretPosition()
方法的一些代码示例,展示了JTextField.setCaretPosition()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.setCaretPosition()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:setCaretPosition
暂无
代码示例来源:origin: wiztools/rest-client
@Override
public void onOk(SSLKeyStore store) {
String pwdAvailable = store.getType() == KeyStoreType.PEM? "NA":
(store.getPassword()!=null && store.getPassword().length > 0)? "Yes": "No";
String txt = MessageFormat.format(tmpl,
store.getType(), store.getFile().getName(), pwdAvailable);
jtf.setText(txt);
jtf.setCaretPosition(0);
keyStore = store;
}
代码示例来源:origin: magefree/mage
@Override
public void focusGained(FocusEvent fe) {
lastOriginalHeigh = currentOriginalHeigh;
currentOriginalHeigh = 0;
lastRow = currentRow;
currentRow = -1;
if (lastOriginalHeigh < NEEDED_HIGH) {
table.setRowHeight(lastRow, NEEDED_HIGH);
}
SwingUtilities.invokeLater(() -> {
if (valueSet) {
textField.setCaretPosition(1);
}
});
}
代码示例来源:origin: stackoverflow.com
MouseListener ml = new MouseAdapter()
{
public void mousePressed(final MouseEvent e)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
JTextField tf = (JTextField)e.getSource();
int offset = tf.viewToModel(e.getPoint());
tf.setCaretPosition(offset);
}
});
}
};
formattedTextField.addMouseListener(ml);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial
public void setAuthor(String author){
jTextField2.setText(author);
jTextField2.setCaretPosition(0);
}
public void setDate(String date){
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial
public void setDate(String date){
jTextField3.setText(date);
jTextField3.setCaretPosition(0);
}
/** This method is called from within the constructor to
代码示例来源:origin: org.jboss.errai/errai-tools
public void focusGained(FocusEvent e) {
if (preEvent != null) {
searchField.setText(new String(new char[]{preEvent.getKeyChar()}));
searchField.setCaretPosition(1);
preEvent = null;
}
}
代码示例来源:origin: kaikramer/keystore-explorer
private void populate() {
if (keyIdentifier != null) {
jtfKeyIdentifier.setText(HexUtil.getHexString(keyIdentifier));
jbClearKeyIdentifier.setEnabled(true);
} else {
jtfKeyIdentifier.setText("");
jbClearKeyIdentifier.setEnabled(false);
}
jtfKeyIdentifier.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void populate() {
if (generalName != null) {
jtfGeneralName.setText(GeneralNameUtil.safeToString(generalName, false));
jbClearGeneralName.setEnabled(true);
} else {
jtfGeneralName.setText("");
jbClearGeneralName.setEnabled(false);
}
jtfGeneralName.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void populate() {
if (userNotice != null) {
jtfUserNotice.setText(PolicyInformationUtil.toString(userNotice));
jbClearUserNotice.setEnabled(true);
} else {
jtfUserNotice.setText("");
jbClearUserNotice.setEnabled(false);
}
jtfUserNotice.setCaretPosition(0);
}
代码示例来源:origin: danfickle/openhtmltopdf
public void actionPerformed(ActionEvent e) {
if (e.getSource() == _browseButton) {
JFileChooser chooser = new JFileChooser();
// TODO: We should probably use the BasicPanel as the parent
int result = chooser.showOpenDialog(_browseButton);
if (result == JFileChooser.APPROVE_OPTION) {
_pathTextField.setText(chooser.getSelectedFile().getAbsolutePath());
_pathTextField.setCaretPosition(0);
_browseButton.requestFocus();
}
}
}
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
DERIA5String netscapeSslServerName = DERIA5String.getInstance(value);
jtfNetscapeSslServerName.setText(netscapeSslServerName.getString());
jtfNetscapeSslServerName.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
DERIA5String netscapeRevocationUrl = DERIA5String.getInstance(value);
jtfNetscapeRevocationUrl.setText(netscapeRevocationUrl.getString());
jtfNetscapeRevocationUrl.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
DERIA5String netscapeCaRevocationUrl = DERIA5String.getInstance(value);
jtfNetscapeCaRevocationUrl.setText(netscapeCaRevocationUrl.getString());
jtfNetscapeCaRevocationUrl.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
InhibitAnyPolicy inhibitAnyPolicy = InhibitAnyPolicy.getInstance(value);
jtfSkipCertificates.setText("" + inhibitAnyPolicy.getSkipCerts());
jtfSkipCertificates.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
DERIA5String netscapeCertificateRenewalUrl = DERIA5String.getInstance(value);
jtfNetscapeCertificateRenewalUrl.setText(netscapeCertificateRenewalUrl.getString());
jtfNetscapeCertificateRenewalUrl.setCaretPosition(0);
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
DERIA5String netscapeCaPolicyUrl = DERIA5String.getInstance(value);
jtfNetscapeCaPolicyUrl.setText(netscapeCaPolicyUrl.getString());
jtfNetscapeCaPolicyUrl.setCaretPosition(0);
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools-test
@Override
public void focusLost(FocusEvent evt)
{
if (evt.getSource().equals(jTextField))
{
if (variableInThisBox != null)
{
setTextField();
jTextField.setCaretPosition(1);
}
}
}
代码示例来源:origin: kaikramer/keystore-explorer
private void prepopulateWithValue(byte[] value) throws IOException {
BasicConstraints basicConstraints = BasicConstraints.getInstance(value);
jcbSubjectIsCa.setSelected(basicConstraints.isCA());
if (basicConstraints.getPathLenConstraint() != null) {
jtfPathLengthConstraint.setText("" + basicConstraints.getPathLenConstraint().intValue());
jtfPathLengthConstraint.setCaretPosition(0);
}
}
代码示例来源:origin: danfickle/openhtmltopdf
protected void applyOriginalState() {
JTextField textfield = (JTextField) getComponent();
textfield.setText(getOriginalState().getValue());
// Make sure we are showing the front of 'value' instead of the end.
textfield.setCaretPosition(0);
}
代码示例来源:origin: org.docx4j/xhtmlrenderer
protected void applyOriginalState() {
JTextField textfield = (JTextField) getComponent();
textfield.setText(getOriginalState().getValue());
// Make sure we are showing the front of 'value' instead of the end.
textfield.setCaretPosition(0);
}
内容来源于网络,如有侵权,请联系作者删除!