javax.swing.JEditorPane.getText()方法的使用及代码示例

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

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

JEditorPane.getText介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

public void openFile(File file) {
 String encoding = (classifier == null) ? "utf-8" : classifier.flags.inputEncoding;
 String text = IOUtils.slurpFileNoExceptions(file.getPath(), encoding);
 System.out.println(text);
 editorPane.setContentType("text/plain");
 editorPane.setText(text);
 System.out.println(editorPane.getText());
 loadedFile = file;
 redraw();
 saveUntagged.setEnabled(true);
}

代码示例来源:origin: stanfordnlp/CoreNLP

public void saveUntaggedContents(File file) {
 try {
  String contents;
  if (editorPane.getContentType().equals("text/html")) {
   contents = editorPane.getText();
  } else {
   Document doc = editorPane.getDocument();
   contents = doc.getText(0, doc.getLength());
  }
  saveFile(file, contents);
  saveUntagged.setEnabled(true);
  loadedFile = file;
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: stanfordnlp/CoreNLP

private void saveUntaggedContents(File file) {
 try {
  String contents;
  if (editorPane.getContentType().equals("text/html")) {
   contents = editorPane.getText();
  } else {
   Document doc = editorPane.getDocument();
   contents = doc.getText(0, doc.getLength());
  }
  saveFile(file, contents);
  saveUntagged.setEnabled(true);
  loadedFile = file;
 } catch (Exception e) {
  throw new RuntimeException(e);
 }
}

代码示例来源:origin: stanfordnlp/CoreNLP

public void redraw() {
 String text = editorPane.getText();
 taggedContents = null;
 untaggedContents = null;
 if (!editorPane.getContentType().equals("text/html")) {
  editorPane.setContentType("text/rtf");
  Document doc = editorPane.getDocument();
  try {
   doc.insertString(0, text, defaultAttrSet);
  } catch (Exception e) {
   throw new RuntimeException(e);
  }
  editorPane.revalidate();
  editorPane.repaint();
  editorPane.setEditable(true);
  htmlContents = null;
 } else {
  editorPane.setEditable(false);
  htmlContents = editorPane.getText();
 }
 saveUntagged.setEnabled(false);
 saveTaggedAs.setEnabled(false);
}

代码示例来源:origin: stanfordnlp/CoreNLP

String text = editorPane.getText();
taggedContents = null;
if (!editorPane.getContentType().equals("text/html")) {
} else {
 editorPane.setEditable(false);
 htmlContents = editorPane.getText();

代码示例来源:origin: stanfordnlp/CoreNLP

editorPane.repaint();
} else {
 untaggedContents = editorPane.getText();
 taggedContents = classifier.classifyWithInlineXML(untaggedContents);

代码示例来源:origin: stanfordnlp/CoreNLP

editorPane.repaint();
} else {
 String untaggedContents = editorPane.getText();
 if (untaggedContents == null) { untaggedContents = ""; }
 taggedContents = classifier.classifyWithInlineXML(untaggedContents);

代码示例来源:origin: magefree/mage

public String getPastedData() {
    return txtDeckList.getText();
  }
}

代码示例来源:origin: magefree/mage

public void addMissingCards(Set<String> missingCards) {
  this.missingCards = missingCards;
  String missingCardsStr = "";
  boolean found = false;
  if (this.missingCards != null) {
    for (String card : this.missingCards) {
      found = true;
      missingCardsStr = missingCardsStr + card + "\n";
    }
  }
  if (found == false) {
    missingCardsStr = "\n\nNote: Leave blank to see your missing card names!\n";
  }
  txtDeckList.setText(txtDeckList.getText() + "\n\nYour missing card images are:\n" + missingCardsStr);
}

代码示例来源:origin: magefree/mage

private void onOK() {
  BufferedWriter bw = null;
  try {
    File temp = File.createTempFile("cbimportdeck", ".txt");
    bw = new BufferedWriter(new FileWriter(temp));
    bw.write(txtDeckList.getText());
    tmpPath = temp.getPath();
  } catch (IOException e) {
    e.printStackTrace();
  } finally {
    StreamUtils.closeQuietly(bw);
  }
  dispose();
}

代码示例来源:origin: magefree/mage

private void onOK() {
  BufferedWriter bw = null;
  try {
    File temp = File.createTempFile("import_images_from_url", ".txt");
    bw = new BufferedWriter(new FileWriter(temp));
    bw.write(txtDeckList.getText());
    tmpPath = temp.getPath();
  } catch (IOException e) {
    e.printStackTrace();
  } finally {
    StreamUtils.closeQuietly(bw);
  }
  dispose();
}

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

final String htmlText = pane.getText();
final String plainText = extractText(new StringReader(htmlText));
return new MyTransferable(plainText, htmlText);

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

_lenght = jta.getText().length();
try {
  doc.insertString(cp, s, mas);

代码示例来源:origin: omegat-org/omegat

@Override
  public void actionPerformed(ActionEvent e) {
    result = panel.editorPane.getText();
    dialog.dispose();
  }
});

代码示例来源:origin: dcaoyuan/nbscala

public String getCondition() {
  if (conditionCheckBox.isSelected()) {
    return tfCondition.getText().trim();
  } else {
    return "";
  }
}

代码示例来源:origin: net.sf.squirrel-sql.plugins/hibernate

private void onCopyCmndToClip()
{
 if(null == _dialog.txtCommand.getText())
 {
   return;
 }
 Clipboard clip = Toolkit.getDefaultToolkit().getSystemClipboard();
 StringSelection data = new StringSelection(_dialog.txtCommand.getText().trim());
 clip.setContents(data, data);
}

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

private void txtRowCountFocusLost(java.awt.event.FocusEvent evt) {// GEN-FIRST:event_txtRowCountFocusLost
  if (selectedSource != null && !txtQueryEditor.getText().isEmpty()) {
    executeQuery();
    txtClassUriTemplate.requestFocus();
  }
}// GEN-LAST:event_txtRowCountFocusLost

代码示例来源:origin: omegat-org/omegat

private void updatePattern(EditingPanel panel) {
  try {
    result = Pattern.compile(panel.editorPane.getText());
    panel.helpText.setText(null);
    panel.helpText.setToolTipText(null);
    panel.okButton.setEnabled(true);
  } catch (PatternSyntaxException ex) {
    panel.helpText.setText(ex.getLocalizedMessage());
    panel.helpText.setToolTipText(ex.getLocalizedMessage());
    panel.okButton.setEnabled(false);
  }
}

代码示例来源:origin: igvteam/igv

protected Transferable createTransferable(JComponent c) {
  final JEditorPane pane = (JEditorPane) c;
  final String htmlText = pane.getText();
  final String plainText = extractText(new StringReader(htmlText));
  return new MyTransferable(plainText, htmlText);
}

代码示例来源:origin: robo-code/robocode

public void doReplaceAll() {
    EditWindow currentWindow = editor.getActiveWindow();

    if (currentWindow == null || getFindTextField().getText().length() == 0) {
      // launch error dialog?
      return;
    }
    JEditorPane editorPane = currentWindow.getEditorPane();
    String text = editorPane.getText();

    String replacement = getReplaceTextField().getText();

    editorPane.setText(getCurrentPattern().matcher(text).replaceAll(replacement));
  }
}

相关文章

JEditorPane类方法