当前位置: 首页>>代码示例>>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;未经允许,请勿转载。