1 7 package javax.swing; 8 9 import java.awt.Container ; 10 import javax.swing.plaf.ComponentUI ; 11 import sun.awt.AppContext; 12 13 25 public abstract class LayoutStyle { 26 34 public static void setInstance(LayoutStyle style) { 35 synchronized(LayoutStyle .class) { 36 if (style == null) { 37 AppContext.getAppContext().remove(LayoutStyle .class); 38 } 39 else { 40 AppContext.getAppContext().put(LayoutStyle .class, style); 41 } 42 } 43 } 44 45 53 public static LayoutStyle getInstance() { 54 LayoutStyle style; 55 synchronized(LayoutStyle .class) { 56 style = (LayoutStyle )AppContext.getAppContext(). 57 get(LayoutStyle .class); 58 } 59 if (style == null) { 60 return UIManager.getLookAndFeel().getLayoutStyle(); 61 } 62 return style; 63 } 64 65 66 77 public enum ComponentPlacement { 78 86 RELATED, 87 88 94 UNRELATED, 95 96 106 INDENT; 107 } 108 109 110 116 public LayoutStyle() { 117 } 118 119 172 public abstract int getPreferredGap(JComponent component1, 173 JComponent component2, 174 ComponentPlacement type, int position, 175 Container parent); 176 177 198 public abstract int getContainerGap(JComponent component, int position, 199 Container parent); 200 } 201 | Popular Tags |