Package javax.swing

Examples of javax.swing.BoxLayout.preferredLayoutSize()


 
  private void testBasic(TestHarness harness)
  {
    JPanel container = new JPanel();
    BoxLayout layout = new BoxLayout(container, BoxLayout.X_AXIS);
    harness.check(layout.preferredLayoutSize(container), new Dimension(0, 0));
    container.setBorder(BorderFactory.createEmptyBorder(1, 2, 3, 4));
    harness.check(layout.preferredLayoutSize(container), new Dimension(6, 4));
   
    // must call with original container
    boolean pass = false;
View Full Code Here


  {
    JPanel container = new JPanel();
    BoxLayout layout = new BoxLayout(container, BoxLayout.X_AXIS);
    harness.check(layout.preferredLayoutSize(container), new Dimension(0, 0));
    container.setBorder(BorderFactory.createEmptyBorder(1, 2, 3, 4));
    harness.check(layout.preferredLayoutSize(container), new Dimension(6, 4));
   
    // must call with original container
    boolean pass = false;
    try
      {
View Full Code Here

   
    // must call with original container
    boolean pass = false;
    try
      {
        /*Dimension result =*/ layout.preferredLayoutSize(new JPanel());
      }
    catch (AWTError e)
      {
        pass = true;
      }
View Full Code Here

    p2.setPreferredSize(new Dimension(33, 44));
    p3.setPreferredSize(new Dimension(55, 66));
    container.add(p1);
    container.add(p2);
    container.add(p3);
    harness.check(layout.preferredLayoutSize(container), new Dimension(99, 66));
  }
 
  private void testYAxis(TestHarness harness)
  {
    harness.checkPoint("testYAxis");
View Full Code Here

    p3.setPreferredSize(new Dimension(55, 66));
    container.add(p1);
    container.add(p2);
    container.add(p3);
    container.doLayout();
    harness.check(layout.preferredLayoutSize(container), new Dimension(55, 132));
  }

  private void testLineAxis(TestHarness harness)
  {
    harness.checkPoint("testLineAxis");
View Full Code Here

    p3.setPreferredSize(new Dimension(55, 66));
    container.add(p1);
    container.add(p2);
    container.add(p3);
    container.doLayout();
    harness.check(layout.preferredLayoutSize(container), new Dimension(99, 66));
  }

  private void testPageAxis(TestHarness harness)
  {
    harness.checkPoint("testPageAxis");
View Full Code Here

    p3.setPreferredSize(new Dimension(55, 66));
    container.add(p1);
    container.add(p2);
    container.add(p3);
    container.doLayout();
    harness.check(layout.preferredLayoutSize(container), new Dimension(55, 132));
  }

  private void testJSeparator(TestHarness harness)
  {
    harness.checkPoint("testJSeparator");
View Full Code Here

    BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS);
    container.setLayout(layout);
    JSeparator s1 = new JSeparator();
    container.add(s1);
    container.doLayout();
    harness.check(layout.preferredLayoutSize(container), new Dimension(0, 2));
  }


}
View Full Code Here

        component21.setPreferredSize(new Dimension(60, 60));
        component31.setPreferredSize(new Dimension(70, 70));
        container1.add(component11);
        container1.add(component21);
        assertEquals(new Dimension(110, 60), layout1.preferredLayoutSize(container1));
        assertEquals(new Dimension(60, 110), layout2.preferredLayoutSize(container1));
        layout1.invalidateLayout(container1);
        layout2.invalidateLayout(container1);
        container1.add(component31);
        assertEquals(new Dimension(180, 70), layout1.preferredLayoutSize(container1));
        assertEquals(new Dimension(70, 180), layout2.preferredLayoutSize(container1));
View Full Code Here

        assertEquals(new Dimension(60, 110), layout2.preferredLayoutSize(container1));
        layout1.invalidateLayout(container1);
        layout2.invalidateLayout(container1);
        container1.add(component31);
        assertEquals(new Dimension(180, 70), layout1.preferredLayoutSize(container1));
        assertEquals(new Dimension(70, 180), layout2.preferredLayoutSize(container1));
    }

    /*
     * Test method for 'javax.swing.plaf.basic.DefaultMenuLayout.DefaultMenuLayout(Container, int)'
     */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.