当前位置: 首页>>代码示例>>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;未经允许,请勿转载。