本文整理了Java中javax.swing.JTextField.replaceSelection()
方法的一些代码示例,展示了JTextField.replaceSelection()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.replaceSelection()
方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:replaceSelection
暂无
代码示例来源:origin: org.databene/databene-commons
@Override
public void actionPerformed(ActionEvent e) {
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable t = clipboard.getContents(null);
if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
try {
String data = (String) t.getTransferData(DataFlavor.stringFlavor);
textField.replaceSelection(data);
} catch (Exception e1) {
LOGGER.error("Paste failed", e1);
}
}
}
代码示例来源:origin: omegat-org/omegat
private void initGui() {
panel = new ViewOptionsPanel();
panel.templateActivator.addActionListener(e -> updateEnabledness());
panel.viewSourceAllBold.addActionListener(e -> updateEnabledness());
panel.variablesList
.setModel(new DefaultComboBoxModel<>(new Vector<>(ModificationInfoManager.getModInfoVariables())));
panel.variablesListND.setModel(
new DefaultComboBoxModel<>(new Vector<>(ModificationInfoManager.getModInfoVariablesNoDate())));
panel.insertButton.addActionListener(
e -> panel.modInfoTemplate.replaceSelection(panel.variablesList.getSelectedItem().toString()));
panel.insertButtonND.addActionListener(
e -> panel.modInfoTemplateND.replaceSelection(panel.variablesListND.getSelectedItem().toString()));
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public void replaceSelection(String _s) {
boolean b = true;
for (int i = 0; i < _s.length(); i++)
b &= isCharValid(_s.charAt(i));
if (b) super.replaceSelection(_s);
else
getToolkit().beep();
}
内容来源于网络,如有侵权,请联系作者删除!