コード例 #1
0
ファイル: Border.java プロジェクト: ForNeVeR/lanterna
    @Override
    public void drawBorder(TextGraphics graphics, TerminalSize actualSize, String title) {
      graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.Border));
      final int width = actualSize.getColumns();
      final int height = actualSize.getRows();

      // Top
      graphics.drawString(0, 0, ACS.ULCORNER + "");
      for (int x = 1; x < width - 1; x++) graphics.drawString(x, 0, ACS.HLINE + "");
      graphics.drawString(width - 1, 0, ACS.URCORNER + "");

      // Each row
      for (int i = 1; i < height - 1; i++) {
        graphics.drawString(0, i, ACS.VLINE + "");
        graphics.drawString(0 + width - 1, i, ACS.VLINE + "");
      }

      // Bottom
      graphics.drawString(0, height - 1, ACS.LLCORNER + "");
      for (int x = 1; x < width - 1; x++) graphics.drawString(x, height - 1, ACS.HLINE + "");
      graphics.drawString(width - 1, height - 1, ACS.LRCORNER + "");

      // Write the title
      graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.DialogArea));
      graphics.setBoldMask(true);
      graphics.drawString(2, 0, title);
    }
コード例 #2
0
ファイル: Border.java プロジェクト: ForNeVeR/lanterna
    @Override
    public void drawBorder(TextGraphics graphics, TerminalSize actualSize, String title) {
      final int width = actualSize.getColumns();
      final int height = actualSize.getRows();
      final Theme.Definition upperLeft;
      final Theme.Definition lowerRight;

      if (raised) {
        upperLeft = graphics.getTheme().getDefinition(Theme.Category.RaisedBorder);
        lowerRight = graphics.getTheme().getDefinition(Theme.Category.Border);
      } else {
        upperLeft = graphics.getTheme().getDefinition(Theme.Category.Border);
        lowerRight = graphics.getTheme().getDefinition(Theme.Category.RaisedBorder);
      }

      // Top
      graphics.applyTheme(upperLeft);
      graphics.drawString(0, 0, ACS.ULCORNER + "");
      for (int i = 1; i < width - 1; i++) graphics.drawString(i, 0, ACS.HLINE + "");
      graphics.applyTheme(lowerRight);
      graphics.drawString(width - 1, 0, ACS.URCORNER + "");

      // Each row
      for (int i = 1; i < height - 1; i++) {
        graphics.applyTheme(upperLeft);
        graphics.drawString(0, i, ACS.VLINE + "");
        graphics.applyTheme(lowerRight);
        graphics.drawString(width - 1, i, ACS.VLINE + "");
      }

      // Bottom
      graphics.applyTheme(upperLeft);
      graphics.drawString(0, height - 1, ACS.LLCORNER + "");
      graphics.applyTheme(lowerRight);
      for (int i = 1; i < width - 1; i++) graphics.drawString(i, height - 1, ACS.HLINE + "");
      graphics.drawString(width - 1, height - 1, ACS.LRCORNER + "");

      // Write the title
      graphics.applyTheme(graphics.getTheme().getDefinition(Theme.Category.DialogArea));
      graphics.setBoldMask(true);
      graphics.drawString(2, 0, title);
    }