Package javax.swing

Examples of javax.swing.DefaultListSelectionModel.insertIndexInterval()


    harness.checkPoint("SINGLE_SELECTION (1)");
    DefaultListSelectionModel m = new DefaultListSelectionModel();
    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m.addSelectionInterval(3, 3);
    m.addListSelectionListener(this);
    m.insertIndexInterval(3, 2, true);
    harness.check(m.isSelectedIndex(3), false);
    harness.check(m.isSelectedIndex(4), false);
    harness.check(m.isSelectedIndex(5), true);
    harness.check(m.getAnchorSelectionIndex(), 5);
    harness.check(m.getLeadSelectionIndex(), 5);
View Full Code Here


    harness.check(lastEvent.getFirstIndex(), 3);
    harness.check(lastEvent.getLastIndex(), 5);
   
    harness.checkPoint("SINGLE_SELECTION (2)");
    lastEvent = null;
    m.insertIndexInterval(5, 2, false)// this does nothing
    harness.check(m.isSelectedIndex(5), true);
    harness.check(m.isSelectedIndex(6), false);
    harness.check(m.isSelectedIndex(7), false);
    harness.check(lastEvent, null);
   
View Full Code Here

    // try negative index
    harness.checkPoint("SINGLE_SELECTION (3)");
    boolean pass = false;
    try
    {
      m.insertIndexInterval(-1, 1, true);
    }
    catch (IndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

    // try negative count
    harness.checkPoint("SINGLE_SELECTION (4)");
    pass = false;
    try
    {
      m.insertIndexInterval(0, -1, true);
    }
    catch (IndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

    harness.check(pass)
   
    // try zero count
    harness.checkPoint("SINGLE_SELECTION (5)");
    lastEvent = null;
    m.insertIndexInterval(0, 0, true);
    harness.check(lastEvent.getFirstIndex(), 0)
    harness.check(lastEvent.getLastIndex(), 6)
  }

  private void testSingleInterval(TestHarness harness)
View Full Code Here

    m.setSelectionInterval(3, 3);
    m.addListSelectionListener(this);
   
    // here, we insert two new items in the list right before the selected item
    // 3 (which moves up to position 5).
    m.insertIndexInterval(3, 2, true);
    harness.check(m.isSelectedIndex(3), true); // FIXME: surely wrong?
    harness.check(m.isSelectedIndex(4), true); // FIXME: likewise?
    harness.check(m.isSelectedIndex(5), true);
    harness.check(m.isSelectedIndex(6), false);
    harness.check(m.getAnchorSelectionIndex(), 5);
View Full Code Here

    m.addListSelectionListener(this);
    lastEvent = null;
   
    // here, we insert two new items in the list right AFTER the selected item
    // 3
    m.insertIndexInterval(3, 2, false);
    harness.check(m.isSelectedIndex(3), true);
    harness.check(m.isSelectedIndex(4), true); // FIXME: surely wrong?
    harness.check(m.isSelectedIndex(5), true); // FIXME: likewise?
    harness.check(m.isSelectedIndex(6), false);
    harness.check(m.getAnchorSelectionIndex(), 3);
View Full Code Here

 
    // try negative index
    boolean pass = false;
    try
    {
      m.insertIndexInterval(-1, 1, true);
    }
    catch (IndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

   
    // try negative count
    pass = false;
    try
    {
      m.insertIndexInterval(0, -1, true);
    }
    catch (IndexOutOfBoundsException e)
    {
      pass = true;
    }
View Full Code Here

    }
    harness.check(pass);
   
    // try zero count
    lastEvent = null;
    m.insertIndexInterval(0, 0, true);
    harness.check(lastEvent.getSource(), m);
    harness.check(lastEvent.getFirstIndex(), 0);
    harness.check(lastEvent.getLastIndex(), 6);
  }
 
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.