本文整理了Java中javax.swing.text.JTextComponent.write()
方法的一些代码示例,展示了JTextComponent.write()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextComponent.write()
方法的具体详情如下:
包路径:javax.swing.text.JTextComponent
类名称:JTextComponent
方法名:write
暂无
代码示例来源:origin: ron190/jsql-injection
private void saveJTextComponent() {
JTextComponent textArea =
(JTextComponent) ((LightScrollPane) MediatorGui.tabResults().getSelectedComponent()).scrollPane.getViewport().getView();
if (textArea == null) {
return;
}
int returnVal = this.filechooser.showSaveDialog(MediatorGui.frame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = this.filechooser.getSelectedFile();
PreferencesUtil.set(this.filechooser.getCurrentDirectory().toString());
try (BufferedWriter fileOut = new BufferedWriter(new FileWriter(file))) {
textArea.write(fileOut);
} catch (IOException e) {
LOGGER.warn("Error writing to "+ file.getName(), e);
}
}
}
代码示例来源:origin: stackoverflow.com
edit.write( bw );
bw.close();
edit.setText("");
代码示例来源:origin: stackoverflow.com
textArea.write(new OutputStreamWriter(new FileOutputStream(file), "utf-8"));
Desktop.getDesktop().open(file);
} catch (UnsupportedEncodingException e) {
代码示例来源:origin: stackoverflow.com
public void actionPerformed(ActionEvent e) {
try (FileWriter fw = new FileWriter("textfile.txt")) {
ta.write(fw);
} catch (IOException ex) {
ex.printStackTrace();
代码示例来源:origin: stackoverflow.com
outFile = new BufferedWriter(new FileWriter(file));
textArea.write(outFile);
代码示例来源:origin: stackoverflow.com
edit.write( bw );
bw.close();
edit.setText("");
代码示例来源:origin: stackoverflow.com
try {
FileWriter w = new FileWriter(fileName);
area.write(w);
w.close();
currentFile = fileName;
内容来源于网络,如有侵权,请联系作者删除!