/** {@inheritDoc} */ public void layoutContainer(final Container parent) { synchronized (parent.getTreeLock()) { int width = parent.getWidth(); int height = parent.getHeight(); Rectangle bounds = new Rectangle(0, 0, width, height); int componentsCount = components.size(); for (int i = 0; i < componentsCount; i++) { Component comp = components.get(i); comp.setBounds(bounds); parent.setComponentZOrder(comp, componentsCount - i - 1); } } }
private static void init() { // *** Create instructions for the user here *** String[] instructions = { "This is an AUTOMATIC test, simply wait until it is done.", "The result (passed or failed) will be shown in the", "message window below." }; Sysout.createDialog(); Sysout.printInstructions(instructions); try { Container c = new Container(); Button b = new Button("b"); c.setComponentZOrder(b, 0); } catch (ArrayIndexOutOfBoundsException e) { e.printStackTrace(); fail( "The setComponentZOrder method used to insert a component caused the mixing code to throw the exception: " + e); } pass(); } // End init()
package filthyRichClients.chapter10.LayeredPanes.StackLayout;