當前位置: 首頁>>代碼示例>>Java>>正文


Java JEditorPane.getText方法代碼示例

本文整理匯總了Java中javax.swing.JEditorPane.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java JEditorPane.getText方法的具體用法?Java JEditorPane.getText怎麽用?Java JEditorPane.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JEditorPane的用法示例。


在下文中一共展示了JEditorPane.getText方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testTextualDiffContent

import javax.swing.JEditorPane; //導入方法依賴的package包/類
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);
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:DefaultDiffControllerProviderTest.java

示例2: canHandle

import javax.swing.JEditorPane; //導入方法依賴的package包/類
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;
  }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:TestSingleMethodSupport.java

示例3: toggleComment

import javax.swing.JEditorPane; //導入方法依賴的package包/類
protected void toggleComment(String text, String expected) throws Exception {
    JEditorPane pane = getPane(text);

    runKitAction(pane, "toggle-comment", "");

    String toggled = pane.getText();
    assertEquals(expected, toggled);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:CslTestBase.java

示例4: canHandle

import javax.swing.JEditorPane; //導入方法依賴的package包/類
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;
  }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:TestSingleMethodSupport.java


注:本文中的javax.swing.JEditorPane.getText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。