1 7 package javax.swing.border; 8 9 import java.awt.Graphics ; 10 import java.awt.Insets ; 11 import java.awt.Rectangle ; 12 import java.awt.Component ; 13 import java.io.Serializable ; 14 15 32 public abstract class AbstractBorder implements Border , Serializable 33 { 34 35 44 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { 45 } 46 47 55 public Insets getBorderInsets(Component c) { 56 return new Insets (0, 0, 0, 0); 57 } 58 59 65 public Insets getBorderInsets(Component c, Insets insets) { 66 insets.left = insets.top = insets.right = insets.bottom = 0; 67 return insets; 68 } 69 70 74 public boolean isBorderOpaque() { return false; } 75 76 85 public Rectangle getInteriorRectangle(Component c, int x, int y, int width, int height) { 86 return getInteriorRectangle(c, this, x, y, width, height); 87 } 88 89 101 public static Rectangle getInteriorRectangle(Component c, Border b, int x, int y, int width, int height) { 102 Insets insets; 103 if(b != null) 104 insets = b.getBorderInsets(c); 105 else 106 insets = new Insets (0, 0, 0, 0); 107 return new Rectangle (x + insets.left, 108 y + insets.top, 109 width - insets.right - insets.left, 110 height - insets.top - insets.bottom); 111 } 112 113 117 static boolean isLeftToRight( Component c ) { 118 return c.getComponentOrientation().isLeftToRight(); 119 } 120 121 } 122 | Popular Tags |