Package javax.swing

Examples of javax.swing.ScrollPaneLayout$UIResource


   * @param h the test harness to use
   */
  private void testHorizontalScrollbarAlways(TestHarness h)
  {
    JScrollPane sp = new JScrollPane();
    ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    JPanel view = new JPanel();
    view.setMinimumSize(new Dimension(100, 100));
    sp.getViewport().add(view);
    Insets i = sp.getInsets();
    Component[] c = sp.getComponents();
    // Check ScrollPane size < view size.
    sp.setSize(50, 50);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height
                          + c[2].getMinimumSize().height));
    // Check ScrollPane size > view size.
    sp.setSize(150, 150);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height
                          + c[2].getMinimumSize().height));
  }
View Full Code Here


   * @param h the test harness to use
   */
  private void testHorizontalScrollbarAsNeeded(TestHarness h)
  {
    JScrollPane sp = new JScrollPane();
    ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    JPanel view = new JPanel();
    view.setMinimumSize(new Dimension(100, 100));
    sp.getViewport().add(view);
    Insets i = sp.getInsets();
    Component[] c = sp.getComponents();
    // Check ScrollPane size < view size.
    sp.setSize(50, 50);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height
                          + c[2].getMinimumSize().height));
    // Check ScrollPane size > view size.
    sp.setSize(150, 150);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height
                          + c[2].getMinimumSize().height));
  }
View Full Code Here

   * @param h the test harness to use
   */
  private void testHorizontalScrollbarNever(TestHarness h)
  {
    JScrollPane sp = new JScrollPane();
    ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    JPanel view = new JPanel();
    view.setMinimumSize(new Dimension(100, 100));
    sp.getViewport().add(view);
    Insets i = sp.getInsets();
    Component[] c = sp.getComponents();
    // Check ScrollPane size < view size.
    sp.setSize(50, 50);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
    // Check ScrollPane size > view size.
    sp.setSize(150, 150);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
  }
View Full Code Here

   * @param h the test harness to use
   */
  private void testVerticalScrollbarAlways(TestHarness h)
  {
    JScrollPane sp = new JScrollPane();
    ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel view = new JPanel();
    view.setMinimumSize(new Dimension(100, 100));
    sp.getViewport().add(view);
    Insets i = sp.getInsets();
    Component[] c = sp.getComponents();
    // Check ScrollPane size < view size.
    sp.setSize(50, 50);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width
                          + c[1].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
    // Check ScrollPane size > view size.
    sp.setSize(150, 150);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width
                          + c[1].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
  }
View Full Code Here

   * @param h the test harness to use
   */
  private void testVerticalScrollbarAsNeeded(TestHarness h)
  {
    JScrollPane sp = new JScrollPane();
    ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    JPanel view = new JPanel();
    view.setMinimumSize(new Dimension(100, 100));
    sp.getViewport().add(view);
    Insets i = sp.getInsets();
    Component[] c = sp.getComponents();
    // Check ScrollPane size < view size.
    sp.setSize(50, 50);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width
                          + c[1].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
    // Check ScrollPane size > view size.
    sp.setSize(150, 150);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width
                          + c[1].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
  }
View Full Code Here

   * @param h the test harness to use
   */
  private void testVerticalScrollbarNever(TestHarness h)
  {
    JScrollPane sp = new JScrollPane();
    ScrollPaneLayout l = (ScrollPaneLayout) sp.getLayout();
    sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    JPanel view = new JPanel();
    sp.getViewport().add(view);
    view.setMinimumSize(new Dimension(100, 100));
    Insets i = sp.getInsets();
    Component[] c = sp.getComponents();
    // Check ScrollPane size < view size.
    sp.setSize(50, 50);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
    // Check ScrollPane size > view size.
    sp.setSize(150, 150);
    h.check(l.minimumLayoutSize(sp),
            new Dimension(i.left + i.right + c[0].getMinimumSize().width,
                          i.top + i.bottom + c[0].getMinimumSize().height));
  }
View Full Code Here

        scrollpane = (JScrollPane)c;
        installDefaults(scrollpane);
        installListeners(scrollpane);
        installKeyboardActions(scrollpane);

        scrollpane.setLayout(new ScrollPaneLayout());
    }
View Full Code Here

        scrollpane = (JScrollPane)c;
        installDefaults(scrollpane);
        installListeners(scrollpane);
        installKeyboardActions(scrollpane);

        scrollpane.setLayout(new ScrollPaneLayout());
    }
View Full Code Here

TOP

Related Classes of javax.swing.ScrollPaneLayout$UIResource

Copyright © 2018 www.massapicom. 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.