本文整理汇总了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);
}
});
}
示例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;
}
示例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);
}
示例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;
}