本文整理匯總了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;
}