javax.swing.text.JTextComponent.write()方法的使用及代码示例

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

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

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;

相关文章

JTextComponent类方法