1. /**
  2. * <p>Copyright: Copyright (c) 2002-2004</p>
  3. * <p>Company: JavaResearch(http://www.javaresearch.org)</p>
  4. * <p>最后更新日期:2003年4月30日
  5. * @author cherami
  6. */
  7. package org.jr.swing;
  8. import javax.swing.*;
  9. import java.awt.*;
  10. /**
  11. * 具有显示属性的文本行。
  12. * @since 0.6
  13. */
  14. public class TextLine implements SwingConstants{
  15. public final String text;
  16. public final Color color;
  17. public final int align;
  18. public final Font font;
  19. /**
  20. * 以指定的文本构造一个TextLine。
  21. * @param text 文本
  22. */
  23. public TextLine(String text) {
  24. this(text,UIManager.getColor("Label.textForeground"),LEFT,UIManager.getFont("Label.font"));
  25. }
  26. /**
  27. * 以指定的文本以及前景色构造一个TextLine。
  28. * @param text 文本
  29. * @param color 前景色
  30. */
  31. public TextLine(String text,Color color) {
  32. this(text,color,LEFT,UIManager.getFont("Label.font"));
  33. }
  34. /**
  35. * 以指定的文本以及前景色构造一个TextLine。
  36. * @param text 文本
  37. * @param align 对齐方式
  38. */
  39. public TextLine(String text,int align) {
  40. this(text,UIManager.getColor("Label.textForeground"),align,UIManager.getFont("Label.font"));
  41. }
  42. /**
  43. * 以指定的文本、前景色以及显示的对齐方式构造一个TextLine。
  44. * @param text 文本
  45. * @param color 前景色
  46. * @param align 显示的对齐方式
  47. */
  48. public TextLine(String text,Color color,int align) {
  49. this(text,color,align,UIManager.getFont("Label.font"));
  50. }
  51. /**
  52. * 以指定的文本、前景色、显示的对齐方式以及字体构造一个TextLine。
  53. * @param text 文本
  54. * @param color 前景色
  55. * @param align 显示的对齐方式
  56. * @param font 字体
  57. */
  58. public TextLine(String text,Color color,int align,Font font) {
  59. this.text=text;
  60. this.color=color;
  61. this.align=align;
  62. this.font=font;
  63. }
  64. }