1 29 30 package nextapp.echo2.app; 31 32 35 public class Window extends Component { 36 37 public static final String PROPERTY_TITLE = "title"; 38 39 42 public Window() { 43 super(); 44 add(new ContentPane()); 45 } 46 47 52 public ContentPane getContent() { 53 if (getComponentCount() == 0) { 54 return null; 55 } else { 56 return (ContentPane) getComponent(0); 57 } 58 } 59 60 65 public String getTitle() { 66 return (String ) getProperty(PROPERTY_TITLE); 67 } 68 69 72 public boolean isValidChild(Component component) { 73 return getComponentCount() == 0 && component instanceof ContentPane; 74 } 75 76 82 public boolean isValidParent(Component parent) { 83 return false; 84 } 85 86 91 public void setContent(ContentPane newValue) { 92 removeAll(); 93 add(newValue); 94 } 95 96 101 public void setTitle(String newValue) { 102 setProperty(PROPERTY_TITLE, newValue); 103 } 104 } 105 | Popular Tags |