本文整理了Java中javax.swing.JTextArea.getCaret()
方法的一些代码示例,展示了JTextArea.getCaret()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.getCaret()
方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:getCaret
暂无
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea();
DefaultCaret caret = (DefaultCaret)textArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea();
DefaultCaret caret = (DefaultCaret)textArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea();
DefaultCaret caret = (DefaultCaret)textArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
DialogTranslate.this.textToTranslate[0].getCaret().setVisible(true);
DialogTranslate.this.textToTranslate[0].getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: winder/Universal-G-Code-Sender
private void checkScrollWindow() {
// Console output.
DefaultCaret caret = (DefaultCaret)consoleTextArea.getCaret();
if (scrollWindowCheckBox.isSelected()) {
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
consoleTextArea.setCaretPosition(consoleTextArea.getDocument().getLength());
} else {
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
}
// Command table.
this.commandTable.setAutoWindowScroll(scrollWindowCheckBox.isSelected());
}
代码示例来源:origin: ron190/jsql-injection
@Override
public void focusGained(FocusEvent arg0) {
JPopupTextArea.this.getProxy().getCaret().setVisible(true);
JPopupTextArea.this.getProxy().getCaret().setSelectionVisible(true);
}
});
代码示例来源:origin: winder/Universal-G-Code-Sender
private void checkScrollWindow() {
// Console output.
DefaultCaret caret = (DefaultCaret)consoleTextArea.getCaret();
if (scrollWindowMenuItem.isSelected()) {
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
consoleTextArea.setCaretPosition(consoleTextArea.getDocument().getLength());
} else {
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
}
}
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Makes the caret's dot and mark the same location so that, for the
* next search in the specified direction, a match will be found even
* if it was within the original dot and mark's selection.
*
* @param textArea The text area.
* @param forward Whether the search will be forward through the
* document (<code>false</code> means backward).
* @return The new dot and mark position.
*/
private static int makeMarkAndDotEqual(JTextArea textArea,
boolean forward) {
Caret c = textArea.getCaret();
int val = forward ? Math.min(c.getDot(), c.getMark()) :
Math.max(c.getDot(), c.getMark());
c.setDot(val);
return val;
}
代码示例来源:origin: ron190/jsql-injection
I18nView.addComponentForKey("NETWORK_TAB_PARAMS_LABEL", labelConsolvbne);
DefaultCaret caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_RESPONSE.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_SOURCE.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_PREVIEW.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_HEADER.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_PARAM.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
caret = (DefaultCaret) PanelConsoles.NETWORK_TAB_URL.getCaret();
caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
代码示例来源:origin: bobbylight/RSyntaxTextArea
Caret c = textArea.getCaret();
boolean forward = context.getSearchForward();
int start = forward ? Math.max(c.getDot(), c.getMark()) :
textArea.getCaret().setSelectionVisible(true);
if (forward && start>-1) {
result.getMatchRange().translate(start);
代码示例来源:origin: org.apache.uima/uimaj-tools
/**
* Sets the text no title.
*
* @param text the new text no title
*/
// Set the text.
public void setTextNoTitle(String text) {
this.textArea.setText(text);
this.textArea.getCaret().setDot(0);
this.isDirty = false;
}
代码示例来源:origin: sebbrudzinski/Open-LaTeX-Studio
@Override
public void componentOpened() {
DefaultCaret caret = (DefaultCaret) jTextArea1.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
}
代码示例来源:origin: stackoverflow.com
JTextArea textArea = new JTextArea();
DefaultCaret caret = (DefaultCaret)textArea.getCaret();
caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
<br>
scrollPane = new JScrollPane();
scrollPane.add(textArea);
scrollPane.setViewportView(textArea);
</br>
代码示例来源:origin: mucommander/mucommander
/**
* Appends the specified string to the shell output area.
* @param s string to append to the shell output area.
*/
private void addToTextArea(String s) {
outputTextArea.append(s);
outputTextArea.setCaretPosition(outputTextArea.getText().length());
outputTextArea.getCaret().setVisible(true);
outputTextArea.repaint();
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects
private void showUsage(Generator generator) {
// Look up the Rails directory and read the USAGE file, then stick
// it into the usageText.
String usage = generator.getUsage(project);
if (usage != null) {
usageText.setText(usage);
usageText.getCaret().setDot(0);
} else {
usageText.setText("");
}
}
代码示例来源:origin: org.apache.uima/uimaj-tools
@Override
public void focusGained(FocusEvent e) {
// Need to make the caret visible when gaining focus. Sometimes this happens automatically, but
// not always. Not sure if there is a better way to do this.
this.main.getTextArea().getCaret().setVisible(true);
}
代码示例来源:origin: jcoplien/trygve
@Override public int getSelectionEnd() {
final Caret caret = super.getCaret();
if (null == caret) {
setCaret(new DefaultCaret());
}
final int end = null == caret? 0: Math.max(caret.getDot(), caret.getMark());
return end;
}
}
代码示例来源:origin: org.apache.uima/uimaj-tools
@Override
public void actionPerformed(ActionEvent arg0) {
Point caretPos = this.main.getTextArea().getCaret().getMagicCaretPosition();
if (caretPos == null) {
// No idea why this is needed. Bug in JTextArea, or my poor understanding of the magics of
// carets. The point is null when the text area is first focused.
this.main.showTextPopup(0, 0);
} else {
this.main.showTextPopup(caretPos.x, caretPos.y);
}
}
代码示例来源:origin: JGillam/burp-paramalyzer
@Override
public void actionPerformed(ActionEvent e) {
ParamInstance pi = paramListModel.getParamInstance(listValues.getSelectedIndex());
if (pi != null) {
Caret caret = textAreaRequest.getCaret();
caret.setSelectionVisible(true);
caret.setDot(pi.getValueStart());
caret.moveDot(pi.getValueEnd());
}
}
});
代码示例来源:origin: org.jenkins-ci/executable-war
/**
* Forces the scroll of text area.
*/
private void scrollDown() {
int pos = textArea.getDocument().getEndPosition().getOffset();
textArea.getCaret().setDot(pos);
textArea.requestFocus();
}
}
内容来源于网络,如有侵权,请联系作者删除!