javax.swing.JTextArea.read()方法的使用及代码示例

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

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

JTextArea.read介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

private void scanScript(final StringReader reader) throws Exception {
  scriptPane.read(reader, null);
  reader.reset();

代码示例来源:origin: stackoverflow.com

try {
  reader = new FileReader(new File("Java.txt"));
  textArea.read(reader, null);
} catch (Exception e) {
  e.printStackTrace();

代码示例来源:origin: pentaho/mondrian

cdataTextArea.read(new StringReader((String) value), null);
} catch (Exception ex) {

代码示例来源:origin: pentaho/mondrian

cdataTextArea.read(new StringReader((String) value), null);
} catch (Exception ex) {

代码示例来源:origin: stackoverflow.com

public void loadFile(JTextArea area, String path, String file)
{
  try
  {
    area.read(new FileReader(path + file), "Default");
  }
  catch(IOException e)
  {
    e.printStackTrace();
  }
}

代码示例来源:origin: stackoverflow.com

JTextArea edit = new JTextArea(30, 60);
FileReader reader = new FileReader( "TextAreaLoad.txt" );
BufferedReader br = new BufferedReader(reader);
edit.read( br, null );
br.close();

代码示例来源:origin: stackoverflow.com

JTextArea textArea = new JTextArea(5, 20);
textArea.read(....);
JScrollPane scrollPane = new JScrollPane( textArea );

代码示例来源:origin: stackoverflow.com

JTextArea textArea = new JTextArea();
FileReader reader = new FileReader("D:/text1.txt");
textArea.read(reader, "Content of File");
reader.close();

代码示例来源:origin: stackoverflow.com

JTextArea textArea = new JTextArea(10, 20);
try (Reader myReader = new BufferedReader(new FileReader("Inventory.txt"))) {
  textArea.read(myReader, "Inventory");
} catch (IOException exp) {
  exp.printStackTrace();
}

代码示例来源:origin: stackoverflow.com

JTextArea textArea = new JTextArea();
textArea.read(new FileReader("input.txt"), "blah");

代码示例来源:origin: stackoverflow.com

BufferedReader reader = new BufferedReader(new InputStreamReader(in));
JTextArea area = new JTextArea(10, 50);
area.read(reader, null);

代码示例来源:origin: stackoverflow.com

JTextArea ta = new JTextArea();
try (BufferedReader br = new BufferedReader(new FileReader(new File("...")))) {
  ta.read(br, null);
} catch (IOException exp) {
  exp.printStackTrace();
}

代码示例来源:origin: stackoverflow.com

JTextArea ta = new JTextArea(10, 20);
ta.setEditable(false);
try (Reader reader = new FileReader( curDir + "/scripts/sysinfo.txt")) {
  ta.read(reader, "Some stuff");
} catch (IOException exp) {
  ta.append(exp.getMessage());
  exp.printStackTrace();
}
JOptionPane.showMessageDialog(null, new JScrollPane(ta), "System Information", JOptionPane.INFORMATION_MESSAGE);

代码示例来源:origin: mucommander/mucommander

void read(Reader reader) throws IOException {
  // Feed the file's contents to text area
  textArea.read(reader, null);
  // If there are more than one lines, there is a line separator
  lineSeparatorExists = textArea.getLineCount() > 1;
  // Move cursor to the top
  textArea.setCaretPosition(0);
}

代码示例来源:origin: us.ihmc/IHMCHumanoidBehaviors

private void readInFile(String fileName)
{
 try
 {
   FileReader r = new FileReader(fileName);
   textArea.read(r, null);
   r.close();
   currentFile = fileName;
   changed = false;
 }
 catch (IOException e)
 {
   Toolkit.getDefaultToolkit().beep();
   JOptionPane.showMessageDialog(this, "Editor can't find the file called " + fileName);
 }
}

代码示例来源:origin: us.ihmc/ihmc-humanoid-behaviors

private void readInFile(String fileName)
{
 try
 {
   FileReader r = new FileReader(fileName);
   textArea.read(r, null);
   r.close();
   currentFile = fileName;
   changed = false;
 }
 catch (IOException e)
 {
   Toolkit.getDefaultToolkit().beep();
   JOptionPane.showMessageDialog(this, "Editor can't find the file called " + fileName);
 }
}

代码示例来源:origin: chungkwong/MathOCR

public void valueChanged(ListSelectionEvent e){
    if(e.getValueIsAdjusting()){
      return;
    }
    try{
      helparea.read(new InputStreamReader(getClass().getResourceAsStream(path[((JList)e.getSource()).getSelectedIndex()]),"UTF-8"),"MathOCR.jar");
    }catch(Exception ex){
      ex.printStackTrace();
    }
  }
}

代码示例来源:origin: stackoverflow.com

FileReader reader;
   try {
     reader = new FileReader("Student.txt");
     BufferedReader br = new BufferedReader(reader); 
      JTextArea area = new JTextArea();
       area.read(br,null);
       br.close();
      area.requestFocus();
   } catch (FileNotFoundException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException ioe) {
     // TODO Auto-generated catch block
     ioe.printStackTrace();
   }

代码示例来源:origin: us.ihmc/ihmc-humanoid-behaviors

private void readInFile(String fileName)
{
 try
 {
   FileReader r = new FileReader(fileName);
   area.read(r, null);
   r.close();
   currentFile = fileName;
   setTitle(currentFile);
   changed = false;
 }
 catch (IOException e)
 {
   Toolkit.getDefaultToolkit().beep();
   JOptionPane.showMessageDialog(this, "Editor can't find the file called " + fileName);
 }
}

代码示例来源:origin: stackoverflow.com

public void drop(DropTargetDropEvent e) {
try {
  e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
  java.util.List list=(java.util.List)e.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
  File file=(File)list.get(0);
  JTextArea newTabTextArea=new JTextArea();
  DropTarget target=new DropTarget(newTabTextArea,this);
  newTabTextArea.read(new FileReader(file),null);
  newTabTextArea.setCaretPosition(0);
  tabbedPane2.add(add(newTabTextArea));
  int tabIndex=tabbedPane2.indexOfComponent(newTabTextArea);
  tabbedPane2.setSelectedIndex(tabIndex);
  tabbedPane2.setTitleAt(tabIndex,file.getName());
}
catch(Exception ex){}

相关文章

JTextArea类方法