use of javax.swing.JEditorPane in project tika by apache.
the class TikaGUI method textDialog.
private void textDialog(String title, URL resource) {
try {
JDialog dialog = new JDialog(this, title);
JEditorPane editor = new JEditorPane(resource);
editor.setContentType("text/html");
editor.setEditable(false);
editor.setBackground(Color.WHITE);
editor.setPreferredSize(new Dimension(400, 250));
editor.addHyperlinkListener(this);
dialog.add(editor);
dialog.pack();
dialog.setVisible(true);
} catch (IOException e) {
e.printStackTrace();
}
}
use of javax.swing.JEditorPane in project tika by apache.
the class TikaGUI method handleError.
private void handleError(String name, Throwable t) {
StringWriter writer = new StringWriter();
writer.append("Apache Tika was unable to parse the document\n");
writer.append("at " + name + ".\n\n");
writer.append("The full exception stack trace is included below:\n\n");
t.printStackTrace(new PrintWriter(writer));
JEditorPane editor = new JEditorPane("text/plain", writer.toString());
editor.setEditable(false);
editor.setBackground(Color.WHITE);
editor.setCaretPosition(0);
editor.setPreferredSize(new Dimension(600, 400));
JDialog dialog = new JDialog(this, "Apache Tika error");
dialog.add(new JScrollPane(editor));
dialog.pack();
dialog.setVisible(true);
}
use of javax.swing.JEditorPane in project tika by apache.
the class TikaGUI method addCard.
private JEditorPane addCard(JPanel panel, String type, String name) {
JEditorPane editor = new JTextPane();
editor.setBackground(Color.WHITE);
editor.setContentType(type);
editor.setTransferHandler(new ParsingTransferHandler(editor.getTransferHandler(), this));
panel.add(new JScrollPane(editor), name);
return editor;
}
use of javax.swing.JEditorPane in project enclojure by EricThorsen.
the class ClojureToolTipAnnotation method run.
public void run() {
LOG.log(Level.FINEST, "ClojureTooltip: run");
// 1) get tooltip text
Line.Part lp = (Line.Part) getAttachedAnnotatable();
JEditorPane ep = Utils.getCurrentEditor();
String textForTooltip = "";
if ((lp == null) || (ep == null)) {
return;
}
// first try EL
String text = Utils.getELIdentifier(doc, ep, NbDocument.findLineOffset(doc, lp.getLine().getLineNumber()) + lp.getColumn());
LOG.log(Level.FINEST, "JspToClojureTooltipoltip: ELIdentifier = " + text);
boolean isScriptlet = Utils.isScriptlet(doc, ep, NbDocument.findLineOffset(doc, lp.getLine().getLineNumber()) + lp.getColumn());
LOG.log(Level.FINEST, "isScriptlet: " + isScriptlet);
// if not, try Java
if ((text == null) && (isScriptlet)) {
text = Utils.getJavaIdentifier(doc, ep, NbDocument.findLineOffset(doc, lp.getLine().getLineNumber()) + lp.getColumn());
textForTooltip = text;
LOG.log(Level.FINEST, "ClojureTooltip: javaIdentifier = " + text);
if (text == null) {
return;
}
} else {
if (text == null) {
return;
}
textForTooltip = text;
String textEscaped = org.openide.util.Utilities.replaceString(text, "\"", "\\\"");
text = "pageContext.getExpressionEvaluator().evaluate(\"" + textEscaped + "\", java.lang.String.class, (javax.servlet.jsp.PageContext)pageContext, null)";
}
LOG.log(Level.FINEST, "JspTooltip: fullWatch = " + text);
// 3) obtain text representation of value of watch
String old = toolTipText;
toolTipText = null;
DebuggerEngine currentEngine = DebuggerManager.getDebuggerManager().getCurrentEngine();
if (currentEngine == null)
return;
JPDADebugger d = (JPDADebugger) currentEngine.lookupFirst(null, JPDADebugger.class);
if (d == null)
return;
try {
Variable v = d.evaluate(text);
if (v instanceof ObjectVariable) {
toolTipText = textForTooltip + " = (" + v.getType() + ")" + ((ObjectVariable) v).getToStringValue();
} else {
toolTipText = textForTooltip + " = (" + v.getType() + ")" + v.getValue();
}
} catch (InvalidExpressionException e) {
toolTipText = text + " = >" + e.getMessage() + "<";
}
LOG.log(Level.FINEST, "ClojureTooltip: " + toolTipText);
firePropertyChange(PROP_SHORT_DESCRIPTION, old, toolTipText);
}
use of javax.swing.JEditorPane in project vcell by virtualcell.
the class MathDebuggerPanel method getStatusEditorPane.
/**
* This method initializes statusEditorPane
*
* @return javax.swing.JEditorPane
*/
private JEditorPane getStatusEditorPane() {
if (statusEditorPane == null) {
statusEditorPane = new JEditorPane();
statusEditorPane.setMinimumSize(new Dimension(33, 100));
statusEditorPane.setPreferredSize(new Dimension(1500, 100));
statusEditorPane.setMaximumSize(new Dimension(2147483647, 100));
}
return statusEditorPane;
}
Aggregations