本文整理了Java中javax.swing.JTextField.selectAll()
方法的一些代码示例,展示了JTextField.selectAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.selectAll()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:selectAll
暂无
代码示例来源:origin: wiztools/rest-client
@Override
public void focusGained(FocusEvent e) {
editorComponent.selectAll();
}
});
代码示例来源:origin: wildfly/wildfly
public void focusGained(FocusEvent e) {
String value=field.getText();
if(value != null && !value.isEmpty()) {
field.selectAll();
}
}
代码示例来源:origin: wiztools/rest-client
@Override
public void actionPerformed(ActionEvent ae) {
try {
final String localHost = InetAddress.getLocalHost().getHostName();
jtf_workstation.setText(localHost);
jtf_workstation.selectAll();
jtf_workstation.requestFocus();
}
catch(UnknownHostException ex) {
throw new RuntimeException(ex);
}
}
});
代码示例来源:origin: deathmarine/Luyten
public void showFindBox() {
this.setVisible(true);
this.textField.requestFocus();
this.textField.selectAll();
}
代码示例来源:origin: skylot/jadx
@Override
protected void openInit() {
prepare();
String lastSearch = cache.getLastSearch();
if (lastSearch != null) {
searchField.setText(lastSearch);
searchField.selectAll();
searchEmitter.emitSearch();
}
searchField.requestFocus();
}
代码示例来源:origin: wildfly/wildfly
public void mouseClicked(MouseEvent e) {
send(txtField.getText());
txtField.selectAll();
}
});
代码示例来源:origin: runelite/runelite
@Override
public void focusGained(FocusEvent e)
{
nameInput.getTextField().selectAll();
}
代码示例来源:origin: skylot/jadx
public boolean toggle() {
boolean visible = !isVisible();
setVisible(visible);
if (visible) {
searchField.requestFocus();
searchField.selectAll();
} else {
rTextArea.requestFocus();
}
return visible;
}
代码示例来源:origin: gocd/gocd
private void createView() {
JPanel controlsPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
serverTextField = new JTextField("");
serverTextField.setColumns(15);
serverTextField.selectAll();
JPanel textPanel = new JPanel(new GridLayout(4, 2, 0, 10));
textPanel.add(new JLabel("Go Server Hostname or IP"));
textPanel.add(serverTextField);
textPanel.add(new JLabel("SSL Mode"));
sslModeComponent = new SslModeComponent();
textPanel.add(sslModeComponent);
textPanel.add(new JLabel("Server root certificate"));
fileBrowser = new FileBrowser();
textPanel.add(fileBrowser);
controlsPanel.add(textPanel);
getContentPane().add(controlsPanel, BorderLayout.NORTH);
JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
okButton = new JButton("OK");
buttonPanel.add(okButton);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
}
代码示例来源:origin: runelite/runelite
private void updateNameActions(boolean saveAndCancel)
{
save.setVisible(saveAndCancel);
cancel.setVisible(saveAndCancel);
rename.setVisible(!saveAndCancel);
if (saveAndCancel)
{
nameInput.getTextField().requestFocusInWindow();
nameInput.getTextField().selectAll();
}
}
代码示例来源:origin: runelite/runelite
@Override
public void focusGained(FocusEvent e)
{
displayInput.getTextField().setForeground(INACTIVE_CLOCK_COLOR);
displayInput.getTextField().selectAll();
}
代码示例来源:origin: gocd/gocd
public void ask() {
AgentBootstrapperArgs bootstrapperArgs = agentMacWindow.getBootstrapperArgs();
this.serverTextField.setText(bootstrapperArgs.getServerUrl().toString());
this.fileBrowser.setFile(bootstrapperArgs.getRootCertFile());
this.sslModeComponent.setSslMode(bootstrapperArgs.getSslMode());
serverTextField.selectAll();
serverTextField.grabFocus();
setVisible(true);
}
代码示例来源:origin: wildfly/wildfly
if(cmd != null && !cmd.isEmpty()) {
send(txtField.getText());
txtField.selectAll();
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
/**
* Set the text on the input line.
* @param text the new text
*/
public void setInputText(final String text) {
textField.setText(text);
textField.selectAll();
}
代码示例来源:origin: stackoverflow.com
KeyboardFocusManager.getCurrentKeyboardFocusManager()
.addPropertyChangeListener("permanentFocusOwner", new PropertyChangeListener()
{
public void propertyChange(final PropertyChangeEvent e)
{
if (e.getNewValue() instanceof JTextField)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
JTextField textField = (JTextField)e.getNewValue();
textField.selectAll();
}
});
}
}
});
代码示例来源:origin: org.netbeans.api/org-openide-awt
@Override
public void mouseClicked(MouseEvent e) {
if( e.getClickCount() == 1 ) {
if( null != txtLocation.getSelectedText()
|| txtLocation.isFocusOwner() )
return;
txtLocation.selectAll();
}
}
代码示例来源:origin: ron190/jsql-injection
/**
* Select all textfield content when focused.
*/
public static void addTextFieldShortcutSelectAll() {
KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(
"permanentFocusOwner",
propertyChangeEvent -> {
if (propertyChangeEvent.getNewValue() instanceof JTextField) {
SwingUtilities.invokeLater(() -> {
JTextField textField = (JTextField) propertyChangeEvent.getNewValue();
textField.selectAll();
});
}
}
);
}
代码示例来源:origin: nodebox/nodebox
private void showNumberField() {
numberField.setText(valueAsString());
numberField.setVisible(true);
numberField.requestFocus();
numberField.selectAll();
componentResized(null);
repaint();
}
代码示例来源:origin: ron190/jsql-injection
MediatorGui.panelAddressBar().getTextFieldAddress().selectAll();
this.wasAltDPressed[0] = true;
代码示例来源:origin: apache/activemq-artemis
public void actionPerformed(ActionEvent e) {
String cmd=e.getActionCommand();
if(cmd != null && cmd.length() > 0) {
send(txtField.getText());
txtField.selectAll();
}
}
});
内容来源于网络,如有侵权,请联系作者删除!