private void displayTsurgeonHelp() { if(tsurgeonHelpFrame != null) { tsurgeonHelpFrame.setVisible(true); } else { tsurgeonHelpFrame = new JFrame("TSurgeon Help..."); JEditorPane helpText = new JEditorPane(); helpText.setContentType("text/html"); // StringBuffer s = new StringBuffer(); // s.append(htmlTsurgeonHelp); helpText.setText(htmlTsurgeonHelp); helpText.setEditable(false); JScrollPane scroller = new JScrollPane(helpText); helpText.setCaretPosition(0); scroller.setPreferredSize(new Dimension(500,500)); tsurgeonHelpFrame.add(scroller); tsurgeonHelpFrame.pack(); tsurgeonHelpFrame.setBackground(Color.WHITE); tsurgeonHelpFrame.setVisible(true); } }
private void displayHelp() { if (helpFrame != null) { helpFrame.setVisible(true); } else { helpFrame = new JFrame("Tregex Help..."); //JPanel helpPanel = new JPanel(); JEditorPane helpText = new JEditorPane(); helpText.setContentType("text/html"); // StringBuffer s = new StringBuffer(); // s.append(htmlHelp); helpText.setText(htmlHelp); helpText.setEditable(false); //helpPanel.add(helpText); JScrollPane scroller = new JScrollPane(helpText); helpText.setCaretPosition(0); scroller.setPreferredSize(new Dimension(500,500)); helpFrame.add(scroller); helpFrame.pack(); helpFrame.setBackground(Color.WHITE); helpFrame.setVisible(true); //helpFrame.repaint(); } }
/** @see ListSelectionListener **/ public void valueChanged(ListSelectionEvent aEvent) { //Ignore extra messages. if (aEvent.getValueIsAdjusting()) { return; } final ListSelectionModel lsm = (ListSelectionModel) aEvent.getSource(); if (lsm.isSelectionEmpty()) { mDetails.setText("Nothing selected"); } else { final int selectedRow = lsm.getMinSelectionIndex(); final EventDetails e = mModel.getEventDetails(selectedRow); final Object[] args = { new Date(e.getTimeStamp()), e.getPriority(), escape(e.getThreadName()), escape(e.getNDC()), escape(e.getCategoryName()), escape(e.getLocationDetails()), escape(e.getMessage()), escape(getThrowableStrRep(e)) }; mDetails.setText(FORMATTER.format(args)); mDetails.setCaretPosition(0); } }
private void setText(JEditorPane editor, String text) { editor.setText(text); editor.setCaretPosition(0); }
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); }
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == EventType.ACTIVATED) { try { URL url = e.getURL(); try (InputStream stream = url.openStream()) { JEditorPane editor = new JEditorPane("text/plain", IOUtils.toString(stream, UTF_8)); editor.setEditable(false); editor.setBackground(Color.WHITE); editor.setCaretPosition(0); editor.setPreferredSize(new Dimension(600, 400)); String name = url.toString(); name = name.substring(name.lastIndexOf('/') + 1); JDialog dialog = new JDialog(this, "Apache Tika: " + name); dialog.add(new JScrollPane(editor)); dialog.pack(); dialog.setVisible(true); } } catch (IOException exception) { exception.printStackTrace(); } } }
@Override public void run() { jEditorPane.setCaretPosition(0); } });
public void actionPerformed(ActionEvent e) { String newScript = FileTools.readStringFromFile(BeanshellConfigView.this, "Load Beanshell script", ".bsh"); if (newScript != null) { scriptTextArea.setText(newScript); scriptTextArea.setCaretPosition(0); } } });
private void showRenderJSONResponse(String response) { results.setContentType("text/plain"); // $NON-NLS-1$ results.setText(response == null ? "" : prettyJSON(response)); results.setCaretPosition(0); resultsScrollPane.setViewportView(results); }
@Override public void actionPerformed(ActionEvent e) { try { CursorUtil.setCursorBusy(DTipOfTheDay.this); jepTip.setText(getPreviousTip()); jepTip.setCaretPosition(0); } finally { CursorUtil.setCursorFree(DTipOfTheDay.this); } } });
@Override public void actionPerformed(ActionEvent e) { try { CursorUtil.setCursorBusy(DTipOfTheDay.this); jepTip.setText(getNextTip()); jepTip.setCaretPosition(0); } finally { CursorUtil.setCursorFree(DTipOfTheDay.this); } } });
private void showTextResponse(String response) { results.setContentType("text/plain"); // $NON-NLS-1$ results.setText(response == null ? "" : response); // $NON-NLS-1$ results.setCaretPosition(0); resultsScrollPane.setViewportView(results); // Bug 55111 - Refresh JEditor pane size depending on the presence or absence of scrollbars resultsScrollPane.setPreferredSize(resultsScrollPane.getMinimumSize()); results.revalidate(); }
private void updateCaretPos(KeyEvent e) { if (getEditor().getCaretPosition() <= startPos) { getEditor().setCaretPosition(startPos); if (e == null) { return; } if (e.getKeyCode() == KeyEvent.VK_LEFT || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { e.consume(); } } }
private void showDocumentResponse(SampleResult sampleResult) { String response = Document.getTextFromDocument(sampleResult.getResponseData()); results.setContentType("text/plain"); // $NON-NLS-1$ results.setText(response); results.setCaretPosition(0); resultsScrollPane.setViewportView(results); }
private void updateEditor(String text) { ApplicationManager.getApplication().assertIsDispatchThread(); if (editor == null) { panel.removeAll(); editor = createEditor(); panel.add(editor, BorderLayout.CENTER); } SwingHelper.setHtml(editor, text, null); editor.setCaretPosition(0); panel.revalidate(); }
public void setCredits(String credits, String contentType) { if(credits != null) { ggCredits.setContentType(contentType); } ggCredits.setText(credits != null?credits:""); ggCredits.setCaretPosition(0); scrollCredits.setVisible(credits != null); packAndCenter(); }
private void prevMacroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prevMacroActionPerformed Document doc = jCodeExpansionEditorPane.getDocument(); if (doc == null) { return; } int offset = CsmMacroExpansion.getPrevMacroExpansionStartOffset(doc, jCodeExpansionEditorPane.getCaretPosition()); if (offset >= 0 && offset < doc.getLength()) { jCodeExpansionEditorPane.setCaretPosition(offset); } }//GEN-LAST:event_prevMacroActionPerformed
public int showDialog(Component parent, String title, String text) { returnValue = CLOSE_OPTION; rapportPane.setText(text); dialog = new JDialogModel(parent, TEXT_TITLE + " " + title, this, new Action[] { closeAction }, closeAction); dialog.setResizable(true); rapportPane.setCaretPosition(0); dialog.showDialog(); dialog.dispose(); return returnValue; }
public void panelActivate() { super.panelActivate(); String nextText = getString("SummaryPanel.next"); if (nextText == null) { nextText = getString("installer.next"); } parent.getNavigator().setNextText(nextText); textArea.setText(SummaryProcessor.getSummary(this.installData)); textArea.setCaretPosition(0); }
@Override public void run() { final SHTMLPanel htmlEditorPanel = getHtmlEditorPanel(); htmlEditorPanel.getMostRecentFocusOwner().requestFocus(); if (ResourceController.getResourceController().getBooleanProperty("goto_note_end_on_edit")) { final JEditorPane editorPane = htmlEditorPanel.getEditorPane(); editorPane.setCaretPosition(editorPane.getDocument().getLength()); } } });