当前位置: 首页>>代码示例>>Java>>正文


Java TerminalSize.ZERO属性代码示例

本文整理汇总了Java中com.googlecode.lanterna.TerminalSize.ZERO属性的典型用法代码示例。如果您正苦于以下问题:Java TerminalSize.ZERO属性的具体用法?Java TerminalSize.ZERO怎么用?Java TerminalSize.ZERO使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.googlecode.lanterna.TerminalSize的用法示例。


在下文中一共展示了TerminalSize.ZERO属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPreferredSize

@Override
public TerminalSize getPreferredSize(List<Component> components) {
    TerminalSize preferredSize = TerminalSize.ZERO;
    if(components.isEmpty()) {
        return preferredSize.withRelative(
                leftMarginSize + rightMarginSize,
                topMarginSize + bottomMarginSize);
    }

    Component[][] table = buildTable(components);
    table = eliminateUnusedRowsAndColumns(table);

    //Figure out each column first, this can be done independently of the row heights
    int preferredWidth = 0;
    int preferredHeight = 0;
    for(int width: getPreferredColumnWidths(table)) {
        preferredWidth += width;
    }
    for(int height: getPreferredRowHeights(table)) {
        preferredHeight += height;
    }
    preferredSize = preferredSize.withRelative(preferredWidth, preferredHeight);
    preferredSize = preferredSize.withRelativeColumns(leftMarginSize + rightMarginSize + (table[0].length - 1) * horizontalSpacing);
    preferredSize = preferredSize.withRelativeRows(topMarginSize + bottomMarginSize + (table.length - 1) * verticalSpacing);
    return preferredSize;
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:26,代码来源:GridLayout.java

示例2: updateScreen

@Override
public synchronized void updateScreen() throws IOException {
    TerminalSize minimumTerminalSize = TerminalSize.ZERO;
    for(Window window: windows) {
        if(window.getHints().contains(Window.Hint.FULL_SCREEN) ||
                window.getHints().contains(Window.Hint.FIT_TERMINAL_WINDOW)) {
            //Don't take full screen windows or auto-sized windows into account
            continue;
        }
        TerminalPosition lastPosition = window.getPosition();
        minimumTerminalSize = minimumTerminalSize.max(
                //Add position to size to get the bottom-right corner of the window
                window.getPreferredSize().withRelative(lastPosition.getColumn(), lastPosition.getRow()));
    }
    virtualScreen.setMinimumSize(minimumTerminalSize);
    super.updateScreen();
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:17,代码来源:MultiWindowTextGUI.java

示例3: AnimatedLabel

public AnimatedLabel(String firstFrameText) {
    super(firstFrameText);
    frames = new ArrayList<String[]>();
    currentFrame = 0;
    combinedMaximumPreferredSize = TerminalSize.ZERO;

    String[] lines = splitIntoMultipleLines(firstFrameText);
    frames.add(lines);
    ensurePreferredSize(lines);
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:10,代码来源:AnimatedLabel.java

示例4: getPreferredSize

@Override
public TerminalSize getPreferredSize(Border component) {
    StandardBorder border = (StandardBorder)component;
    Component wrappedComponent = border.getComponent();
    TerminalSize preferredSize;
    if (wrappedComponent == null) {
        preferredSize = TerminalSize.ZERO;
    } else {
        preferredSize = wrappedComponent.getPreferredSize();
    }
    preferredSize = preferredSize.withRelativeColumns(2).withRelativeRows(2);
    String borderTitle = border.getTitle();
    return preferredSize.max(new TerminalSize((borderTitle.isEmpty() ? 2 : borderTitle.length() + 4), 2));
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:14,代码来源:Borders.java

示例5: AbstractComponent

public AbstractComponent() {
    size = TerminalSize.ZERO;
    position = TerminalPosition.TOP_LEFT_CORNER;
    explicitPreferredSize = null;
    layoutData = null;
    invalid = true;
    parent = null;
    renderer = null; //Will be set on the first call to getRenderer()
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:9,代码来源:AbstractComponent.java

示例6: getPreferredSize

@Override
public TerminalSize getPreferredSize(List<Component> components) {
    TerminalSize size = TerminalSize.ZERO;
    for(Component component: components) {
        size = size.max(
                new TerminalSize(
                        component.getPosition().getColumn() + component.getSize().getColumns(),
                        component.getPosition().getRow() + component.getSize().getRows()));
                
    }
    return size;
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:12,代码来源:AbsoluteLayout.java

示例7: Label

public Label(String text) {
    this.lines = null;
    this.preferredSize = TerminalSize.ZERO;
    this.foregroundColor = null;
    this.backgroundColor = null;
    this.additionalStyles = EnumSet.noneOf(SGR.class);
    setText(text);
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:8,代码来源:Label.java

示例8: getBounds

protected TerminalSize getBounds(String[] lines, TerminalSize currentBounds) {
    if(currentBounds == null) {
        currentBounds = TerminalSize.ZERO;
    }
    currentBounds = currentBounds.withRows(lines.length);
    int preferredWidth = 0;
    for(String line: lines) {
        int lineWidth = CJKUtils.getTrueWidth(line);
        if(preferredWidth < lineWidth) {
            preferredWidth = lineWidth;
        }
    }
    currentBounds = currentBounds.withColumns(preferredWidth);
    return currentBounds;
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:15,代码来源:Label.java

示例9: getSize

public TerminalSize getSize() {
    if (lookupMap.length==0) { return TerminalSize.ZERO; }
    return new TerminalSize(lookupMap[0].length, lookupMap.length);
}
 
开发者ID:Truth0906,项目名称:lanterna,代码行数:4,代码来源:InteractableLookupMap.java


注:本文中的com.googlecode.lanterna.TerminalSize.ZERO属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。