< prev index next >

test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java

Print this page




  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.*;
  25 import java.awt.event.InputEvent;
  26 
  27 /*
  28  * @test
  29  * @summary Have different components having different preferred sizes
  30  *          added to a grid layout having various values of row/columns.
  31  *          Check if the compnents are correctly laid out.
  32  *          The strategy followed is to calculate the component location
  33  *          depending on the preferred sizes and gaps and click the cornors
  34  *          of the components to check if events are triggered
  35  * @library ../../../../lib/testlibrary/
  36  * @build ExtendedRobot
  37  * @run main ComponentPreferredSize
  38  * @run main ComponentPreferredSize -hg 20 -vg 20

  39  */
  40 
  41 public class ComponentPreferredSize {
  42 
  43     private int width = 200;
  44     private int height = 200;
  45     private final int hGap, vGap;
  46     private final int rows = 3;
  47     private final int columns = 2;
  48     private final int componentCount = 6;
  49 
  50     private Button[] buttons;
  51     private Frame frame;
  52 
  53     private ExtendedRobot robot;
  54     private GridLayout layout;
  55 
  56     private volatile boolean actionPerformed = false;
  57 
  58     public ComponentPreferredSize(int hGap, int vGap) throws Exception {




  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.awt.*;
  25 import java.awt.event.InputEvent;
  26 
  27 /*
  28  * @test
  29  * @summary Have different components having different preferred sizes
  30  *          added to a grid layout having various values of row/columns.
  31  *          Check if the compnents are correctly laid out.
  32  *          The strategy followed is to calculate the component location
  33  *          depending on the preferred sizes and gaps and click the cornors
  34  *          of the components to check if events are triggered
  35  * @library ../../../../lib/testlibrary/
  36  * @build ExtendedRobot
  37  * @run main ComponentPreferredSize
  38  * @run main ComponentPreferredSize -hg 20 -vg 20
  39  * @key randomness
  40  */
  41 
  42 public class ComponentPreferredSize {
  43 
  44     private int width = 200;
  45     private int height = 200;
  46     private final int hGap, vGap;
  47     private final int rows = 3;
  48     private final int columns = 2;
  49     private final int componentCount = 6;
  50 
  51     private Button[] buttons;
  52     private Frame frame;
  53 
  54     private ExtendedRobot robot;
  55     private GridLayout layout;
  56 
  57     private volatile boolean actionPerformed = false;
  58 
  59     public ComponentPreferredSize(int hGap, int vGap) throws Exception {


< prev index next >