package com.vci.client.ui.swing; import java.awt.Color; import java.awt.Graphics; import javax.swing.JTextArea; /** * 继承JTextArea,在此基础上增加红色标记,目的是提醒用户文本内容不能为空。 * @author Administrator * */ public class KTextArea extends JTextArea{ private static final long serialVersionUID = 1L; public void paint (Graphics g) { super.paint (g); g.setColor (Color.red); int text_XSize = this.getWidth (); int[] xSeq = new int[3]; int[] ySeq = new int[3]; xSeq[0] = text_XSize - 6; ySeq[0] = 0; xSeq[1] = text_XSize; ySeq[1] = 0; xSeq[2] = text_XSize; ySeq[2] = 6; g.fillPolygon (xSeq, ySeq, 3); } }