javax.swing.JTextArea.modelToView()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中javax.swing.JTextArea.modelToView()方法的一些代码示例,展示了JTextArea.modelToView()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextArea.modelToView()方法的具体详情如下:
包路径:javax.swing.JTextArea
类名称:JTextArea
方法名:modelToView

JTextArea.modelToView介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Rectangle viewRect = textArea.modelToView(pos);

代码示例来源:origin: bobbylight/RSyntaxTextArea

r = textArea.modelToView(start);
if (r==null) { // Not yet visible; i.e. JUnit tests
  return;
  r = r.union(textArea.modelToView(end));

代码示例来源:origin: edu.illinois.lis/indri

/** Keeps the message pane showing the last line appended. */
private void ensureMessagesVisible() {
int len = messages.getText().length();
try {
  messages.scrollRectToVisible(messages.modelToView(len));
} catch (javax.swing.text.BadLocationException ex) {
  // don't care.
}
}

代码示例来源:origin: stackoverflow.com

public JTextArea createTextAreaFitToText(String message, Dimension minimalSize){

    JTextArea aMessagePanel = new JTextArea();
    aMessagePanel.setText(message);

    /*for modelToView to work, the text area has to be sized. It doesn't matter if it's visible or not.*/
    aMessagePanel.setPreferredSize(minimalSize);
    aMessagePanel.setSize(minimalSize);            

    Rectangle r = aMessagePanel.modelToView(aMessagePanel.getDocument().getLength()); 

    Dimension d = new Dimension(minimalSize.width, r.y + r.height);
    aMessagePanel.setPreferredSize(d);
    return aMessagePanel;

}

代码示例来源:origin: edu.illinois.lis/indri

public void status(int code, String documentFile, String error, 
      int documentsIndexed, int documentsSeen) {
  if (code == action_code.FileOpen.swigValue()) {
  messages.append("Documents: " + documentsIndexed + "\n");
  messages.append("Opened " + documentFile + "\n");
  } else if (code == action_code.FileSkip.swigValue()) {
  messages.append("Skipped " + documentFile + "\n");
  } else if (code == action_code.FileError.swigValue()) {
  messages.append("Error in " + documentFile + " : " + error + 
      "\n");
  } else if (code == action_code.DocumentCount.swigValue()) {
  if( (documentsIndexed % 500) == 0)
    messages.append( "Documents: " + documentsIndexed + "\n" );
  }
  int len = messages.getText().length();
  try {
  messages.scrollRectToVisible(messages.modelToView(len));
  } catch (javax.swing.text.BadLocationException ex) {
  // don't care.
  }
}
}

代码示例来源:origin: net.sf.mmax2/mmax2

try
  inputTextArea.scrollRectToVisible(inputTextArea.modelToView(inputTextArea.getLineEndOffset(inputTextArea.getLineCount())));
  inputTextArea.setCaretPosition(inputTextArea.getLineEndOffset(inputTextArea.getLineCount()));

代码示例来源:origin: com.fifesoft/rsyntaxtextarea

r = textArea.modelToView(start);
if (r==null) { // Not yet visible; i.e. JUnit tests
  return;
  r = r.union(textArea.modelToView(end));

相关文章

JTextArea类方法