Package charva.awt

Examples of charva.awt.Point


  if (_titleColor == null)
      _titleColor = component_.getForeground();

  int colorpair = Color.getCursesColor(_titleColor, background);
  if (_title.length() != 0) {
      Point origin = new Point(x_, y_);
      toolkit.setCursor(origin.addOffset(1,0));
      toolkit.addChar(' ', 0, colorpair);
      toolkit.addString(_title, 0, colorpair);
      toolkit.addChar(' ', 0, colorpair);
  }
    }
View Full Code Here


   */
  super.requestFocus();

  /* Get the absolute origin of this component
   */
  Point origin = getLocationOnScreen();

  /* Calculate the x position of the cursor
   */
  int x=1;
  for (int i=0; i<_currentColumn; i++) {
      x += getColumnWidth(i) + 1;
  }

  /* Ensure that the new cursor position is not off the screen (which
   * it can be if the JTable is in a JViewport).
   */
  Point newCursor = origin.addOffset(x, _currentRow+1);
  if (newCursor.x < 0)
      newCursor.x = 0;
  if (newCursor.y < 0)
      newCursor.y = 0;
  Toolkit.getDefaultToolkit().setCursor(newCursor);
View Full Code Here

    }

    public void draw(Toolkit toolkit) {
  /* Get the absolute origin of this component.
   */
  Point origin = getLocationOnScreen();

  int rows = _model.getRowCount();
  int columns = _model.getColumnCount();
  int colorpair = getCursesColor();

  /* Start by blanking out the table area and drawing the box
   * around the table.
   */
  toolkit.blankBox(origin, getSize(), colorpair);
  toolkit.drawBox(origin, getSize(), colorpair);

  /* Now fill in the table headings
   */
  int x = 1;
  int attr = Toolkit.A_BOLD;
  for (int i=0; i<columns; i++) {
      toolkit.setCursor(origin.addOffset(x, 0));
      toolkit.addChar(' ', attr, colorpair);
      toolkit.addString(_model.getColumnName(i), attr, colorpair);
      toolkit.addChar(' ', attr, colorpair);
      x += getColumnWidth(i) + 1;
  }

  /* Now draw the vertical lines that divide the columns.
   */
  if (_model.getColumnCount() != 0) {
      x = getColumnWidth(0) + 1;
      for (int i=0; i<columns-1; i++) {
    toolkit.setCursor(origin.addOffset(x, 0));
    toolkit.addChar(Toolkit.ACS_TTEE, 0, colorpair);      // top tee
    toolkit.setCursor(origin.addOffset(x, 1));
    toolkit.addVerticalLine(rows, 0, colorpair);
    toolkit.setCursor(origin.addOffset(x, rows+1));
    toolkit.addChar(Toolkit.ACS_BTEE, 0, colorpair);      // bottom tee
    x += getColumnWidth(i+1) + 1;
      }
  }

  /* Now draw the contents of the cells.
   */
  x = 1;
  for (int column = 0; column<columns; column++) {
      for (int row=0; row<rows; row++) {
    toolkit.setCursor(origin.addOffset(x, row+1));
    Object value = _model.getValueAt(row, column);

    /* Show the currently SELECTED rows and columns in reverse video
     */
    int attrib =
View Full Code Here

    int x=0;
    for (int i=0; i<_currentColumn; i++)
        x += getColumnWidth(i) + 1;
    evtqueue.postEvent(
        new ScrollEvent(this, ScrollEvent.DOWN,
      new Point(x, _currentRow+1)));
      }
  }
  else if (key == KeyEvent.VK_DOWN) {
      if (_currentRow == _model.getRowCount() - 1)
    term.beep();
      else {
    _currentRow++;
    int x=0;
    for (int i=0; i<_currentColumn; i++)
        x += getColumnWidth(i) + 1;
    evtqueue.postEvent(
        new ScrollEvent(this, ScrollEvent.UP,
      new Point(x, _currentRow+2)));
      }
  }
  else if (key == KeyEvent.VK_LEFT) {
      if (_currentColumn == 0)
    term.beep();
      else {
    _currentColumn--;
    int x=0;
    for (int i=0; i<_currentColumn; i++)
        x += getColumnWidth(i) + 1;
    evtqueue.postEvent(
        new ScrollEvent(this, ScrollEvent.RIGHT,
      new Point(x, _currentRow)));
      }
  }
  else if (key == KeyEvent.VK_RIGHT) {
      if (_currentColumn == _model.getColumnCount() - 1)
    term.beep();
      else {
    _currentColumn++;
    int x=0;
    for (int i=0; i<=_currentColumn; i++)
        x += getColumnWidth(i) + 1;
    evtqueue.postEvent(
        new ScrollEvent(this, ScrollEvent.LEFT,
      new Point(x, _currentRow)));
      }
  }
  else if (key == KeyEvent.VK_HOME) {
      int x=0;
      for (int i=0; i<_currentColumn; i++)
    x += getColumnWidth(i) + 1;
      evtqueue.postEvent(
        new ScrollEvent(this, ScrollEvent.RIGHT,
      new Point(x, _currentRow)));
  }
  else if (key == KeyEvent.VK_END) {
      int x=0;
      for (int i=0; i<=_currentColumn; i++)
    x += getColumnWidth(i) + 1;
      evtqueue.postEvent(
        new ScrollEvent(this, ScrollEvent.LEFT,
      new Point(x, _currentRow)));
  }
  else if (key == KeyEvent.VK_ENTER) {
      if (getColumnSelectionAllowed())
    selectCurrentColumn();
View Full Code Here

    public void draw(Toolkit toolkit)
    {
  /* Get the absolute origin of this component.
   */
  Point origin = getLocationOnScreen();

  toolkit.setCursor(origin);

  StringBuffer buf = new StringBuffer();
  for (int i=0; i<getSize().width; i++) {
View Full Code Here

    public void draw(Toolkit toolkit) {

  /* Get the absolute origin of this component.
   */
  Point origin = getLocationOnScreen();

  int colorpair = getCursesColor();

  if (super._enabled) {
      int offset = _value * (_length-2) / _maximum;
      int visible = _extent * (_length-2) / _maximum;
      visible = (visible == 0) ? 1 : visible;

      if (_orientation == Adjustable.VERTICAL) {
    toolkit.setCursor(origin);
    toolkit.addChar('^', Toolkit.A_REVERSE, colorpair);
    for (int k=1; k<_length-1; k++) {
        toolkit.setCursor(origin.addOffset(0, k));
        toolkit.addChar(Toolkit.ACS_CKBOARD, 0, colorpair);
    }
    toolkit.setCursor(origin.addOffset(0, _length-1));
    toolkit.addChar('v', Toolkit.A_REVERSE, colorpair);

    for (int i=0; i< visible; i++) {
        toolkit.setCursor(origin.addOffset(0, 1+offset+i));
        toolkit.addChar(' ', Toolkit.A_REVERSE, colorpair);
    }
      }
      else {
    toolkit.setCursor(origin);
    toolkit.addChar('<', Toolkit.A_REVERSE, colorpair);
    for (int k=1; k<_length-1; k++) {
        toolkit.setCursor(origin.addOffset(k,0));
        toolkit.addChar(Toolkit.ACS_CKBOARD, 0, colorpair);
    }
    toolkit.setCursor(origin.addOffset(_length-1, 0));
    toolkit.addChar('>', Toolkit.A_REVERSE, colorpair);

    for (int i=0; i< visible; i++) {
        toolkit.setCursor(origin.addOffset(1+offset+i, 0));
        toolkit.addChar(' ', Toolkit.A_REVERSE, colorpair);
    }
      }
  }
    }
View Full Code Here

   */
  super.requestFocus();

  /* Get the absolute origin of this component.
   */
  Point origin = getLocationOnScreen();
  int offset = _value * (_length-2) / _maximum;
  Toolkit.getDefaultToolkit().setCursor(origin.addOffset(1+offset, 0));
    }
View Full Code Here

    public void draw(Toolkit toolkit) {

  /* Get the absolute origin of this Viewport
   */
  Point origin = getLocationOnScreen();

  toolkit.setClipRect(new Rectangle(origin, getExtentSize()));
  _child.draw(toolkit);
  toolkit.resetClipRect();
    }
View Full Code Here

                    int sri = setData(s, "/" + n);
                    int dir = _currentRow < sri ? ScrollEvent.UP : ScrollEvent.DOWN;
                    if (sri > -1)
                        _currentRow = sri;
                    setSelectedIndex(_currentRow);
                    evtqueue.postEvent(new ScrollEvent(this, dir, new Point(0, _currentRow)));
                    ke.consume();
                } else if (keyCode == KeyEvent.VK_HOME) {
                    _currentRow = 0;
                    evtqueue.postEvent(new ScrollEvent(
                        this, ScrollEvent.DOWN, new Point(0, _currentRow)));
                }
                super.processKeyEvent(ke);
                if (keyCode == KeyEvent.VK_UP ||
                    keyCode == KeyEvent.VK_DOWN ||
                    keyCode == KeyEvent.VK_PAGE_UP ||
View Full Code Here

                    }
                    int dir = _currentRow < index ? ScrollEvent.UP : ScrollEvent.DOWN;
                    _currentRow = index;
                    setSelectedIndex(_currentRow);
                    Toolkit.getDefaultToolkit().getSystemEventQueue().
                        postEvent(new ScrollEvent(this, dir, new Point(0, _currentRow)));
                }
            }
View Full Code Here

TOP

Related Classes of charva.awt.Point

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.