Package javax.swing

Examples of javax.swing.JScrollBar


   * @param harness the test harness to use
   */
  private void testDecrButton(TestHarness harness)
  {
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
    ui.setScrollbar(new JScrollBar());
    harness.check(ui.getDecrButton(), null);
    ui.installComponents();
    harness.check(ui.getDecrButton() != null);
  }
View Full Code Here


    events.add(e);
  }
 
  public void test(TestHarness harness)
  {
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL, 50, 5, 10, 90);
    AccessibleContext ac = scrollBar.getAccessibleContext();
    harness.check(ac.getAccessibleName(), null);
    harness.check(ac.getAccessibleRole(), AccessibleRole.SCROLL_BAR);
    harness.check(ac.getAccessibleAction(), null);
    harness.check(ac.getAccessibleComponent(), ac);
    harness.check(ac.getAccessibleDescription(), null);
    harness.check(ac.getAccessibleEditableText(), null);
    harness.check(ac.getAccessibleIcon(), null);
    harness.check(ac.getAccessibleTable(), null);
    harness.check(ac.getAccessibleText(), null);
   
    // the AccessibleContext is also the AccessibleValue...
    AccessibleValue av = ac.getAccessibleValue();
    harness.check(av, ac);
    harness.check(av.getCurrentAccessibleValue(), new Integer(50));
    harness.check(av.getMinimumAccessibleValue(), new Integer(10));
    harness.check(av.getMaximumAccessibleValue(), new Integer(85));
   
    // check that setting the accessible value updates the slider
    ac.addPropertyChangeListener(this);
    boolean b = av.setCurrentAccessibleValue(new Integer(55));
    harness.check(scrollBar.getValue(), 55);
    harness.check(b);
    harness.check(events.size(), 1);
    PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(50));
    harness.check(e0.getNewValue(), new Integer(55));
   
    // set the value below the minimum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(5));
    harness.check(av.getCurrentAccessibleValue(), new Integer(10));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(55));
    harness.check(e0.getNewValue(), new Integer(10));
   
    // set the value above the maximum
    events.clear();
    b = av.setCurrentAccessibleValue(new Integer(105));
    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
    harness.check(b);
    harness.check(events.size(), 1);
    e0 = (PropertyChangeEvent) events.get(0);
    harness.check(e0.getPropertyName(),
        AccessibleContext.ACCESSIBLE_VALUE_PROPERTY);
    harness.check(e0.getSource(), ac);
    harness.check(e0.getOldValue(), new Integer(10));
    harness.check(e0.getNewValue(), new Integer(85));
   
    // set the value to null
    events.clear();
    b = av.setCurrentAccessibleValue(null);
    harness.check(av.getCurrentAccessibleValue(), new Integer(85));
    harness.check(events.size(), 0);
    harness.check(!b);
   
    // check the state settings...
    AccessibleStateSet set = ac.getAccessibleStateSet();
    harness.check(set.contains(AccessibleState.ENABLED));
    harness.check(set.contains(AccessibleState.FOCUSABLE));
    harness.check(set.contains(AccessibleState.VISIBLE));
    harness.check(set.contains(AccessibleState.OPAQUE));
    harness.check(set.contains(AccessibleState.HORIZONTAL));
   
    // each call creates a new set...
    AccessibleStateSet set2 = ac.getAccessibleStateSet();
    harness.check(set != set2);
   
    // check the orientation state setting...
    scrollBar.setOrientation(JSlider.VERTICAL);
    set = ac.getAccessibleStateSet();
    harness.check(set.contains(AccessibleState.VERTICAL));
  }
View Full Code Here

public class getActionMap implements Testlet
{
  public void test(TestHarness harness)
  {
    JScrollBar sb = new JScrollBar();
    ActionMap m = sb.getActionMap();
    harness.check(m.keys(), null);
    ActionMap mp = m.getParent();
    harness.check(mp.get("positiveUnitIncrement") instanceof Action);
    harness.check(mp.get("positiveBlockIncrement") instanceof Action);
    harness.check(mp.get("negativeUnitIncrement") instanceof Action);
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    JScrollPane pane = new JScrollPane();
    JScrollBar scrollBar = pane.createVerticalScrollBar();
    harness.check(scrollBar.getClass().getName().endsWith("ScrollBar"));
    harness.check(scrollBar.getOrientation(), JScrollBar.VERTICAL);
    harness.check(scrollBar.getClientProperty("JScrollBar.isFreeStanding"),
            null);
  }
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    JScrollPane pane = new JScrollPane();
    JScrollBar scrollBar = pane.createHorizontalScrollBar();
    harness.check(scrollBar.getClass().getName().endsWith("ScrollBar"));
    harness.check(scrollBar.getOrientation(), JScrollBar.HORIZONTAL);
    harness.check(scrollBar.getClientProperty("JScrollBar.isFreeStanding"),
            null);
  }
View Full Code Here

    {
      e.printStackTrace();
    }   
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    harness.check(ui.getScrollBarWidthField(), 0);
    ui.setScrollbar(new JScrollBar());
    ui.installDefaults();
   
    // the scrollBarWidth field must be initialised, the JGoodies Plastic
    // look and feel relies on this...
    harness.check(ui.getScrollBarWidthField(), 17);   
View Full Code Here

    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    harness.check(ui.getTrackBounds(), null);
    harness.check(ui.getThumbBounds(), null);
    harness.check(ui.getScrollBarWidthField(), 0);
   
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.setUI(ui);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    scrollBar.setBounds(0, 0, 100, 20);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    JPanel panel = new JPanel(new BorderLayout());
    panel.setSize(100, 20);
View Full Code Here

   */
  public void testHorizontal(TestHarness harness
  {
    harness.checkPoint("testHorizontal()");
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
    scrollBar.setUI(ui);
    scrollBar.setBounds(0, 0, 100, 20);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(15, 0, 70, 20));   
    harness.check(ui.getThumbBounds(), new Rectangle(15, 0, 15, 20));
   
    scrollBar.setBounds(40, 50, 250, 37);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(15, 0, 220, 37));   
    harness.check(ui.getThumbBounds(), new Rectangle(15, 0, 22, 37))
  }
View Full Code Here

   */
  public void testHorizontalFreeStanding(TestHarness harness
  {
    harness.checkPoint("testHorizontalFreeStanding()");
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.putClientProperty("JScrollBar.isFreeStanding", Boolean.TRUE);
    scrollBar.setUI(ui);
    scrollBar.setBounds(0, 0, 100, 20);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(15, 0, 69, 20));   
    harness.check(ui.getThumbBounds(), new Rectangle(15, 0, 17, 20));
   
    scrollBar.setBounds(40, 50, 250, 37);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(15, 0, 219, 37));   
    harness.check(ui.getThumbBounds(), new Rectangle(15, 0, 21, 37))
  }
View Full Code Here

   */
  public void testVertical(TestHarness harness
  {
    harness.checkPoint("testVertical()");
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.VERTICAL);
    scrollBar.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
    scrollBar.setUI(ui);
    scrollBar.setBounds(0, 0, 20, 100);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 15, 20, 70));   
    harness.check(ui.getThumbBounds(), new Rectangle(0, 15, 20, 15));
   
    scrollBar.setBounds(40, 50, 37, 250);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 15, 37, 220));   
    harness.check(ui.getThumbBounds(), new Rectangle(0, 15, 37, 22))
  }
View Full Code Here

TOP

Related Classes of javax.swing.JScrollBar

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.