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); }
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); } }
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); } }
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); }
editorPane.repaint(); } else { untaggedContents = editorPane.getText(); taggedContents = classifier.classifyWithInlineXML(untaggedContents);
editorPane.repaint(); } else { String untaggedContents = editorPane.getText(); if (untaggedContents == null) { untaggedContents = ""; } taggedContents = classifier.classifyWithInlineXML(untaggedContents);
public String getPastedData() { return txtDeckList.getText(); } }
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); }
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(); }
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(); }
final String htmlText = pane.getText(); final String plainText = extractText(new StringReader(htmlText)); return new MyTransferable(plainText, htmlText);
_lenght = jta.getText().length(); try { doc.insertString(cp, s, mas);
@Override public void actionPerformed(ActionEvent e) { result = panel.editorPane.getText(); dialog.dispose(); } });
public String getCondition() { if (conditionCheckBox.isSelected()) { return tfCondition.getText().trim(); } else { return ""; } }
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
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); } }
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); }
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)); } }