javax.swing.JTextPane#getUI ( )源码实例Demo

下面列出了javax.swing.JTextPane#getUI ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: VCSHyperlinkSupport.java
public void computeBounds(JTextPane textPane, BoundsTranslator translator) {
    Rectangle tpBounds = textPane.getBounds();
    TextUI tui = textPane.getUI();
    this.bounds = new Rectangle[length];
    for (int i = 0; i < length; i++) {
        try {
            Rectangle startr = tui.modelToView(textPane, docstart[i], Position.Bias.Forward);
            Rectangle endr = tui.modelToView(textPane, docend[i], Position.Bias.Backward);
            if (startr == null || endr == null) {
                continue;
            }
            startr = startr.getBounds();
            endr = endr.getBounds();
            this.bounds[i] = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height);
            //NOTE the textPane is positioned within a parent panel so the origin has to be modified too
            if (null != translator) {
                translator.correctTranslation(textPane, this.bounds[i]);
            }
        } catch (BadLocationException ex) { }
    }
}
 
源代码2 项目: netbeans   文件: VCSHyperlinkSupport.java
public void computeBounds(JTextPane textPane, BoundsTranslator translator) {
    Rectangle tpBounds = textPane.getBounds();
    TextUI tui = textPane.getUI();
    this.bounds = new Rectangle();
    try {
        Rectangle startr = tui.modelToView(textPane, docstart, Position.Bias.Forward).getBounds();
        Rectangle endr = tui.modelToView(textPane, docend, Position.Bias.Backward).getBounds();
        if(kenaiUser.getIcon() != null) {
            endr.x += kenaiUser.getIcon().getIconWidth();
        }
        this.bounds = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height);
        
        if (null != translator) {
            translator.correctTranslation(textPane, this.bounds);
        }
    } catch (BadLocationException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
源代码3 项目: netbeans   文件: TooltipWindow.java
@Override
public void computeBounds (JTextPane textPane) {
    Rectangle tpBounds = textPane.getBounds();
    TextUI tui = textPane.getUI();
    this.bounds = new Rectangle();
    try {
        Rectangle startr = tui.modelToView(textPane, docstart, Position.Bias.Forward).getBounds();
        Rectangle endr = tui.modelToView(textPane, docend, Position.Bias.Backward).getBounds();
        this.bounds = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height);
    } catch (BadLocationException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
源代码4 项目: netbeans   文件: TooltipWindow.java
@Override
public void computeBounds (JTextPane textPane) {
    Rectangle tpBounds = textPane.getBounds();
    TextUI tui = textPane.getUI();
    this.bounds = new Rectangle();
    try {
        Rectangle startr = tui.modelToView(textPane, docstart, Position.Bias.Forward).getBounds();
        Rectangle endr = tui.modelToView(textPane, docend, Position.Bias.Backward).getBounds();
        this.bounds = new Rectangle(tpBounds.x + startr.x, startr.y, endr.x - startr.x, startr.height);
    } catch (BadLocationException ex) {
        Exceptions.printStackTrace(ex);
    }
}