629 super.setSize(width, height);
630 updateMetrics();
631 }
632
633 // --- TabExpander methods ------------------------------------------
634
635 /**
636 * Returns the next tab stop position after a given reference position.
637 * This implementation does not support things like centering so it
638 * ignores the tabOffset argument.
639 *
640 * @param x the current position >= 0
641 * @param tabOffset the position within the text stream
642 * that the tab occurred at >= 0.
643 * @return the tab stop, measured in points >= 0
644 */
645 public float nextTabStop(float x, int tabOffset) {
646 if (tabSize == 0) {
647 return x;
648 }
649 float ntabs = (x - tabBase) / tabSize;
650 return tabBase + ((ntabs + 1) * tabSize);
651 }
652
653 // --- local methods ------------------------------------------------
654
655 /**
656 * Repaint the region of change covered by the given document
657 * event. Damages the line that begins the range to cover
658 * the case when the insert/remove is only on one line.
659 * If lines are added or removed, damages the whole
660 * view. The longest line is checked to see if it has
661 * changed.
662 *
663 * @param changes the change information from the associated document
664 * @param a the current allocation of the view
665 * @param f the factory to use to rebuild if the view has children
666 * @since 1.4
667 */
668 protected void updateDamage(DocumentEvent changes, Shape a, ViewFactory f) {
669 Component host = getContainer();
|
629 super.setSize(width, height);
630 updateMetrics();
631 }
632
633 // --- TabExpander methods ------------------------------------------
634
635 /**
636 * Returns the next tab stop position after a given reference position.
637 * This implementation does not support things like centering so it
638 * ignores the tabOffset argument.
639 *
640 * @param x the current position >= 0
641 * @param tabOffset the position within the text stream
642 * that the tab occurred at >= 0.
643 * @return the tab stop, measured in points >= 0
644 */
645 public float nextTabStop(float x, int tabOffset) {
646 if (tabSize == 0) {
647 return x;
648 }
649 int ntabs = (int) ((x - tabBase) / tabSize);
650 return tabBase + ((ntabs + 1) * tabSize);
651 }
652
653 // --- local methods ------------------------------------------------
654
655 /**
656 * Repaint the region of change covered by the given document
657 * event. Damages the line that begins the range to cover
658 * the case when the insert/remove is only on one line.
659 * If lines are added or removed, damages the whole
660 * view. The longest line is checked to see if it has
661 * changed.
662 *
663 * @param changes the change information from the associated document
664 * @param a the current allocation of the view
665 * @param f the factory to use to rebuild if the view has children
666 * @since 1.4
667 */
668 protected void updateDamage(DocumentEvent changes, Shape a, ViewFactory f) {
669 Component host = getContainer();
|