1 24 25 package swingwtx.swing.border; 26 27 import swingwt.awt.*; 28 29 public abstract class AbstractBorder implements Border { 30 31 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {} 32 public Insets getBorderInsets(Component c) { Insets insets = new Insets(); return getBorderInsets(c, insets); } 33 public Insets getBorderInsets(Component c, Insets insets) { return insets; } 34 public boolean isBorderOpaque() { return false; } 35 public Rectangle getInteriorRectangle(Component c, int x, int y, int width, int height) { 36 return getInteriorRectangle(c, this, x, y, width, height); 37 } 38 public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) { 39 Insets insets; 40 if(b != null) 41 insets = b.getBorderInsets(c); 42 else 43 insets = new Insets(0,0,0,0); 44 return new Rectangle( x+insets.left, y+insets.top, width-insets.right-insets.left, 45 height-insets.top-insets.bottom); 46 } 47 static boolean isLeftToRight( Component c ) { return c.getComponentOrientation().isLeftToRight(); } 48 } 49 | Popular Tags |