當前位置: 首頁>>代碼示例>>Java>>正文


Java View.X_AXIS屬性代碼示例

本文整理匯總了Java中javax.swing.text.View.X_AXIS屬性的典型用法代碼示例。如果您正苦於以下問題:Java View.X_AXIS屬性的具體用法?Java View.X_AXIS怎麽用?Java View.X_AXIS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.text.View的用法示例。


在下文中一共展示了View.X_AXIS屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPreferredSpan

@Override
public float getPreferredSpan(int axis) {
    if (axis == View.X_AXIS) {
        String desc = fold.getDescription(); // For empty desc a single-space text layout is returned
        float advance = 0;
        if (desc.length() > 0) {
            TextLayout textLayout = getTextLayout();
            if (textLayout == null) {
                return 0f;
            }
            advance = textLayout.getAdvance();
        }
        return advance + (2 * EXTRA_MARGIN_WIDTH);
    } else {
        EditorView.Parent parent = (EditorView.Parent) getParent();
        return (parent != null) ? parent.getViewRenderContext().getDefaultRowHeight() : 0f;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:FoldView.java

示例2: getBreakWeight

@Override
public int getBreakWeight(int axis, float pos, float len) {
    // return GoodBreakWeight;
    if (axis == View.X_AXIS) {
        checkPainter();
        int p0 = getStartOffset();
        int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos,
                len);
        if (p1 == p0) {
            // can't even fit a single character
            return View.BadBreakWeight;
        }
        try {
            // if the view contains line break char return forced break
            if (getDocument().getText(p0, p1 - p0)
                    .indexOf(WrapHTMLFactory.SEPARATOR) >= 0) {
                return View.ForcedBreakWeight;
            }
        } catch (BadLocationException ex) {
            // should never happen
        }
        
    }
    return super.getBreakWeight(axis, pos, len);
}
 
開發者ID:Jamling,項目名稱:SmartQQ4IntelliJ,代碼行數:25,代碼來源:WrapHTMLFactory.java

示例3: breakView

public View breakView(int axis, int p0, float pos, float len) {
    if (axis == View.X_AXIS) {
        checkPainter();
        int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos,
                len);
        try {
            // if the view contains line break char break the view
            int index = getDocument().getText(p0, p1 - p0)
                    .indexOf(WrapHTMLFactory.SEPARATOR);
            if (index >= 0) {
                GlyphView v = (GlyphView) createFragment(p0,
                        p0 + index + 1);
                return v;
            }
        } catch (BadLocationException ex) {
            // should never happen
        }
        
    }
    return super.breakView(axis, p0, pos, len);
}
 
開發者ID:Jamling,項目名稱:SmartQQ4IntelliJ,代碼行數:21,代碼來源:WrapHTMLFactory.java

示例4: selectLayoutMajorAxis

public ViewLayoutState selectLayoutMajorAxis(int majorAxis) {
//        assert ViewUtilities.isAxisValid(majorAxis);

        if (majorAxis == View.X_AXIS) {
            setStatusBits(X_MAJOR_AXIS_BIT);
        } else { // y axis
            clearStatusBits(X_MAJOR_AXIS_BIT);
        }
        
        return this;
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:DrawEngineLineView.java

示例5: getPreferredSpan

@Override
public float getPreferredSpan(int axis) {
    EditorView.Parent parent = (EditorView.Parent) getParent();
    if (axis == View.X_AXIS) {
        float advance = 0;
        TextLayout textLayout = getTextLayout();
        if (textLayout == null) {
            return 0f;
        }
        return textLayout.getAdvance();
    } else {
        return (parent != null) ? parent.getViewRenderContext().getDefaultRowHeight() : 0f;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:SkipLinesViewFactory.java

示例6: axisToString

public static String axisToString(int axis) {
    switch (axis) {
        case View.X_AXIS:
            return "x"; // NOI18N
            
        case View.Y_AXIS:
            return "y"; // NOI18N
            
        default:
            return "<invalid-axis-value=" + axis + ">"; // NOI18N
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ViewUtilitiesImpl.java

示例7: GapBoxView

/**
 * Construct a composite box view over the given element.
 *
 * @param elem the element of the model to represent.
 * @param majorAxis the axis to tile along.  This can be
 *  either X_AXIS or Y_AXIS.
 */
public GapBoxView(Element elem, int majorAxis) {
    super(elem);

    if (majorAxis == View.X_AXIS) {
        setStatusBits(X_MAJOR_AXIS_BIT);
    } // by default there should be no bits set
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:GapBoxView.java

示例8: selectLayoutMajorAxis

public ViewLayoutState selectLayoutMajorAxis(int axis) {
//        assert ViewUtilities.isAxisValid(axis);

        if (axis == View.X_AXIS) {
            setStatusBits(X_MAJOR_AXIS_BIT);
        } else { // y axis
            clearStatusBits(X_MAJOR_AXIS_BIT);
        }
        
        return this;
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:SimpleViewLayoutState.java

示例9: isAxisValid

/**
 * Test whether the axis is valid.
 *
 * @param axis integer axis
 * @return true if the axis is either <code>View.X_AXIS</code>
 *  or <code>View.Y_AXIS</code>. False is returned otherwise.
 */
public static boolean isAxisValid(int axis) {
    switch (axis) {
        case View.X_AXIS:
        case View.Y_AXIS:
            return true;
    }
    
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:ViewUtilities.java

示例10: getPreferredSpan

@Override
public float getPreferredSpan(int axis) {
    // Since this may be called e.g. from BasicTextUI.getPreferredSize()
    // this method needs to acquire mutex
    if (lock()) {
        try {
            checkDocumentLockedIfLogging(); // Should only be called with read-locked document
            op.checkViewsInited();
            // Ensure the width and height are updated before unlock() gets called (which is too late)
            op.checkRealSpanChange();
            if (!op.isChildrenValid()) {
                return 1f; // Return 1f until parent and etc. gets initialized
            }
            float span;
            if (axis == View.X_AXIS) {
                span = preferredWidth;
            } else { // Y_AXIS
                span = preferredHeight + op.getExtraVirtualHeight();
            }
            return span;
        } finally {
            unlock();
        }
    } else {
        return 1f;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:DocumentView.java

示例11: getPreferredSpan

@Override
public float getPreferredSpan(int axis) {
    TextLayout textLayout = getTextLayout();
    if (textLayout == null) {
        return 0f;
    }
    float span = (axis == View.X_AXIS)
        ? textLayout.getAdvance()
        : TextLayoutUtils.getHeight(textLayout);
    return span;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:11,代碼來源:HighlightsViewPart.java

示例12: getPreferredSpan

@Override
public float getPreferredSpan(int axis) {
    DocumentView docView = getDocumentView();
    return (axis == View.X_AXIS)
        ? width // Return last width computed by getTabbedSpan()
        : ((docView != null) ? docView.op.getDefaultRowHeight() : 0f);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:TabView.java

示例13: getMajorAxis

protected final int getMajorAxis() {
    return isXMajorAxis() ? View.X_AXIS : View.Y_AXIS;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:DrawEngineLineView.java

示例14: getMinorAxis

protected final int getMinorAxis() {
    return isXMajorAxis() ? View.Y_AXIS : View.X_AXIS;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:3,代碼來源:DrawEngineLineView.java

示例15: getLayoutStateMajorAxis

protected final int getLayoutStateMajorAxis() {
    return (isStatusBitsNonZero(LAYOUT_STATE_X_MAJOR_AXIS_BIT))
        ? View.X_AXIS 
        : View.Y_AXIS;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:GapBoxView.java


注:本文中的javax.swing.text.View.X_AXIS屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。