/* * @topic W080131 GUI Demo app * @brief class Label extends Widget */ package guidemo; public class Window extends Widget { // data attributes IGuiComponent[] widgets = new IGuiComponent[10]; int widgetCount = 0; // constructors public Window( int x, int y, int w, int h, String caption ) { super( x, y, w, h, caption ); } // operations public void add( IGuiComponent widget ) { widgets[ widgetCount ] = widget; ++widgetCount; } @Override public void show() { System.out.println( "Window -- " + getCaption() ); int idx = 0; for ( ; idx < widgetCount; ++idx ) { widgets[ idx ].show(); } } }//class Window