1 14 package org.compiere.grid.ed; 15 16 import java.awt.*; 17 import java.awt.Component ; 18 import java.awt.Graphics ; 19 import javax.swing.border.*; 20 21 import org.compiere.util.*; 22 import org.compiere.plaf.*; 23 24 30 public class VLine extends AbstractBorder 31 { 32 35 public VLine() 36 { 37 this(""); 38 } 40 44 public VLine(String header) 45 { 46 super(); 47 setHeader(header); 48 } 50 51 private String m_header = ""; 52 53 private Font m_font = CompierePLAF.getFont_Label(); 54 private Color m_color = CompierePLAF.getTextColor_Label(); 55 56 57 public final static int GAP = 5; 58 59 public final static int SPACE = 4; 61 70 public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) 71 { 72 Graphics copy = g.create(); 73 if (copy != null) 74 { 75 try 76 { 77 copy.translate(x, y); 78 paintLine(c, copy, w, h); 79 } 80 finally 81 { 82 copy.dispose(); 83 } 84 } 85 } 87 94 private void paintLine (Component c, Graphics g, int w, int h) 95 { 96 int y = h-SPACE; 97 g.setColor(Color.darkGray); 99 g.drawLine(GAP, y, w-GAP, y); 100 g.setColor(Color.white); 101 g.drawLine(GAP, y+1, w-GAP, y+1); 103 if (m_header == null || m_header.length() == 0) 104 return; 105 106 g.setColor(m_color); 108 g.setFont(m_font); 109 int x = GAP; 110 if (!Language.getLanguage().isLeftToRight()) 111 { 112 } 113 g.drawString(m_header, GAP, h-SPACE-1); 114 } 116 120 public void setHeader(String newHeader) 121 { 122 m_header = newHeader.replace('_', ' '); 123 } 125 129 public String getHeader() 130 { 131 return m_header; 132 } 134 } | Popular Tags |