Java Code Examples for javax.swing.JEditorPane#getText()
The following examples show how to use
javax.swing.JEditorPane#getText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSingleMethodSupport.java From netbeans with Apache License 2.0 | 6 votes |
public static boolean canHandle(Node activatedNode) { FileObject fileO = org.netbeans.modules.gsf.testrunner.ui.api.UICommonUtils.getFileObjectFromNode(activatedNode); if (fileO != null) { final EditorCookie ec = activatedNode.getLookup().lookup(EditorCookie.class); if (ec != null) { JEditorPane pane = Mutex.EVENT.readAccess(new Mutex.Action<JEditorPane>() { @Override public JEditorPane run() { return NbDocument.findRecentEditorPane(ec); } }); if (pane != null) { String text = pane.getText(); int index = text.indexOf("public"); //NOI18N if (index != -1) { if (text.substring(0, index).contains("org.testng.")) { //NOI18N return true; } } } } } return false; }
Example 2
Source File: DefaultDiffControllerProviderTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testTextualDiffContent () throws Exception { File diffFile = new File(getDataDir(), "enhancedview/diff"); String goldenText = getFileContents(diffFile); goldenText = MessageFormat.format(goldenText, new Object[] {"a/", "b/"}); final JTabbedPane tabbedPane = findTabbedPane(enhanced.getJComponent()); JPanel p = (JPanel) tabbedPane.getComponentAt(1); tabbedPane.setSelectedIndex(1); JEditorPane pane = findEditorPane(p); assertFalse(pane == null); String text = pane.getText(); for (int i = 0; i < 100; ++i) { if (!text.isEmpty()) { break; } Thread.sleep(100); text = pane.getText(); } assertEquals(goldenText, text); EventQueue.invokeAndWait(new Runnable() { @Override public void run () { tabbedPane.setSelectedIndex(0); } }); }
Example 3
Source File: ObjectivePanel.java From triplea with GNU General Public License v3.0 | 6 votes |
EditorPaneCellEditor() { super(new JTextField()); final JEditorPane textArea = new JEditorPane(); textArea.setEditable(false); textArea.setContentType("text/html"); final JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setBorder(null); editorComponent = scrollPane; delegate = new DefaultCellEditor.EditorDelegate() { private static final long serialVersionUID = 5746645959173385516L; @Override public void setValue(final Object value) { textArea.setText((value != null) ? value.toString() : ""); } @Override public Object getCellEditorValue() { return textArea.getText(); } }; }
Example 4
Source File: TestSingleMethodSupport.java From netbeans with Apache License 2.0 | 5 votes |
public static boolean canHandle(Node activatedNode) { FileObject fileO = org.netbeans.modules.gsf.testrunner.ui.api.UICommonUtils.getFileObjectFromNode(activatedNode); if (fileO != null) { final EditorCookie ec = activatedNode.getLookup().lookup(EditorCookie.class); if (ec != null) { JEditorPane pane = Mutex.EVENT.readAccess(new Mutex.Action<JEditorPane>() { @Override public JEditorPane run() { return NbDocument.findRecentEditorPane(ec); } }); if (pane != null) { String text = pane.getText(); if (text != null) { //NOI18N text = text.replaceAll("\n", "").replaceAll(" ", ""); if ((text.contains("@RunWith") || text.contains("@org.junit.runner.RunWith")) //NOI18N && text.contains("Parameterized.class)")) { //NOI18N return false; } } SingleMethod sm = getTestMethod(pane.getDocument(), pane.getCaret().getDot()); if(sm != null) { return true; } } } } return false; }
Example 5
Source File: CslTestBase.java From netbeans with Apache License 2.0 | 5 votes |
protected void toggleComment(String text, String expected) throws Exception { JEditorPane pane = getPane(text); runKitAction(pane, "toggle-comment", ""); String toggled = pane.getText(); assertEquals(expected, toggled); }
Example 6
Source File: FlutterProjectStepFixture.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Nullable public String getErrorMessage() { Component comp = robot().finder().findByName("ValidationText"); if (comp instanceof JEditorPane) { JEditorPane label = (JEditorPane)comp; return label.getText(); } return null; }
Example 7
Source File: UpdateProgressBarMetaRefreshSupport.java From stendhal with GNU General Public License v2.0 | 5 votes |
@Override public void propertyChange(PropertyChangeEvent event) { browser = (JEditorPane) event.getSource(); String html = browser.getText(); if (parseHtml(html)) { Thread thread = new Thread(this, "UpdateProgressBar"); thread.setDaemon(true); thread.start(); } }
Example 8
Source File: ClassMemberPanel.java From jeddict with Apache License 2.0 | 5 votes |
private String getCode(String code, String title) { JEditorPane editorPane = new JEditorPane(); editorPane.setContentType("text/x-java"); editorPane.setPreferredSize(new java.awt.Dimension(600, 400)); editorPane.setText(code); OptionDialog dialog = new OptionDialog(editorPane, title); dialog.setVisible(true); if (OK_OPTION == dialog.getDialogResult()) { return editorPane.getText(); } else { return code; } }