1 14 package org.compiere.grid.ed; 15 16 import javax.swing.*; 17 import javax.swing.plaf.*; 18 import javax.swing.text.*; 19 import java.awt.*; 20 21 27 public class VOvrCaret extends DefaultCaret 28 { 29 32 public VOvrCaret() 33 { 34 super(); 35 } 37 43 public void paint(Graphics g) 44 { 45 boolean dotLTR = true; Position.Bias dotBias = Position.Bias.Forward; 47 48 if (isVisible()) 50 { 51 try 52 { 53 TextUI mapper = getComponent().getUI(); 54 Rectangle r = mapper.modelToView(getComponent(), getDot(), dotBias); 55 Rectangle e = mapper.modelToView(getComponent(), getDot()+1, dotBias); 56 g.setColor(Color.blue); 58 int cWidth = e.x-r.x; 60 int cHeight = 4; 61 int cThick = 2; 62 g.fillRect(r.x-1, r.y, cWidth, cThick); g.fillRect(r.x-1, r.y, cThick, cHeight); g.fillRect(r.x-1+cWidth, r.y, cThick, cHeight); int yStart = r.y+r.height; 68 g.fillRect(r.x-1, yStart-cThick, cWidth, cThick); g.fillRect(r.x-1, yStart-cHeight, cThick, cHeight); g.fillRect(r.x-1+cWidth, yStart-cHeight, cThick, cHeight); } 72 catch (BadLocationException e) 73 { 74 } 77 } } 80 88 protected synchronized void damage(Rectangle r) 89 { 90 if (r != null) 91 { 92 x = r.x - 4; y = r.y; 94 width = 18; height = r.height; 96 repaint(); 97 } 98 } 100 } | Popular Tags |