1. /*
  2. * @(#)BRView.java 1.7 00/02/02
  3. *
  4. * Copyright 1998-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.text.html;
  11. import javax.swing.text.*;
  12. /**
  13. * Processes the <BR> tag. In other words, forces a line break.
  14. *
  15. * @author Sunita Mani
  16. * @version 1.7 02/02/00
  17. */
  18. class BRView extends InlineView {
  19. /**
  20. * Creates a new view that represents a <BR> element.
  21. *
  22. * @param elem the element to create a view for
  23. */
  24. public BRView(Element elem) {
  25. super(elem);
  26. StyleSheet sheet = getStyleSheet();
  27. attr = sheet.getViewAttributes(this);
  28. }
  29. /**
  30. * Forces a line break.
  31. *
  32. * @return View.ForcedBreakWeight
  33. */
  34. public int getBreakWeight(int axis, float pos, float len) {
  35. if (axis == X_AXIS) {
  36. return ForcedBreakWeight;
  37. } else {
  38. return super.getBreakWeight(axis, pos, len);
  39. }
  40. }
  41. AttributeSet attr;
  42. }