javax.swing.text.JTextComponent.getVisibleRect()方法的使用及代码示例

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

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

JTextComponent.getVisibleRect介绍

暂无

代码示例

代码示例来源:origin: abbot/abbot

@Override
  public Rectangle call() throws BadLocationException {
    return tc.getVisibleRect();
  }
};

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInCurrentThread
private static boolean isRectangleVisible(@Nonnull JTextComponent textBox, @Nonnull Rectangle r) {
 Rectangle visible = textBox.getVisibleRect();
 return visible.contains(r.x, r.y);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

public void settingsChange(SettingsChangeEvent evt) {
  if (editorUI == null) // no long er active
    return;
  JTextComponent component = editorUI.getComponent();
  if (evt == null || component == null) return;
  String settingName = evt.getSettingName();
  if (settingName == null || SettingsNames.RENDERING_HINTS.equals(settingName)) {
    updateRenderingHints();
  }
  
  Class kitClass = evt.getKitClass();        
  if (Utilities.getKitClass(component) != kitClass){
    Rectangle rect = component.getVisibleRect();
    if (rect!=null && rect.width == 0){
      if (SwingUtilities.isEventDispatchThread()) {
        resize();
      } else {
        SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              resize();
            }
          }
        );
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Get position of the component extent. The (x, y) are set to (0, 0) if there's
* no viewport or (-x, -y) if there's one.
*/
public Rectangle getExtentBounds(Rectangle r) {
  if (r == null) {
    r = new Rectangle();
  }
  if (component != null) {
    JViewport port = getParentViewport();
    if (port != null) {
      Point p = port.getViewPosition();
      r.width = port.getWidth();
      r.height = port.getHeight();
      r.x = p.x;
      r.y = p.y;
    } else { // no viewport
      r.setBounds(component.getVisibleRect());
    }
  }
  return r;
}

代码示例来源:origin: net.java.abeille/abeille

/**
 * Get position of the component extent. The (x, y) are set to (0, 0) if
 * there's no viewport or (-x, -y) if there's one.
 */
public Rectangle getExtentBounds(Rectangle r) {
  if (r == null) {
    r = new Rectangle();
  }
  if (component != null) {
    JViewport port = getParentViewport();
    if (port != null) {
      Point p = port.getViewPosition();
      r.width = port.getWidth();
      r.height = port.getHeight();
      r.x = p.x;
      r.y = p.y;
    }
    else { // no viewport
      r.setBounds(component.getVisibleRect());
    }
  }
  return r;
}

代码示例来源:origin: de.sciss/syntaxpane

Container view = target.getParent();
Dimension wd = getSize();
wd.width = target.getVisibleRect().width;
Point loc = new Point(0, view.getHeight());
setSize(wd);

代码示例来源:origin: de.sciss/jsyntaxpane

Container view = target.getParent();
Dimension wd = getSize();
wd.width = target.getVisibleRect().width;
Point loc = new Point(0, view.getHeight());
setSize(wd);

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

if( _editor.getVisibleRect().contains( rectangle ) || rectangle == TEST_RECTANGLE )

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

if( _editor.getVisibleRect().contains( rectangle ) || rectangle == TEST_RECTANGLE )

相关文章

JTextComponent类方法