本文整理了Java中javax.swing.JTextPane.getText()
方法的一些代码示例,展示了JTextPane.getText()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextPane.getText()
方法的具体详情如下:
包路径:javax.swing.JTextPane
类名称:JTextPane
方法名:getText
暂无
代码示例来源:origin: zzz40500/GsonFormat
public void actionPerformed(ActionEvent e) {
String json = editTP.getText();
json = json.trim();
if (json.startsWith("{")) {
JSONObject jsonObject = new JSONObject(json);
String formatJson = jsonObject.toString(4);
editTP.setText(formatJson);
} else if (json.startsWith("[")) {
JSONArray jsonArray = new JSONArray(json);
String formatJson = jsonArray.toString(4);
editTP.setText(formatJson);
}
}
});
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* Opens a dialog and saves the output of the parser on the current
* text. If there is no current text, yell at the user and make
* them feel bad instead.
*/
public void saveOutput() {
if (textPane.getText().trim().length() == 0) {
JOptionPane.showMessageDialog(this, "No text to parse ", null,
JOptionPane.ERROR_MESSAGE);
return;
}
jfc.setDialogTitle("Save file");
int status = jfc.showSaveDialog(this);
if (status == JFileChooser.APPROVE_OPTION) {
saveOutput(jfc.getSelectedFile().getPath());
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* Finds the sentence delimited by the closest sentence delimiter preceding
* start and closest period following end. If end is less than start
* (or -1), sets right boundary as closest period following start.
* Actually starts search for preceding sentence delimiter at (start-1)
*/
private void highlightSentence(int start, int end) {
// clears highlight. paints over entire document because the document may have changed
highlightText(0, textPane.getText().length(), normalStyle);
// if start<1 set startIndex to 0, otherwise set to index following closest preceding period
startIndex = (start < 1) ? 0 : nearestDelimiter(textPane.getText(), start, SEEK_BACK) + 1;
// if end<startIndex, set endIndex to closest period following startIndex
// else, set it to closest period following end
endIndex = nearestDelimiter(textPane.getText(), (end < startIndex) ? startIndex : end, SEEK_FORWARD);
if (endIndex == -1) {
endIndex = textPane.getText().length() - 1;
}
highlightText(startIndex, endIndex, highlightStyle);
// enable/disable scroll buttons as necessary
backButton.setEnabled(startIndex != 0);
forwardButton.setEnabled(endIndex != textPane.getText().length() - 1);
parseNextButton.setEnabled(forwardButton.isEnabled() && parser != null);
}
代码示例来源:origin: stanfordnlp/CoreNLP
/**
* Tokenizes the highlighted text (using a tokenizer appropriate for the
* selected language, and initiates the ParseThread to parse the tokenized
* text.
*/
public void parse() {
if (textPane.getText().length() == 0) {
return;
}
// use endIndex+1 because substring subtracts 1
String text = textPane.getText().substring(startIndex, endIndex + 1).trim();
if (parser != null && text.length() > 0) {
//Tokenizer<? extends HasWord> toke = tlp.getTokenizerFactory().getTokenizer(new CharArrayReader(text.toCharArray()));
Tokenizer<? extends HasWord> toke = tlp.getTokenizerFactory().getTokenizer(new StringReader(text));
List<? extends HasWord> wordList = toke.tokenize();
parseThread = new ParseThread(wordList);
parseThread.start();
startProgressMonitor("Parsing", PARSE_TIME);
}
}
代码示例来源:origin: libgdx/libgdx
settings.setGlyphPageWidth(((Number)glyphPageWidthCombo.getSelectedItem()).intValue());
settings.setGlyphPageHeight(((Number)glyphPageHeightCombo.getSelectedItem()).intValue());
settings.setGlyphText(sampleTextPane.getText());
if (nativeRadio.isSelected())
settings.setRenderType(RenderType.Native.ordinal());
代码示例来源:origin: libgdx/libgdx
settings.setGlyphPageWidth(((Number)glyphPageWidthCombo.getSelectedItem()).intValue());
settings.setGlyphPageHeight(((Number)glyphPageHeightCombo.getSelectedItem()).intValue());
settings.setGlyphText(sampleTextPane.getText());
if (nativeRadio.isSelected())
settings.setRenderType(RenderType.Native.ordinal());
代码示例来源:origin: zzz40500/GsonFormat
private void onOK() {
switch (type) {
case OBJECT_FROM_DATA:
Config.getInstant().saveObjectFromDataStr(editTP.getText());
break;
case OBJECT_FROM_DATA1:
Config.getInstant().saveObjectFromDataStr1(editTP.getText());
break;
case ARRAY_FROM_DATA:
Config.getInstant().saveArrayFromDataStr(editTP.getText());
break;
case ARRAY_FROM_DATA1:
Config.getInstant().saveArrayFromData1Str(editTP.getText());
break;
}
dispose();
}
代码示例来源:origin: stanfordnlp/CoreNLP
String text = textPane.getText();
StringReader reader = new StringReader(text);
DocumentPreprocessor processor = new DocumentPreprocessor(reader);
代码示例来源:origin: zzz40500/GsonFormat
private void onOK() {
this.setAlwaysOnTop(false);
String jsonSTR = editTP.getText().trim();
if (TextUtils.isEmpty(jsonSTR)) {
return;
}
String generateClassName = generateClassTF.getText().replaceAll(" ", "").replaceAll(".java$", "");
if (TextUtils.isEmpty(generateClassName) || generateClassName.endsWith(".")) {
Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
return;
}
PsiClass generateClass = null;
if (!currentClass.equals(generateClassName)) {
generateClass = PsiClassUtil.exist(file, generateClassTF.getText());
} else {
generateClass = cls;
}
new ConvertBridge(this, jsonSTR, file, project, generateClass,
cls, generateClassName).run();
}
private void onCancel() {
代码示例来源:origin: stanfordnlp/CoreNLP
forwardButton.setEnabled(endIndex != textPane.getText().length() - 1);
代码示例来源:origin: libgdx/libgdx
String sampleText = sampleTextPane.getText();
代码示例来源:origin: libgdx/libgdx
String sampleText = sampleTextPane.getText();
代码示例来源:origin: pentaho/mondrian
return;
Query q = connection.parseQuery(queryTextPane.getText());
代码示例来源:origin: chatty/chatty
private void updateTestText() {
HighlightItem item = editingBlacklistItem ? blacklistItem : highlightItem;
boolean matches = item != null && item.matchesAny(testInput.getText(), null);
if (!matches && (testInput.getText().isEmpty() || testInput.getText().equals(prevTestText))) {
if (item != null) {
testInput.setText(TEST_PRESET_EXAMPLE+item.getTextWithoutPrefix());
} else {
testInput.setText(TEST_PRESET);
}
prevTestText = testInput.getText();
}
}
代码示例来源:origin: zzhang5/zooinspector
public void actionPerformed(ActionEvent e) {
if (selectedNode != null) {
if (JOptionPane.showConfirmDialog(NodeViewerData.this,
"Are you sure you want to save this node?" + " (this action cannot be reverted)",
"Confirm Save", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
zooInspectorManager.setData(selectedNode, dataArea.getText());
}
}
}
});
代码示例来源:origin: igniterealtime/Spark
public void keyReleased(KeyEvent e) {
if (e.getKeyChar() == KeyEvent.VK_ESCAPE) {
frame.dispose();
// Save it.
String text = pane.getText();
privateNotes.setNotes(text);
PrivateNotes.savePrivateNotes(privateNotes);
}
}
});
代码示例来源:origin: MegaMek/megamek
public void appendReportTab(String additionalText) {
int phaseTab = tabs.indexOfTab("Phase");
if (phaseTab > 0) {
JTextPane pane = ((JTextPane) ((JScrollPane) tabs.getComponentAt(phaseTab - 1)).getViewport().getView());
pane.setText(pane.getText() + "<pre>"+additionalText+"</pre>");
}
JTextPane pane = ((JTextPane) ((JScrollPane) tabs.getComponentAt(phaseTab)).getViewport().getView());
pane.setText(pane.getText() + "<pre>"+additionalText+"</pre>");
}
代码示例来源:origin: ontop/ontop
@Override
public void run() {
OBDADataQueryAction<?> action = QueryInterfacePanel.this.getRetrieveUCQUnfoldingAction();
action.run(queryTextPane.getText());
}
});
代码示例来源:origin: ontop/ontop
@Override
public void run() {
OBDADataQueryAction<?> action = QueryInterfacePanel.this.getRetrieveUCQExpansionAction();
action.run(queryTextPane.getText());
}
});
代码示例来源:origin: sonar-intellij-plugin/sonar-intellij-plugin
public LocalAnalysisScript toLocalAnalysisScript() {
return LocalAnalysisScript.of(
myNameTextField.getText(),
StringUtil.trimLeading(myScriptSourceTextPane.getText()),
myPathToSonarReportTextFieldWithBrowseButton.getText().trim()
);
}
内容来源于网络,如有侵权,请联系作者删除!